Skip to main content

mcp-session-registry

CI Python 3.11+ License: Apache-2.0

Lightweight MCP server for multi-session awareness — lets AI agents know who else is active on the same machine.

Why

When you run multiple AI CLI sessions (Kiro, Claude Code, Gemini CLI) on the same machine, they are blind to each other. This causes:

  • File conflicts — two sessions editing the same file
  • Duplicated work — agents picking up the same task
  • Wasted context — no way to know what another session is doing

mcp-session-registry solves this with a shared presence layer:

  • Sessions register on spawn, declare a theme, and heartbeat every 2-3 minutes
  • Sessions claim files/resources — other sessions see the claim before touching them
  • Stale sessions (no heartbeat >5min) are automatically reaped
  • Everything persists in SQLite — survives individual session crashes

Quick Start

# Run directly
uvx mcp-session-registry

# Or install
pip install mcp-session-registry

# Configure port (default: 8000)
MSR_PORT=3203 mcp-session-registry

MCP Tools

Tool Description
session_register Register a new session. Returns session_id for subsequent calls.
session_list List all active sessions on this machine.
session_heartbeat Send heartbeat to keep session alive (call every 2-3 min).
session_end Gracefully end a session and release all its claims.
session_claim Claim a resource (file, branch, work item). Advisory lock.
session_release Release a previously claimed resource.
session_conflicts Check if resources are claimed by another active session.

How It Works

Session A registers → gets session_id
Session A claims "src/main.py"
Session B calls session_conflicts(["src/main.py"])
  → returns: claimed by Session A (pid 1234, theme "refactor auth")
Session B picks a different file

Sessions that stop sending heartbeats are reaped after 5 minutes — their claims are released automatically.

Configuration

Environment Variable Default Description
MSR_PORT 8000 HTTP port for StreamableHTTP transport
MSR_DB_PATH ~/.local/share/session-registry/sessions.db SQLite database path

Integration with Kiro CLI

Add to your ~/.kiro/settings/mcp.json:

{
  "mcpServers": {
    "session-registry": {
      "url": "http://localhost:3203/mcp",
      "autoApprove": ["session_register", "session_list", "session_heartbeat", "session_end", "session_claim", "session_release", "session_conflicts"]
    }
  }
}

Run as a systemd user service:

# ~/.config/systemd/user/session-registry.service
[Unit]
Description=MCP Session Registry

[Service]
ExecStart=%h/.local/bin/mcp-session-registry
Environment=MSR_PORT=3203
Restart=on-failure

[Install]
WantedBy=default.target

Health Check

curl http://localhost:3203/health
# {"status": "healthy", "version": "0.2.0", "uptime_seconds": 3600}

Development

git clone https://github.com/filhocf/mcp-session-registry
cd mcp-session-registry
uv sync
uv run pytest tests/ -v
uv tool run ruff check src/ tests/

License

Apache-2.0

Metadata

Release files for mcp-session-registry 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-session-registry 0.2.0
File Size Uploaded
mcp_session_registry-0.2.0.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-session-registry 0.2.0
File Interpreter ABI Platform
mcp_session_registry-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / mcp_session_registry-0.2.0.tar.gz

Download URL mcp_session_registry-0.2.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0b4476fb490dffdc497ce9a86cceb8eae8923284a6adffe369eb87296f600882
BLAKE2b-256 checksum
How to use checksums
c19a6e37be836bdeb6e97f565d8af0e5d209d4d2b3d15d4aec21d2c3f88ce5d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mcp_session_registry-0.2.0-py3-none-any.whl

Download URL mcp_session_registry-0.2.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
334217eeab277247be321ae2f51042a5a97ede0b9a76cd05ec12df2d039d752a
BLAKE2b-256 checksum
How to use checksums
e9083514fa8fc1acf9c8e6b2c228f7c003eb798c59a64ed7d792967ffe3df8ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page