{"id":"b4bfeda0-1283-4103-bb6b-e3965663b0f4","slug":"selfhub","kind":"mcp","name":"SelfHub","summary":"Personal MCP-powered digital hub - private data center with AI integration for memory, notes, and personal knowledge management","owner":"Sagargupta16","repoUrl":"https://github.com/Sagargupta16/SelfHub","license":"MIT","licenseTier":"permissive","trust":"community","stars":5,"match":null,"fewStars":false,"format":"mcp","createdAt":"2025-11-09T13:09:05.000Z","addedAt":"2026-10-21T05:42:56.641Z","logoUrl":"https://avatars.githubusercontent.com/u/92421383?u=9cc5eb8f30e254b270cc5eb8601b63dec488b20e&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["memory-knowledge","data-analytics","productivity"],"tags":["ai","claude","memory","typescript","digital-hub","knowledge-management","personal-data"],"runtime":"node","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-21T05:43:08.828Z","sample":false,"url":"https://conduits.dev/tools/selfhub","language":"TypeScript","transports":["stdio"],"install":{"npm":"selfhub-mcp-server"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# SelfHub MCP Server\n\n[![CI/CD Pipeline](https://github.com/Sagargupta16/SelfHub/actions/workflows/ci.yml/badge.svg)](https://github.com/Sagargupta16/SelfHub/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n**Your Personal AI Memory Hub** - Store and retrieve your personal data from any MCP-enabled AI assistant.\n\n## 🎯 What is SelfHub?\n\nSelfHub is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that acts as your personal digital memory. Store notes, preferences, code snippets, tasks, and any information you want - then access them seamlessly from any AI assistant that supports MCP (Claude Desktop, VS Code Copilot, etc.).\n\nThink of it as your **personal knowledge base that travels with you across all AI conversations**.\n\n## Quick start\n\nPick one way to run it. Each needs a MongoDB; option 1 brings its own.\n\n**1. Docker Compose** (no local Node or MongoDB):\n\n```bash\ngit clone https://github.com/Sagargupta16/SelfHub.git\ncd SelfHub\ndocker compose build\nclaude mcp add selfhub -- docker compose -f /absolute/path/to/SelfHub/docker-compose.yml run --rm -T selfhub\n```\n\nThe client starts MongoDB (data kept in the `selfhub-data` volume) the first time it launches the server. `docker compose up -d mongo` on its own gives you a MongoDB on `localhost:27017` for options 2 and 3. That port is bound on `127.0.0.1`, so stop any local `mongod` already listening on 27017 first.\n\n**2. From source** - see [Setup with Claude Desktop](#-setup-with-claude-desktop) below.\n\n**3. npm, after the first release** (Node 24+, MongoDB at `MONGODB_URI` or `mongodb://localhost:27017/selfhub`). The `selfhub-mcp-server` package is not on npm yet; this works once the `v0.3.0` tag has been published:\n\n```bash\nclaude mcp add selfhub -e MONGODB_URI=mongodb://localhost:27017/selfhub -- npx -y selfhub-mcp-server\n```\n\n### See it work in 10 seconds\n\n```bash\npnpm install\npnpm demo\n```\n\n`pnpm demo` starts a throwaway in-memory MongoDB and three separate server processes, one per client. What the first one stores, the next two recall. It never touches `MONGODB_URI`. Real output (IDs are random per run):\n\n```text\n[claude-desktop] store_memory {\"content\":\"I use pnpm for every JavaScript project, never npm or yarn\",\"category\":\"personal\",\"tags\":[\"preferences\",\"tooling\"],\"importance\":5}\n  -> stored mem_0921e35e\n\n[claude-desktop] store_memory {\"content\":\"API responses use camelCase keys and ISO 8601 dates\",\"category\":\"projects\",\"tags\":[\"api\"]}\n  -> stored mem_245a76c2\n\n[claude-desktop] create_context {\"name\":\"Billing API\",\"type\":\"project\",\"memoryIds\":[\"mem_245a76c2\"]}\n  -> created ctx_1cc3a4fc\n\n[claude-code] search_memories {\"query\":\"pnpm\"}\n  -> 1 result: \"I use pnpm for every JavaScript project, never npm or yarn\" (score 0.56, relevance high)\n\n[vscode-copilot] activate_context {\"id\":\"ctx_1cc3a4fc\"}\n  -> Billing API, 1 memory: \"API responses use camelCase keys and ISO 8601 dates\"\n\n[vscode-copilot] get_stats {}\n  -> 2 memories (personal 1, projects 1), 1 context\n```\n\n## Architecture\n\nThe MCP client launches SelfHub as a child process and talks JSON-RPC over stdio. Every tool call goes through a thin service layer into MongoDB, so the same memories show up in Claude Desktop, Claude Code and VS Code.\n\n```mermaid\nflowchart LR\n    subgraph Clients[\"MCP clients\"]\n        CD[Claude Desktop]\n        CC[Claude Code]\n        VS[VS Code Copilot]\n    end\n    subgraph SelfHub[\"SelfHub (Node.js, stdio)\"]\n        IDX[\"src/index.ts<br/>9 tool schemas + dispatcher\"]\n        MS[memory.service.ts]\n        CS[context.service.ts]\n        ST[\"mongodb-storage.ts<br/>Mongoose models\"]\n    end\n    DB[(\"MongoDB<br/>memories + contexts<br/>text index\")]\n    CD & CC & VS -- \"JSON-RPC over stdio\" --> IDX\n    IDX --> MS & CS\n    MS & CS --> ST\n    ST --> DB\n```\n\n### Design decisions\n\n- **stdio transport, no HTTP port** - the client owns the process lifetime, nothing listens on the network, and stdout is reserved for JSON-RPC (all logs go to stderr).\n- **MongoDB does the work** - `search_memories` runs one query that combines a `$text` index (content, title, description) with the category, type and tag filters, ranks by `textScore` and returns that score. `list_memories` sorts, skips and limits in MongoDB, so only one page crosses the wire. Indexes are built before the server accepts calls, so the first search on a new database works.\n- **Contexts as a second collection** - a context stores memory IDs and each memory stores its `contextId`. `activate_context` loads a project's memories with a single `$in` query and only one context is active at a time. Unknown IDs are never linked, and `delete_memory` pulls the ID out of every context, so `memoryCount` stays accurate.\n- **Plays by the stdio lifecycle** - when the client closes stdin, the server closes its MongoDB connection and exits instead of lingering.\n- **Readable IDs** - `mem_xxxxxxxx` and `ctx_xxxxxxxx` IDs are easy for a model to quote back in follow-up tool calls.\n\n## 🚀 Setup with Claude Desktop\n\n### Step 1: Install and Build\n\n```bash\ngit clone https://github.com/Sagargupta16/SelfHub.git\ncd SelfHub\npnpm install\ncp .env.example .env   # set MONGODB_URI to your MongoDB connection string\npnpm build\n\n# Optional: load sample data\npnpm seed\n```\n\n### Step 2: Configure Claude Desktop\n\nOpen the Claude Desktop configuration file:\n\n- **Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n- **Linux**: `~/.config/Claude/claude_desktop_config.json`\n\nAdd this configuration (replace with your actual path):\n\n```json\n{\n  \"mcpServers\": {\n    \"selfhub\": {\n      \"command\": \"node\",\n      \"args\": [\"C:\\\\absolute\\\\path\\\\to\\\\SelfHub\\\\build\\\\index.js\"]\n    }\n  }\n}\n```\n\n**Important for Windows:** Use double backslashes (`\\\\`) in the path!\n\n### Step 3: Restart Claude Desktop\n\nCompletely quit and restart Claude Desktop.\n\n### Step 4: Test It!\n\nIn Claude, try:\n\n- \"List all my memories\"\n- \"Search my memories for typescript\"\n- \"Store that I prefer dark mode in all applications\"\n\n## Setup with Claude Code\n\nAfter building, register the server with one command (use your absolute path):\n\n```bash\nclaude mcp add selfhub -- node /absolute/path/to/SelfHub/build/index.js\n```\n\n## 💻 Setup with VS Code\n\n### Step 1: Build the Server\n\n```bash\npnpm build\n```\n\n### Step 2: Configure VS Code\n\nCreate `.vscode/mcp.json` in your workspace (replace with your actual path):\n\n```json\n{\n  \"servers\": {\n    \"selfhub\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"C:\\\\absolute\\\\path\\\\to\\\\SelfHub\\\\build\\\\index.js\"]\n    }\n  }\n}\n```\n\nThen reload VS Code: Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) → Type \"Reload Window\" → Press Enter\n\n### Step 3: Test in Copilot Chat\n\nOpen GitHub Copilot Chat (`Ctrl+Alt+I`) and try:\n\n```\n@workspace list my memories\n@workspace search my memories for \"typescript\"\n@workspace store in my memory: I love using pnpm for package management\n```\n\n**Note:** You need GitHub Copilot extension installed and enabled.\n\n## 🛠️ Available Tools\n\n### Memory Management (5 tools)\n\n#### 1. `store_memory`\n\nStore new information in your memory hub.\n\n**Example:**\n\n```\nStore that I prefer TypeScript over JavaScript for all new projects\n```\n\n**Parameters:**\n\n- `content` (required) - The information to store\n- `type` - Memory type: `short-term`, `long-term`, `contextual`\n- `category` - Category: `personal`, `professional`, `learning`, `projects`, `code`, `tasks`, etc.\n- `title` - Optional title\n- `tags` - Array of tags\n- `importance` - 1-5 importance level\n\n#### 2. `retrieve_memory`\n\nGet a specific memory by its ID.\n\n**Example:**\n\n```\nRetrieve memory mem_001\n```\n\n#### 3. `list_memories`\n\nList memories with optional filters.\n\n**Example:**\n\n```\nList all my professional memories\nShow me memories tagged with 'typescript'\nList my personal memories\n```\n\n**Parameters:**\n\n- `type` - Filter by type\n- `category` - Filter by category\n- `tags` - Filter by tags\n- `contextId` - Filter by context\n- `limit` - Max results (default: 50)\n- `offset` - Pagination offset\n\n#### 4. `search_memories`\n\nSearch through your memories using text queries.\n\n**Example:**\n\n```\nSearch my memories for \"typescript\"\nFind memories about \"API design\"\n```\n\n**Parameters:**\n\n- `query` (required) - Search query\n- `category` - Filter by category\n- `type` - Filter by type\n- `tags` - Filter by tags\n- `limit` - Max results (default: 10)\n\nEach result carries `score` (MongoDB `textScore`, results are sorted by it) and `relevance` (`high`, `medium` or `low` from the memory's importance).\n\n#### 5. `delete_memory`\n\nDelete a memory by ID.\n\n**Example:**\n\n```\nDelete memory mem_005\n```\n\n### Context Management (3 tools)\n\n#### 6. `create_context`\n\nCreate a new organizational context.\n\n**Example:**\n\n```\nCreate a new context called \"Machine Learning Project\" for project type\n```\n\n**Parameters:**\n\n- `name` (required) - Context name\n- `type` (required) - `conversation`, `project`, `topic`, `temporal`\n- `description` - Optional description\n- `tags` - Array of tags\n- `memoryIds` - Initial memory IDs to include\n\n#### 7. `activate_context`\n\nActivate a context and load its memories.\n\n**Example:**\n\n```\nActivate the \"SelfHub Development\" context\n```\n\n#### 8. `list_contexts`\n\nList all contexts with optional filters.\n\n**Example:**\n\n```\nList all my project contexts\nShow active contexts\n```\n\n### Analytics (1 tool)\n\n#### 9. `get_stats`\n\nGet usage statistics and insights.\n\n**Example:**\n\n```\nShow me my memory statistics\n```\n\n**Returns:**\n\n- Total memories count\n- Memories by type breakdown\n- Memories by category breakdown\n- Total contexts\n- Most used tags\n\n## 📚 Example Usage Scenarios\n\n### Personal Knowledge Management\n\n```\nStore that I prefer dark mode in all applications\nStore my favorite TypeScript coding conventions\nRemember that I use pnpm for package management\nSearch my memories for \"preferences\"\n```\n\n### Project Development\n\n```\nCreate a new context called \"SelfHub Development\" for project type\nStore in SelfHub context: Database schema uses Drizzle ORM\nActivate the SelfHub Development context\nList all memories in the SelfHub context\n```\n\n### Learning & Notes\n\n```\nStore as learning: Vector embeddings represent text as numerical arrays\nTag with \"machine-learning\" and \"embeddings\"\nSearch my learning memories for \"embeddings\"\nList all my learning-related memories\n```\n\n### Code Snippets\n\n```\nStore this code snippet: const sum = (a, b) => a + b\nCategory: code, Tags: javascript, utility\nSearch my code for \"utility functions\"\n```\n\n## 🗂️ Sample Data\n\nRun `pnpm seed` to load 6 sample memories into your database:\n\n1. **mem_sample_001** - Dark mode UI preference (personal)\n2. **mem_sample_002** - TypeScript best practice (professional)\n3. **mem_sample_003** - MongoDB basics (learning)\n4. **mem_sample_004** - Documentation update task (tasks)\n5. **mem_sample_005** - NPM commands quick reference (code)\n6. **mem_sample_006** - SelfHub project overview (projects)\n\nAnd 2 sample contexts:\n\n1. **ctx_sample_001** - SelfHub Development (project)\n2. **ctx_sample_002** - Personal Preferences (topic)\n\n## 🏗️ Project Structure\n\n```\nSelfHub/\n├── src/\n│   ├── index.ts              # Main MCP server\n│   ├── seed.ts               # Sample data seeder\n│   ├── db/                   # Database layer\n│   │   ├── connection.ts\n│   │   └── schemas.ts\n│   ├── models/               # TypeScript type definitions\n│   │   ├── memory.model.ts\n│   │   ├── context.model.ts\n│   │   └── index.ts\n│   ├── services/             # Business logic layer\n│   │   ├── memory.service.ts\n│   │   └── context.service.ts\n│   └── storage/              # Storage implementation\n│       └── mongodb-storage.ts # MongoDB persistent storage\n├── test/                     # End-to-end tests (MCP SDK client + mongodb-memory-server)\n│   ├── harness.ts\n│   └── server.test.ts\n├── scripts/\n│   └── demo.ts               # pnpm demo: three clients, one memory\n├── build/                    # Compiled JavaScript output\n├── Dockerfile                # Production image (node:24-alpine)\n├── docker-compose.yml        # MongoDB + server\n├── server.json               # MCP Registry metadata\n├── .env.example              # Environment variable template\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## 🔧 Development\n\n### Available Scripts\n\n```bash\n# Development mode (auto-reload with tsx)\npnpm dev\n\n# Type checking\npnpm typecheck\n\n# Build for production\npnpm build\n\n# End-to-end tests\npnpm test\n\n# Cross-client demo against an in-memory MongoDB\npnpm demo\n\n# Clean build directory\npnpm clean\n```\n\nCI runs `pnpm install --frozen-lockfile --ignore-scripts`, `pnpm audit --audit-level=high`, `pnpm typecheck`, `pnpm build` and `pnpm test` on every push and pull request, and builds the Docker image and checks that it answers an MCP `initialize` over stdio.\n\n### Tests\n\n`pnpm test` builds the server, then runs 14 end-to-end tests with `node:test`. Each test spawns `build/index.js` as a real stdio child process, connects with the official MCP SDK client, and runs against a throwaway MongoDB from `mongodb-memory-server` (downloaded on first run). They cover the tool contract (no-argument calls, filters, pagination, context membership, delete cleanup, error results), the first search on a new database, clean exit on stdin close, and two clients sharing one database. Run against the v0.2.5 server, 7 of the 14 fail (6 assertion failures, 1 timeout waiting for the process to exit); all 14 pass on v0.3.0.\n\n### Releases\n\nPushing a `v*` tag runs [`.github/workflows/release.yml`](.github/workflows/release.yml): it checks that the tag, `package.json` and `server.json` versions match, runs the gates, publishes to npm with trusted publishing (OIDC, no token in secrets), and publishes `server.json` to the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.Sagargupta16/selfhub`. Re-running a tag skips the npm step when that version is already on npm.\n\nThe first release needs a one-time npm setup, because npm's [trusted publisher docs](https://docs.npmjs.com/trusted-publishers) only describe adding one from an existing package's settings page: publish `0.3.0` once from a local checkout with `npm publish --access public`, then add `Sagargupta16/SelfHub` and `release.yml` as the trusted publisher under the package's Settings on npmjs.com, and push the `v0.3.0` tag so the workflow publishes `server.json` to the MCP Registry. Later versions publish from the tag alone.\n\n### How It Works\n\n1. **MCP Server** (`src/index.ts`) - Implements the MCP protocol, defines 9 tools\n2. **Services Layer** - Business logic for memory and context operations\n3. **Storage Layer** - MongoDB persistent storage via Mongoose (set `MONGODB_URI` in `.env`)\n4. **Models** - TypeScript interfaces for type safety\n\n### Testing Locally\n\n```bash\n# Start the server\npnpm dev\n\n# You should see:\n# 🚀 SelfHub MCP Server running with MongoDB!\n# 💾 Database: Connected and ready\n# 🛠️  Available tools: 9 (store, retrieve, search, list, delete, contexts, stats)\n```\n\nThe server runs on **stdio** (standard input/output) and waits for MCP protocol messages. You cannot interact with it directly - it needs an MCP client like Claude Desktop or VS Code.\n\n## 🐛 Troubleshooting\n\n### Server Not Showing in Claude Desktop\n\n1. **Check the config path:**\n\n   - Make sure you're editing the correct config file\n   - Use absolute path, not relative\n\n2. **Verify build exists:**\n\n   ```bash\n   ls build/index.js\n   ```\n\n3. **Check for typos:**\n\n   - Windows paths need double backslashes: `C:\\\\path\\\\to\\\\`\n   - JSON syntax must be valid\n\n4. **Restart Claude completely:**\n\n   - Quit from system tray\n   - Wait a few seconds\n   - Start again\n\n5. **Check Claude logs:**\n   - Windows: `%APPDATA%\\Claude\\logs`\n   - macOS: `~/Library/Logs/Claude`\n\n### VS Code Not Showing Tools\n\n1. **Make sure GitHub Copilot is installed:**\n\n   - Press `Ctrl+Shift+X`\n   - Search \"GitHub Copilot\"\n   - Install both \"GitHub Copilot\" and \"GitHub Copilot Chat\"\n\n2. **Reload VS Code window:**\n\n   - `Ctrl+Shift+P` → \"Reload Window\"\n\n3. **Check the build:**\n   ```bash\n   pnpm build\n   ```\n\n### Build Errors\n\n```bash\n# Clean and rebuild\nrm -rf build node_modules\npnpm install\npnpm build\n```\n\n### Data Not Persisting\n\nSelfHub uses **MongoDB persistent storage** - your data survives server restarts. If data isn't persisting:\n\n1. **Check your `.env` file:**\n\n   - Make sure `MONGODB_URI` points to your MongoDB instance\n   - Copy from the template if missing: `cp .env.example .env`\n\n2. **Verify the connection:**\n\n   - The server logs `✅ Connected to MongoDB` on startup\n   - Without `MONGODB_URI`, it falls back to `mongodb://localhost:27017/selfhub`\n\n## 🔄 Dependency Updates\n\nThis project uses [Renovate](https://docs.renovatebot.com/) for automated dependency updates - see `renovate.json`.\n\n## 📖 Documentation\n\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Learn about MCP\n- [Claude Desktop](https://claude.ai/download) - Download Claude Desktop\n- [GitHub Copilot](https://github.com/features/copilot) - Learn about Copilot\n\n## 🗺️ Roadmap\n\n### Current Version (v0.3.0)\n\n- ✅ MongoDB persistent storage\n- ✅ 9 MCP tools\n- ✅ Memory categorization and tagging\n- ✅ Context management\n- ✅ Text-based search\n- ✅ Sample data seeder\n- End-to-end test suite in CI\n- Docker Compose setup\n- npm package and MCP Registry metadata, ready to publish from a tag\n\n### Future Enhancements\n\n- [ ] Vector embeddings for semantic search\n- [ ] File import/export (JSON, Markdown, CSV)\n- [ ] Data encryption for sensitive information\n- [ ] Web UI for management\n- [ ] Multi-user support\n- [ ] Cloud sync\n\n## 🤝 Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) and feel free to submit a Pull Request.\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## 💬 Support\n\nIf you have questions or run into issues:\n\n1. Check the [Troubleshooting](#-troubleshooting) section\n2. Review the documentation above\n3. Open an issue on GitHub\n\n## 🌟 Acknowledgments\n\nBuilt with:\n\n- [Model Context Protocol SDK](https://github.com/modelcontextprotocol/typescript-sdk) - MCP implementation\n- [TypeScript](https://www.typescriptlang.org/) - Type safety\n- [pnpm](https://pnpm.io/) - Fast package manager\n\n---\n\n**Made with ❤️ by [Sagargupta16](https://github.com/Sagargupta16)**\n\n_Your personal AI memory hub - remember everything, access anywhere!_\n"}