MCP Integration Guide

Anura Memory exposes a Model Context Protocol (MCP) endpoint that AI agents can connect to for persistent memory.

The MCP server provides 12 tools across two products:

  • GraphRag (7 tools) — Knowledge graph with triple extraction and hybrid retrieval
  • FilesRag (5 tools) — Markdown file storage with semantic search

Prerequisites

  1. An Anura Memory account at anuramemory.com
  2. An API key — create one in the dashboard at Settings > API Keys

Setup

Claude Desktop

Edit your Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "anura-memory": {
      "url": "https://anuramemory.com/api/mcp",
      "headers": {
        "X-API-KEY": "gm_your_key_here"
      }
    }
  }
}

Restart Claude Desktop after saving. You should see "anura-memory" appear in the tools list.

Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "anura-memory": {
      "type": "url",
      "url": "https://anuramemory.com/api/mcp",
      "headers": {
        "X-API-KEY": "gm_your_key_here"
      }
    }
  }
}

Cursor

Open Settings > MCP Servers and add:

{
  "mcpServers": {
    "anura-memory": {
      "url": "https://anuramemory.com/api/mcp",
      "headers": {
        "X-API-KEY": "gm_your_key_here"
      }
    }
  }
}

Windsurf

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "anura-memory": {
      "serverUrl": "https://anuramemory.com/api/mcp",
      "headers": {
        "X-API-KEY": "gm_your_key_here"
      }
    }
  }
}

Any MCP Client (programmatic)

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const client = new Client({ name: "my-agent", version: "1.0" });

await client.connect(
  new StreamableHTTPClientTransport(
    new URL("https://anuramemory.com/api/mcp"),
    { requestInit: { headers: { "X-API-KEY": "gm_your_key_here" } } }
  )
);

// Call any tool
const result = await client.callTool({
  name: "remember",
  arguments: { text: "Alice works at Acme Corp" }
});

GraphRag Tools

remember

Extract and store knowledge triples from text into the knowledge graph.

ParameterTypeRequiredDescription
textstringYesText to extract knowledge from
requireApprovalbooleanNoIf true, route facts to the pending queue for human review (default: false)

The text is analyzed by an LLM to identify factual relationships (Subject-Predicate-Object triples), which are deduplicated and merged into the knowledge graph with provenance tracking. The LLM also automatically classifies each entity with a type (person, organization, place, concept, event, technology, product, or other). Types are first-write-wins -- existing entity types are never overwritten.

Contradiction detection: If a new triple conflicts with an existing one on a single-valued predicate (e.g., LIVES_IN, WORKS_AT), the old value is automatically replaced and the resolution is returned in the conflicts field.

search

Search for an entity and its direct connections.

ParameterTypeRequiredDescription
entitystringYesEntity name (case-insensitive)

Returns all incoming and outgoing relationships for the entity. The entity object in the response includes a type field (person, organization, place, concept, event, technology, product, other, or null if unclassified).

get_context

Retrieve context from the knowledge graph for a natural language query.

ParameterTypeRequiredDescription
querystringYesNatural language query
formatstringNo"json", "markdown", or "text" (default: "markdown")

Uses hybrid search (graph traversal + vector similarity + community summaries) when available, falling back to 2-hop graph traversal. Returns a traceId for debugging.

ingest_tool_output

Passively ingest output from another tool for background knowledge extraction.

ParameterTypeRequiredDescription
tool_namestringYesSource tool name (e.g., "web_search", "code_interpreter")
outputstringYesTool output text (max 10,000 chars)

Returns immediately — extraction happens asynchronously in the background. Extracted facts go to the pending queue for human review. Each fact is tagged with provenance (source tool name) for auditability.

sever_edge

Delete a specific relationship from the knowledge graph.

ParameterTypeRequiredDescription
subjectstringYesSource entity name
predicatestringYesRelationship type
objectstringYesTarget entity name
blacklistbooleanNoAlso blacklist to prevent re-creation (default: false)

