Enables multiple Claude Code sessions to share MCP daemons without SIGINT conflicts.
When running multiple Claude Code sessions simultaneously, each new session sends SIGINT to existing MCP processes, causing:
- Session disconnection: New session kills existing session's MCPs
- SQLite conflicts: Multiple processes accessing the same database
- State isolation: In-memory state (file watchers, indexes) not shared
- Resource contention: Process conflicts and crashes
This session manager introduces a 3-layer architecture:
Session A Session B
| |
v v
[Proxy A] -------- HTTP -------- [MCP Daemon]
(stdio) shared (HTTP/SSE)
| |
[Claude A] [Claude B]
- Singleton Daemons: Each MCP runs as a single daemon serving all sessions
- Stdio Proxies: Lightweight proxies bridge Claude's stdio to daemon HTTP
- SIGINT Protection: Proxies ignore signals, protecting the shared daemon
- Auto-start: Daemons start automatically on first request
npm install -g mcp-session-managergit clone https://github.com/daichi-kudo/mcp-session-manager.git
cd mcp-session-manager
npm install
npm run build# If installed globally
mcp-manager generate-config
# If installed from source
node dist/manager/index.js generate-configThis creates ~/.claude/mcp.json with proxy configurations.
Close and reopen Claude Code. The proxies will automatically start daemons as needed.
Open multiple Claude Code sessions - they should all work simultaneously without conflicts.
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["path/to/mcp-session-manager/dist/proxy/index.js", "--target", "memory"]
},
"code-index": {
"command": "node",
"args": ["path/to/mcp-session-manager/dist/proxy/index.js", "--target", "code-index"]
},
"ast-grep": {
"command": "node",
"args": ["path/to/mcp-session-manager/dist/proxy/index.js", "--target", "ast-grep"]
}
}
}Customize daemon configurations:
{
name: "memory",
command: "node",
args: ["path/to/memory-mcp-sqlite/dist/index.js", "--transport", "http", "--port", "3100"],
port: 3100,
transport: "streamable-http",
env: { MEMORY_DB_PATH: "..." }
}| Daemon | Default Port | Transport |
|---|---|---|
| memory | 3100 | streamable-http |
| code-index | 3101 | streamable-http (SSE response) |
| ast-grep | 3102 | sse |
| Manager API | 3199 | HTTP |
Start the manager for health monitoring and auto-restart:
# Start all daemons
mcp-manager --start-all
# Or from source
node dist/manager/index.js --start-all| Endpoint | Method | Description |
|---|---|---|
/ping |
GET | Health check |
/status |
GET | All daemon statuses |
/start |
POST | Start a daemon ({"name": "memory"}) |
/stop |
POST | Stop a daemon |
/ensure |
POST | Ensure daemon running (start if needed) |
/start-all |
POST | Start all daemons |
/stop-all |
POST | Stop all daemons |
curl http://localhost:3199/status# Windows
type %USERPROFILE%\.mcp-session-manager\memory.log
type %USERPROFILE%\.mcp-session-manager\code-index.log
# macOS/Linux
cat ~/.mcp-session-manager/memory.log
cat ~/.mcp-session-manager/code-index.log-
Check if port is already in use:
# Windows netstat -ano | findstr :3100 # macOS/Linux lsof -i :3100
-
Remove stale lock files:
# Windows del %USERPROFILE%\.mcp-session-manager\*.lock # macOS/Linux rm ~/.mcp-session-manager/*.lock
- Verify proxy is configured in
~/.claude/mcp.json - Check proxy logs in Claude Code's MCP output
- Ensure daemon is running:
curl http://localhost:3100/health
curl -X POST http://localhost:3199/stop -d '{"name":"memory"}'
curl -X POST http://localhost:3199/start -d '{"name":"memory"}'# Remove lock files
Remove-Item $env:USERPROFILE\.mcp-session-manager\*.lock
# Kill orphaned processes
Get-Process node | Where-Object {$_.CommandLine -like "*mcp*"} | Stop-Process -Force# Remove lock files
rm ~/.mcp-session-manager/*.lock
# Kill orphaned processes
pkill -f "mcp-session-manager"See ARCHITECTURE.md for detailed design documentation.
- Node.js 20+
- Windows, macOS, or Linux
- Existing MCP servers with HTTP/SSE transport support
| MCP | Transport | Notes |
|---|---|---|
| memory-mcp-sqlite | streamable-http | Requires --transport http flag |
| code-index-mcp | streamable-http | SSE response, requires FastMCP |
| ast-grep-mcp | sse | Deprecated MCP 2024-11-05 format |
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE for details.
Daichi Kudo
- Cognisant LLC - CEO
- M16 LLC - CTO