Connecting Agents
Agent Brain supports MCP clients and REST clients. MCP is the easiest path for coding agents that support tool servers. REST is useful for scripts, custom agents, and integrations.
MCP endpoint
http://localhost:3100/mcp
REST endpoint
http://localhost:9090/api/v1
Store a memory:
curl -X POST http://localhost:9090/api/v1/remember \
-H 'Content-Type: application/json' \
-d '{
"content": "Auth uses JWT with 24h expiry. Refresh tokens are stored in Redis.",
"type": "decision",
"importance": 0.8,
"tags": ["auth", "jwt", "redis"]
}'
Recall context:
curl -X POST http://localhost:9090/api/v1/recall \
-H 'Content-Type: application/json' \
-d '{"query": "how does authentication work?"}'
Agent-specific MCP configuration
Claude Code
Add to claude_desktop_config.json, or to the mcpServers block in your project CLAUDE.md:
{
"mcpServers": {
"agent-brain": {
"type": "http",
"url": "http://localhost:3100/mcp"
}
}
}
Cursor
Create or edit .cursor/mcp.json in your project root:
{
"mcpServers": {
"agent-brain": {
"type": "http",
"url": "http://localhost:3100/mcp"
}
}
}
Codex
Add to your project AGENTS.md:
# MCP Servers
agent-brain: http://localhost:3100/mcp
Gemini CLI
Add to your Gemini CLI config:
{
"mcpServers": {
"agent-brain": {
"serverUrl": "http://localhost:3100/mcp"
}
}
}
REST client examples
Python (requests)
import requests
BASE = "http://localhost:9090/api/v1"
def remember(content, type, importance=0.7, tags=None, project=None):
return requests.post(f"{BASE}/remember", json={
"content": content,
"type": type,
"importance": importance,
"tags": tags or [],
"project": project,
}).json()
def recall(query, limit=5, project=None):
payload = {"query": query, "limit": limit}
if project:
payload["filter"] = {"project_id": project}
return requests.post(f"{BASE}/recall", json=payload).json()
Node.js (fetch)
const BASE = "http://localhost:9090/api/v1";
async function remember(content, type, opts = {}) {
const res = await fetch(`${BASE}/remember`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content, type, ...opts }),
});
return res.json();
}
async function recall(query, limit = 5) {
const res = await fetch(`${BASE}/recall`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query, limit }),
});
return res.json();
}
Verification
Check that the stack is healthy:
curl http://localhost:9090/health
curl -X POST http://localhost:9090/api/v1/status
Then ask a connected agent:
Use the `brain` MCP tool with command `status` to check if Agent Brain is healthy.
A healthy response confirms the MCP connection is working end-to-end. Store a small test memory and verify it appears in the desktop Knowledge Explorer to confirm write access.