actuallyrizzn/sanctum-letta-mcp
If you are the rightful owner of sanctum-letta-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Sanctum Letta MCP (SSE Edition) is a robust orchestration server designed to manage command-line tools and automation scripts securely within internal infrastructures, fully compliant with the Model Context Protocol (MCP).
Sanctum Letta MCP (SSE Edition)
Version: 2.2.0
A powerful, modular orchestration server designed to securely expose and manage command-line tools and automation scripts within your internal infrastructure. Built for the Letta Agentic AI framework, MCP operates as a Server-Sent Events (SSE) server using aiohttp for real-time communication and is now fully compliant with the Model Context Protocol (MCP).
π Letta/MCP Compliance
- MCP-Compliant SSE/JSON-RPC: Implements the Model Context Protocol event and message contract for seamless Letta integration.
- Dynamic Plugin Discovery: Auto-discovers all plugins in
mcp/plugins/
at startup. No static registrationβjust drop in a new plugin with acli.py
and it will be available after a server restart. - Immediate Tools Manifest: On SSE connect, emits a JSON-RPC 2.0 tools manifest event as required by Letta and MCP.
- JSON-RPC 2.0 Everywhere: All requests and responses (including errors) use the JSON-RPC 2.0 format.
- Production-Ready Testing: Comprehensive test suite with unit, integration, and end-to-end tests.
β¨ Key Features
- SSE Server: Real-time communication via Server-Sent Events over HTTP using aiohttp
- Dynamic Plugin Architecture: Plugins are auto-discovered at startup; no code changes needed to add new tools
- Comprehensive Testing: Full test suite with coverage reporting and timeout protection
- Single Worker Thread: Serializes all plugin execution for safety
- Comprehensive Audit Logging: All requests and results are logged (no sensitive data)
- Docker-Ready: Designed for container deployment with Letta
- Sanctum Stack Compatible: Uses aiohttp, pydantic, and other Sanctum-standard libraries
π§ͺ Testing
The project includes a comprehensive testing infrastructure:
# Run all tests
python run_tests.py --type all
# Run specific test types
python run_tests.py --type unit # Unit tests
python run_tests.py --type integration # Integration tests
python run_tests.py --type e2e # End-to-end tests
# Run with coverage
python run_tests.py --type all --coverage
# Run individual test files
python -m pytest tests/unit/
python -m pytest tests/integration/
python -m pytest tests/e2e/
Test Coverage:
- Unit Tests: Plugin discovery, tool manifest building, execution logic
- Integration Tests: HTTP endpoints, SSE connections, JSON-RPC handling
- E2E Tests: Complete workflows with multiple plugins and concurrent operations
π Quick Start
-
Clone the repository and install dependencies:
git clone https://github.com/actuallyrizzn/sanctum-letta-mcp.git cd sanctum-letta-mcp python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Run the MCP SSE server:
python -m mcp.mcp_server
or (if running as a service):
python mcp/mcp_server.py
-
Run tests to verify everything works:
python run_tests.py --type all
π‘ Example SSE Communication
HTTP Request:
POST /message HTTP/1.1
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": "req-1",
"method": "tools/call",
"params": {
"name": "botfather.click-button",
"arguments": {"button-text": "Payments", "msg-id": 12345678}
}
}
SSE Response Stream (on connect):
data: {"jsonrpc":"2.0","method":"notifications/tools/list","params":{"tools":[...]}}
Tool Call Response:
{
"jsonrpc": "2.0",
"id": "req-1",
"result": {
"content": [
{"type": "text", "text": "Clicked button Payments on message 12345678"}
]
}
}
π API Endpoints
GET /sse
- SSE connection for real-time events (emits tools manifest on connect)POST /message
- Tool invocation endpoint (JSON-RPC 2.0)GET /health
- Health check with plugin and session counts
π Documentation
- - Installation and basic usage (SSE)
- - SSE message protocol
- - Guide for creating plugins
- - Comprehensive testing documentation
- - Security best practices
- - Logging and observability
ποΈ Project Structure
letta-internal-mcp/
βββ mcp/ # Main package
β βββ mcp_server.py # aiohttp SSE server entrypoint
β βββ plugins/ # Plugin implementations (auto-discovered)
β β βββ botfather/ # BotFather automation plugin
β β βββ devops/ # DevOps automation plugin
β βββ __init__.py # Package metadata
βββ tests/ # Comprehensive test suite
β βββ unit/ # Unit tests for core functions
β βββ integration/ # HTTP/SSE integration tests
β βββ e2e/ # End-to-end workflow tests
β βββ conftest.py # Test fixtures and configuration
βββ docs/ # Documentation
βββ run_tests.py # Test runner with coverage
βββ requirements.txt # Dependencies
βββ pytest.ini # Pytest configuration
π§ Configuration
Environment Variables:
MCP_PORT
- Server port (default: 8000)MCP_HOST
- Server host (default: 0.0.0.0)MCP_PLUGINS_DIR
- Custom plugins directory (default: mcp/plugins/)
π¦ Dependencies
Core:
aiohttp==3.9.1
- Async HTTP serveraiohttp-cors==0.7.0
- CORS supportpydantic==2.6.1
- Data validation
Testing:
pytest==7.4.3
- Testing frameworkpytest-asyncio==0.21.1
- Async test supportpytest-cov==4.1.0
- Coverage reportingpytest-mock==3.12.0
- Mocking utilitiespytest-timeout==2.1.0
- Test timeout protection
π License
This project is licensed under the Creative Commons Attribution-ShareAlike (CC BY-SA) license. See LICENSE for details.
Note:
- The legacy STDIO protocol and references have been archived. This implementation is HTTP/SSE-only and fully MCP/Letta compatible.
- Version 2.2.0 includes comprehensive testing infrastructure and improved plugin discovery.
- For advanced plugin schema extraction or hot-reload, see future roadmap.