strengthen_edge

Increase the weight of a relationship to prioritize it as ground truth.

ParameterTypeRequiredDescription
subjectstringYesSource entity name
predicatestringYesRelationship type
objectstringYesTarget entity name
weightnumberNoAmount to increase by (default: 1)

detect_communities

Run community detection (Louvain algorithm) on the knowledge graph to identify topical clusters, then generate LLM summaries for each community. No parameters.

FilesRag Tools

write_file

Create or update a markdown memory file. If a file already exists at the given path, its content is replaced. Automatically chunked by ## headings and indexed for semantic search.

ParameterTypeRequiredDescription
pathstringYesVirtual file path (e.g., "/notes/architecture.md")
contentstringYesMarkdown content

Example:

{
  "path": "/docs/preferences.md",
  "content": "# Preferences\n\n## Code Style\nPrefers functional programming...\n\n## Tools\nUses VSCode with vim bindings..."
}

read_file

Read the content of a memory file by its path or ID.

ParameterTypeRequiredDescription
pathstringYesFile path (e.g., "/notes/architecture.md") or file ID

search_files

Semantic search across memory files. Returns the most relevant chunks ranked by similarity. Optionally scope to a single file.

ParameterTypeRequiredDescription
querystringYesNatural language search query
limitnumberNoMax results to return (default: 10)
fileIdstringNoFile ID to search within a single file

Examples:

{ "query": "what are the user's code style preferences?", "limit": 5 }
{ "query": "auth flow", "fileId": "clx_abc123" }

list_files

List all memory files in the current project with metadata. No parameters.

delete_file

Delete a memory file and all its indexed chunks.

ParameterTypeRequiredDescription
pathstringYesFile path or file ID

How It Works

GraphRag

  1. Remember: Text is sent to an LLM that extracts Subject-Predicate-Object triples
  2. Deduplicate: Triples are fuzzy-matched against existing graph data to prevent duplicates
  3. Store: New triples are merged into a per-project knowledge graph
  4. Retrieve: Queries use 2-hop graph traversal + vector similarity + community summaries to find relevant context

FilesRag

  1. Write: Markdown content is stored in S3 and chunked by ## headings
  2. Embed: Each chunk is embedded using OpenAI text-embedding-3-small (1536-dim)
  3. Search: Queries are embedded and compared against chunk embeddings via cosine similarity
  4. Retrieve: Top-matching chunks are returned with file context and similarity scores

When to Use Which

Use CaseProduct
Structured facts ("Alice works at Acme")GraphRag
Preferences, workflows, proceduresFilesRag
Quick factual lookupsGraphRag
Long-form notes, documentationFilesRag
Relationship discovery (who knows who)GraphRag
Searchable memory across topicsFilesRag

Both products share the same API key, project scope, and billing. You can use them together.

Authentication

The MCP endpoint requires an API key via the X-API-KEY header. Each key is scoped to a specific project — all operations through that key operate on that project's data.

Create API keys in the dashboard at Settings > API Keys.

Rate Limits

ToolFREEPROMAX
remember5/min30/min100/min
get_context / search20/min120/min400/min
write_file10/min60/min200/min
read_file / list_files30/min200/min600/min
search_files20/min120/min400/min

Tier Limits

ResourceFREEPROMAX
Graph facts1005,000100,000
File storage50 MB1 GB50 GB
File count20UnlimitedUnlimited

Notes

  • The MCP server is stateless (HTTP transport). Each request is independent — no session management or SSE.
  • The ingest_tool_output tool is designed for the "Sniffer" pattern: intercept tool outputs from other MCP tools and feed them to Anura Memory for passive learning.
  • Use sever_edge with blacklist: true when the agent has learned something incorrect — this prevents the LLM from re-extracting the same bad fact.
  • After making graph changes, you can view the results in the Brain visualization at /brain.