MCP Server
KAPEX exposes a Model Context Protocol (MCP) server that lets any MCP-compatible client use KAPEX memory tools directly. This is the fastest way to add persistent memory to Claude Desktop, Claude Code, or any MCP host.
Available Tools
KAPEX exposes five MCP tools:
| Tool | Description |
|---|---|
kapex_ingest |
Store a memory in the user's graph. Equivalent to POST /v1/memory/ingest. |
kapex_context |
Retrieve pre-formatted memory context for LLM injection. Equivalent to GET /v1/memory/context/{user_id}. |
kapex_query |
Search the memory graph by semantic similarity or keyword. Equivalent to POST /v1/memory/query. |
kapex_entities |
List all entities with live salience scores. Equivalent to GET /v1/memory/entities/{user_id}. |
kapex_delete |
Delete all data for a user (GDPR). Equivalent to DELETE /v1/memory/user/{user_id}. |
Transport Options
KAPEX supports three MCP transports:
| Transport | Best For | Connection |
|---|---|---|
| stdio | Local development, Claude Desktop, Claude Code | Subprocess — no network required |
| SSE | Web clients, browser-based MCP hosts | https://api.getkapex.ai/mcp/sse |
| HTTP | Server-to-server integrations | https://api.getkapex.ai/mcp/http |
Setup with Claude Desktop
Add KAPEX to your Claude Desktop configuration:
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"kapex": {
"command": "npx",
"args": ["-y", "@kapex/mcp-server"],
"env": {
"KAPEX_API_KEY": "ek_your_api_key_here",
"KAPEX_USER_ID": "user_001"
}
}
}
}
Windows
Edit %APPDATA%\Claude\claude_desktop_config.json with the same configuration.
After saving, restart Claude Desktop. You should see the KAPEX tools listed in the MCP tools panel.
Setup with Claude Code
Add KAPEX as an MCP server in your project's .claude/settings.json:
{
"mcpServers": {
"kapex": {
"command": "npx",
"args": ["-y", "@kapex/mcp-server"],
"env": {
"KAPEX_API_KEY": "ek_your_api_key_here",
"KAPEX_USER_ID": "user_001"
}
}
}
}
SSE Transport
For web-based MCP hosts, connect to the SSE endpoint:
https://api.getkapex.ai/mcp/sse
Include your API key in the connection headers:
const eventSource = new EventSource(
"https://api.getkapex.ai/mcp/sse",
{
headers: {
"X-API-Key": "ek_your_api_key_here"
}
}
);
HTTP Transport
For server-to-server integrations, send MCP JSON-RPC requests to:
POST https://api.getkapex.ai/mcp/http
X-API-Key: ek_your_api_key_here
Content-Type: application/json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "kapex_context",
"arguments": {
"user_id": "user_001"
}
},
"id": 1
}
Environment Variables
| Variable | Required | Description |
|---|---|---|
KAPEX_API_KEY |
Yes | Your KAPEX API key |
KAPEX_USER_ID |
No | Default user ID (can be overridden per tool call) |
KAPEX_BASE_URL |
No | API base URL (default: https://api.getkapex.ai/api/v1) |
Tool Schemas
kapex_ingest
{
"name": "kapex_ingest",
"description": "Store a memory in the user's KAPEX graph",
"inputSchema": {
"type": "object",
"properties": {
"user_id": { "type": "string", "description": "User identifier" },
"message": { "type": "string", "description": "Message content to store" }
},
"required": ["user_id", "message"]
}
}
kapex_context
{
"name": "kapex_context",
"description": "Retrieve pre-formatted memory context for LLM injection",
"inputSchema": {
"type": "object",
"properties": {
"user_id": { "type": "string", "description": "User identifier" },
"budget": { "type": "integer", "description": "Max token budget (default 6000)" },
"threshold": { "type": "number", "description": "Min salience threshold (default 0.15)" }
},
"required": ["user_id"]
}
}
kapex_query
{
"name": "kapex_query",
"description": "Search the memory graph by semantic similarity or keyword",
"inputSchema": {
"type": "object",
"properties": {
"user_id": { "type": "string", "description": "User identifier" },
"query": { "type": "string", "description": "Search query" },
"mode": { "type": "string", "enum": ["semantic", "keyword"], "description": "Search mode (default semantic)" },
"top_k": { "type": "integer", "description": "Max results (default 5, max 50)" }
},
"required": ["user_id", "query"]
}
}
Next Steps
- API Reference -- full REST endpoint documentation
- Config Presets -- tune memory behavior for your use case
- How Memory Works -- understand salience scoring and decay