IMS MCP Server
MCP server that exposes the Integrated Memory System (IMS) as tools via the Model Context Protocol Python SDK.
It wraps the existing IMS HTTP backend (session-memory, memory-core, context-rag) and makes those capabilities available to MCP-aware clients (e.g. mcphub, Warp, VS Code, LibreChat).
Prerequisites
- Python 3.10+
- An IMS backend running somewhere reachable (FastAPI/Uvicorn service), e.g.:
http://localhost:8000, orhttp://ims.delongpa.com
That's it! The MCP server includes all necessary client code to communicate with the IMS backend.
Installation (venv + pip)
From the ims-mcp directory:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
This installs the MCP Python SDK and required dependencies (httpx).
Configuration
The MCP server talks to IMS via environment variables. These can be provided in three ways (in order of increasing precedence):
- A local
.envfile in the project root (or a path specified byIMS_ENV_FILE) - The process environment (e.g. exported variables in your shell)
- Environment variables set by the MCP host (e.g. mcphub
envblock)
Supported variables:
IMS_BASE_URL(optional, defaulthttps://ims.delongpa.com)- Base URL of the IMS HTTP service (override for local dev, e.g.
http://localhost:8000).
- Base URL of the IMS HTTP service (override for local dev, e.g.
IMS_HTTP_TIMEOUT(optional, default5.0seconds)IMS_CLIENT_NAME(optional, default"ims-mcp")IMS_VERIFY_SSL(optional, defaulttrue)- Set to
falseonly for local/dev environments with self-signed certs.
- Set to
IMS_ENV_FILE(optional, default.env)- If set, points to a
.env-style file to load before reading other vars.
- If set, points to a
IMS_HEALTH_PROJECT_ID(optional, defaultims-mcp)- Project id used by the
ims://healthresource when probing read endpoints.
- Project id used by the
Using a .env file (local development)
Create a file named .env next to server.py (only needed if you want to override defaults, e.g. local dev):
IMS_BASE_URL=http://localhost:8000
IMS_HTTP_TIMEOUT=5.0
IMS_CLIENT_NAME=ims-mcp
You can override the file name/path with IMS_ENV_FILE if needed.
Setting variables directly
Example using exported variables:
export IMS_BASE_URL="http://ims.delongpa.com"
export IMS_HTTP_TIMEOUT="5.0"
export IMS_CLIENT_NAME="ims-mcp"
export IMS_VERIFY_SSL="true"
Running the MCP server locally
With the venv activated (and optionally IMS_BASE_URL set):
source .venv/bin/activate
# Optional override for local dev:
# export IMS_BASE_URL="http://localhost:8000"
python server.py
The server runs over stdio, which is what MCP clients expect when they spawn it as a subprocess.
mcphub configuration example
To use this server from mcphub on a host where you cloned this repo to
/opt/mcps/ims-mcp and created the venv as above, add an entry like:
"IMS-MCP": {
"type": "stdio",
"command": "/opt/mcps/ims-mcp/.venv/bin/python",
"args": [
"/opt/mcps/ims-mcp/server.py"
],
"env": {
"IMS_BASE_URL": "http://ims.delongpa.com"
}
}
Adjust paths and IMS_BASE_URL to match your environment.
Exposed tools
The MCP server exposes the following tools for interacting with IMS capabilities:
Context Retrieval
ims.context-rag.context_search- Unified search across code, docs, and memories
Docs Indexing (Meilisearch)
docs_index_directory- Index a directory of text files (docs + code + config) into Meilisearch
project_docs(chunked by default) - Uses
IMS_MEILI_URL/IMS_MEILI_API_KEYand storesuser_id(fromIMS_USER_IDor OS username) - Supports optional path-based filtering:
include_globs: only include files matching at least one glob (e.g.**/*-meta.xmlfor Salesforce metadata)exclude_globs: exclude files matching any globno_default_excludes: disable built-in excludes (e.g..env*, lockfiles,*.min.js)
- Index a directory of text files (docs + code + config) into Meilisearch
Long-Term Memory
ims.memory-core.store_memory- Store decisions, issues, and facts
ims.memory-core.find_memories- Search stored memories
Session State
ims.session-memory.auto_session- Smart helper to resume or create sessions
ims.session-memory.resolve_session- Hook-aware resolver that resumes/creates a session and binds
hook_session_idinto session metadata for strict session gating
- Hook-aware resolver that resumes/creates a session and binds
ims.session-memory.get_bound_session- Lookup helper to verify whether a
hook_session_idis already bound to an open IMS session for a project
- Lookup helper to verify whether a
ims.session-memory.continue_session- Resolve or create session by (project, user, agent, task) tuple
ims.session-memory.checkpoint_session- Persist session state mid-burst (save progress without implying pause/hand-off)
ims.session-memory.wrap_session- Persist updated session state at true boundaries (pause/hand-off/finish)
ims.session-memory.list_open_sessions- List available session
Tools 11
ims.context-rag.context_searchUnified search across code, docs, and memoriesdocs_index_directoryIndex a directory of text files into Meilisearchims.memory-core.store_memoryStore decisions, issues, and factsims.memory-core.find_memoriesSearch stored memoriesims.session-memory.auto_sessionSmart helper to resume or create sessionsims.session-memory.resolve_sessionResumes or creates a session and binds hook_session_idims.session-memory.get_bound_sessionLookup helper to verify if a hook_session_id is bound to an open sessionims.session-memory.continue_sessionResolve or create session by project, user, agent, and taskims.session-memory.checkpoint_sessionPersist session state mid-burstims.session-memory.wrap_sessionPersist updated session state at true boundariesims.session-memory.list_open_sessionsList available sessionsEnvironment Variables
IMS_BASE_URLBase URL of the IMS HTTP serviceIMS_HTTP_TIMEOUTTimeout in seconds for HTTP requestsIMS_CLIENT_NAMEName of the MCP clientIMS_VERIFY_SSLWhether to verify SSL certificatesIMS_ENV_FILEPath to a .env file to loadIMS_HEALTH_PROJECT_IDProject ID for health probing