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

Installation

From PyPI (Recommended)

Install from PyPI using pip or uv:

# Using pip
pip install mem-brain-mcp

# Using uv
uv pip install mem-brain-mcp

Then run globally:

mem-brain-mcp

Instant Execution with uvx

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

# Run using uvx (uses default API URL)
uvx mem-brain-mcp

# Override API URL or set JWT token if needed
export API_BASE_URL=http://your-custom-api-url.com
export MEMBRAIN_API_KEY=your-jwt-token-here
uvx mem-brain-mcp

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. Most settings have sensible defaults:

# API Configuration (optional - defaults to production API)
API_BASE_URL=http://membrain-api-alb-1094729422.ap-south-1.elb.amazonaws.com
# NOTE: MEMBRAIN_API_KEY is actually a JWT access token (from login/signup)
# Per-user JWT tokens are typically configured in MCP clients via headers
MEMBRAIN_API_KEY=your_jwt_token_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

Note: The API_BASE_URL defaults to the production Mem-Brain API endpoint, so you typically don't need to set it unless you're using a custom API instance.

Per-User JWT Token Configuration

Each user must configure their own JWT access token in their MCP client for proper user isolation. The server extracts tokens from request headers. Get your JWT token by logging in or signing up to the Mem-Brain API.

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"]
    }
  }
}

Note: After installing from PyPI, you can also use mem-brain-mcp directly. The API URL is set by default, but you can override it if needed:

{
  "mcpServers": {
    "mem-brain": {
      "command": "mem-brain-mcp",
      "env": {
        "API_BASE_URL": "http://your-custom-api-url"
      }
    }
  }
}

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.1.tar.gz (118.7 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.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mem_brain_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 118.7 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.1.tar.gz
Algorithm Hash digest
SHA256 432080b0b9a27068398129fb0f76049fd0a7dcea4e84c9efaa6bb0d16e7180e9
MD5 6e8d74eb8737a964350b80a591b78a52
BLAKE2b-256 1a1a6a2c7604d20fdd281ef07239e1f6b09ee72e8a05de1d4ba097d405fb1280

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mem_brain_mcp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba0155cfbd1c10171e0c9a56e13bacac9cad8ecd8f66de0c4451bfe3f5c89569
MD5 e11fff54b430073d2ea24fc0ba018232
BLAKE2b-256 4d5f7ed1ff3a48f04e8cef325c29896f94cc153deff4901739f011c358dc60dc

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