Skip to main content

MCP Memory Graph Server

PyPI - Version Python Version License: MIT

Overview

The Memory Graph Server provides a persistent storage layer for knowledge graphs, allowing for:

  • Storage of entities and their properties
  • Management of relationships between entities
  • Querying and traversing the graph structure
  • Real-time updates and modifications

Features

  • MongoDB-based persistent storage
  • Graph operations (create, read, update, delete)
  • Entity management
  • Relationship handling
  • Query capabilities
  • Real-time updates

Configuration

Setting up a Free MongoDB Atlas Cluster (Quick Start)

If you do not already have a MongoDB instance running, you can spin up a free cloud cluster on MongoDB Atlas (https://cloud.mongodb.com) in just a few minutes:

  1. Register / Sign in
    Open https://cloud.mongodb.com and create an account. You can register with e‑mail or sign in via Google or GitHub.

  2. Create a Project & Cluster
    Create a new Project (e.g. mcp-memory) and choose Create → Deployment → Create a cluster. Select the Free Shared (M0) tier, pick the provider/region closest to you, give the cluster a name and click Create. Provisioning takes ~2‑3 minutes.

  3. Create a Database User
    Navigate to Database Access → Add New Database User. – Choose Password authentication. – Enter a Username (e.g. mcp_user) and a strong Password (or autogenerate one). – For quick tests, give the user Read and write to any database privileges (you can tighten this later). – Click Add User and store the credentials somewhere safe.

  4. Allow Your IP Address
    Go to Network Access → Add IP Address and whitelist the public IP address from which the server will connect. You can click Add Current IP Address or specify it manually.

  5. Get the Connection String (URI)
    On the Database Deployments screen click Connect → Drivers, choose Python and copy the URI, which looks like:

    mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?retryWrites=true&w=majority
    

    Replace <username>/<password> with the credentials from step 3 and optionally append /<database> to select the default database, e.g. /mcp_memory.

  6. Configure the Memory Graph Server
    Export the connection string via the environment variable expected by the server:

    export MCP_MONGO_MEMORY_CONNECTION="mongodb+srv://mcp_user:<password>@cluster0.mongodb.net/mcp_memory?retryWrites=true&w=majority"
    

    Keep the quotes around the URI so that special characters are preserved, and never commit this string to version control.

Now you can launch the server as shown in the MCP Server Configuration section.

Using Environment Variables Directly

Alternatively, you can set the required environment variable directly:

MCP_MONGO_MEMORY_CONNECTION=mongodb://username:password@host:port/database

Installation and Setup

Prerequisites

  1. Install uvx (if not already installed):

    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Set up MongoDB connection (see Configuration section below)

MCP Server Configuration

Add the snippet below to your mcp configuration:

{
  "mcpServers": {
    "Memory": {
      "command": "/path/to/local/bin/uvx",
      "args": [
        "mongo-memory"
      ],
      "env": {
        "MCP_MONGO_MEMORY_CONNECTION": "mongodb://username:password@host:port/database"
      }
    }
  }
}

Replace /path/to/local/bin/ with your actual path to uvx. Replace the connection string with your actual MongoDB credentials.

Available Operations

The server provides the following operations for AI agents:

Entity Management:

  • create_entities - Create new entities with unique names
  • get_entity - Retrieve a single entity by name
  • update_entity - Update existing entity data
  • delete_entity - Remove an entity
  • find_entities - Search entities with query criteria

Relationship Management:

  • create_relationship - Create relationships between entities
  • get_relationships - Retrieve relationships with filtering
  • delete_relationship - Remove specific relationships

Memory Structure:

  • get_memory_structure - Get current memory organization
  • get_usage_guide - Get comprehensive usage examples and best practices

For detailed usage examples, patterns, and best practices, AI agents should call get_usage_guide().

Development

See DEVELOPMENT.md for development setup and guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mongo-memory 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongo-memory 0.3.2
File Size Uploaded Provenance
mongo_memory-0.3.2.tar.gz 17.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mongo-memory 0.3.2
File Interpreter ABI Platform
mongo_memory-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / mongo_memory-0.3.2.tar.gz

Download URL mongo_memory-0.3.2.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8fd14566826dbe31b11e877c79f803f3806a3e337e2962232dd98ba84a49ee17
BLAKE2b-256 checksum
How to use checksums
13f526fbe0b2a2d1273832b2f90d25b90b854d297628c495cec9f87265114928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / mongo_memory-0.3.2-py3-none-any.whl

Download URL mongo_memory-0.3.2-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93e87516ff72670fc60aa08327724e6b9626b111963dcc61e8a9f40bb82801db
BLAKE2b-256 checksum
How to use checksums
af8488681d796ff68c323d2b5b9538545a948c47f24c2762d7006cd5156df602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for mongo-memory 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page