Skip to main content

MCP Server for Mem-Brain API - Exposes memory operations as MCP tools

Project description

Mem-Brain MCP Server

MCP (Model Context Protocol) server that exposes Mem-Brain API functionality as standardized tools for AI agents. Built with FastMCP for production-ready HTTP/SSE transport.

Features

  • Memory Management: Create, read, update, and delete memories
  • Semantic Search: Search memories using vector similarity
  • Graph Operations: Find paths and neighborhoods in the memory graph
  • Statistics: Get insights about your memory system
  • Link Management: Link and unlink memories
  • HTTP/SSE Transport: Run independently, accessible remotely
  • CLI Interface: Packaged for easy global execution

Instant Execution (Recommended)

You can run the MCP server instantly without manual installation using uv:

# Run using uvx (loads environment from .env or shell)
uvx mem-brain-mcp

# Run with custom API URL
export API_BASE_URL=http://your-api-alb-url.com
uvx mem-brain-mcp

Installation

From Source

  1. Install using uv (recommended) or pip:
cd mem-brain-mcp
uv pip install .
  1. Run globally:
mem-brain-mcp

Configuration

The server reads configuration from environment variables or a .env file in the current working directory:

# API Configuration
API_BASE_URL=http://localhost:8000
# NOTE: API_KEY is optional here - per-user API keys are configured in MCP clients
API_KEY=your_api_key_here  # Optional: fallback for single-user scenarios

# MCP Server Configuration
MCP_SERVER_HOST=0.0.0.0
MCP_SERVER_PORT=8100

# Logging
LOG_LEVEL=INFO

Per-User API Key Configuration

Each user must configure their own API key in their MCP client for proper user isolation. The server extracts tokens from request headers.

Cursor IDE (~/.cursor/mcp.json)

{
  "mcpServers": {
    "mem-brain": {
      "url": "http://localhost:8100/mcp",
      "headers": {
        "Authorization": "Bearer your-jwt-token"
      }
    }
  }
}

Claude Desktop

Option 1: Native Remote (Pro/Team plans)

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mem-brain": {
      "url": "http://your-deployed-url/mcp",
      "headers": {
        "Authorization": "Bearer your-jwt-token"
      }
    }
  }
}

Option 2: via CLI (Any plan)

{
  "mcpServers": {
    "mem-brain": {
      "command": "uvx",
      "args": ["mem-brain-mcp"],
      "env": {
        "API_BASE_URL": "http://your-deployed-url",
        "JWT_SECRET_KEY": "your-secret"
      }
    }
  }
}

AWS ECS Deployment

The MCP server can be deployed to AWS ECS (Fargate) with an Application Load Balancer.

Quick Start

  1. Set up security groups (see aws/security-groups.md)
  2. Deploy using the script:
cd mem-brain-mcp/aws
./deploy.sh ap-south-1 membrain-mcp membrain-cluster membrain-mcp

For detailed instructions, see aws/DEPLOYMENT.md.

Development

Running Tests

pytest

Build and Publish

# Build the wheel
python3 -m build

# Upload to PyPI
twine upload dist/*

License

Same as Mem-Brain API project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mem_brain_mcp-1.0.0.tar.gz (118.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mem_brain_mcp-1.0.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file mem_brain_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: mem_brain_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 118.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for mem_brain_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2a0a49f248d3ce6af0d72e8ef14d4c44b63abc8a633bbde847c7a424a87b50c5
MD5 a7cd9e819b924fa97746433932deac1f
BLAKE2b-256 b69446e9850a2ccbb68b374330e4de971aac487af9a32268ddc0c66b73ec3a18

See more details on using hashes here.

File details

Details for the file mem_brain_mcp-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mem_brain_mcp-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for mem_brain_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d456465206029cd273e66ea6ec61c5a61f9d6abdce01d8177e2819541187ffc
MD5 321ec0687dd75bfb8b4c2c648b2dc4a4
BLAKE2b-256 b46393a3cad241bab9de06f67b39b08c5ad5a9036d64b07162d737ebff53f61c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page