home / mcp / a-mem mcp server

A-MEM MCP Server

Provides an agentic memory graph for LLM agents with automatic note extraction, linking, and semantic retrieval via MCP protocol.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "tobs-code-a-mem-mcp-server": {
      "command": "python",
      "args": [
        "mcp_server.py"
      ],
      "env": {
        "LLM_PROVIDER": "ollama",
        "GRAPH_BACKEND": "networkx",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "RESEARCHER_ENABLED": "true",
        "RESEARCHER_CONFIDENCE_THRESHOLD": "0.5"
      }
    }
  }
}

You run an Agentic Memory MCP Server that stores, links, and evolves memories as you work with large language models. It builds a structured memory graph, enables fast semantic search, and automates maintenance to keep memories connected, relevant, and up to date. This server is designed to integrate with IDEs and developer workflows, so you can store notes, manage relations, and query memories directly from your development environment.

How to use

You access the MCP server through an editor or IDE by configuring an MCP client to start and manage the server process. The server exposes a set of memory operations you can invoke from natural language or code, including creating atomic notes, retrieving memories, listing notes, updating content, and managing graph relations. You can also run automated memory maintenance, trigger research workflows for low-confidence queries, and visualize the memory graph in a dashboard.

How to install

Prerequisites you need to prepare before starting the MCP server:

# 1) Install Python dependencies
pip install -r requirements.txt

# 2) Optional: configure environment for the graph backend (see environment examples below)
# 3) Start Ollama models if you choose the local Ollama provider (see below)

Configuration and startup

The server is designed to be flexible in how you connect to it. You can run the server directly from the command line or integrate it into your IDE workflow via MCP configurations. Basic startup runs the MCP server process, and advanced usage lets you customize environment variables per instance.

Examples and notes

- Start the MCP server from the command line: run the Python script responsible for serving MCP endpoints. - Use per-instance environment overrides in your MCP client configuration to tailor LLM providers, model names, and web research behavior for different projects. - You can enable a local or cloud-based language model provider and adjust embedding/LLM models as needed.

Troubleshooting and tips

If you encounter connectivity issues, verify that the MCP server process is running and that the client is configured to reach the correct command or URL. Check that environment variables are correctly set for the chosen provider and that the graph backend is available and properly initialized. Review event logs at data/events.jsonl for detailed operational insights.

Security and maintenance notes

Keep your environment secure by restricting access to your MCP endpoints and by using API keys or credentials for external web research services. Regularly review memory health scores and maintenance results to ensure the graph remains coherent and useful for research or development tasks.

MCP server configuration examples

Below are concrete configuration examples you can adapt for your IDEs and workflows. The first config starts the MCP server as a stdio process, and the second and third show how to embed per-instance environment overrides in Cursor and VSCode integrations.

MCP server config (stdio)

{
  "mcpServers": {
    "a_mem": {
      "command": "python",
      "args": ["mcp_server.py"]
    }
  }
}

Cursor IDE integration with per-instance overrides

{
  "mcpServers": {
    "a_mem_cursor": {
      "command": "python",
      "args": ["-m", "src.a_mem.main"],
      "cwd": "/path/to/a-mem-project",
      "env": {
        "LLM_PROVIDER": "ollama",
        "OLLAMA_LLM_MODEL": "qwen3:4b",
        "RESEARCHER_ENABLED": "true",
        "RESEARCHER_CONFIDENCE_THRESHOLD": "0.5"
      }
    }
  }
}

Visual Studio Code integration with per-instance overrides

{
  "mcp.servers": {
    "a_mem_cursor": {
      "command": "python",
      "args": ["-m", "src.a_mem.main"],
      "cwd": "/path/to/a-mem-mcp-server",
      "env": {
        "LLM_PROVIDER": "ollama",
        "OLLAMA_LLM_MODEL": "qwen3:4b",
        "RESEARCHER_ENABLED": "true"
      }
    }
  }
}

Inline usage notes for tools and features

You will find a range of tools that correspond to memory operations, including creating, retrieving, updating, and deleting notes; listing relations; graph visualization; and running memory enzymes. You can trigger a full memory maintenance cycle, perform deep web research for low-confidence results, and use the built-in reader and PDF extraction capabilities for content gathering.

Event logging and dashboards

All critical operations are logged in data/events.jsonl for audit and debugging. You can also start a memory graph dashboard to visualize nodes, edges, priorities, and relations, helping you understand how notes connect and what areas of knowledge are most active.

Notes on environment and providers

You can choose between local Ollama models or cloud-based OpenRouter for LLM providers. Each provider has its own configuration keys for models and embeddings. You can also enable optional components such as a local Jina Reader for content extraction and Unstructured for PDF extraction.

Available tools

create_atomic_note

Stores a new piece of information with automatic classification, metadata extraction, and background memory linking and evolution.

retrieve_memories

Searches memories with priority scoring and returns best matches sorted by relevance.

get_memory_stats

Returns statistics about the memory graph such as node and edge counts.

add_file

Stores file content as notes with automatic chunking for large files.

reset_memory

Resets the complete memory system (irreversible).