MongoDB Knowledge Graph MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MongoDB Knowledge Graph MCP Server
A high-performance Python implementation of a Model Context Protocol (MCP) server that provides persistent memory your AI agent through a MongoDB-based knowledge graph storage system.
Overview
This MCP server enables your AI agent to create, manage, and recall information using a structured knowledge graph stored efficiently in MongoDB.
Related MCP server: dejaview-mcp
Installation
Requirements
Python 3.10 or higher
MongoDB 4.4 or higher
MCP Python SDK 1.2.0+
Dependencies managed via
uv(recommended)
Install Dependencies
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .Development Dependencies
# Install development dependencies
uv sync --group dev
# Or using pip
pip install -e .[dev]Configuration
MongoDB Setup
Ensure MongoDB is running on your system:
# macOS with Homebrew
brew services start mongodb-community
# Ubuntu/Debian
sudo systemctl start mongodEnvironment Variables
export MONGODB_URI=mongodb://localhost:27017
export MONGODB_DATABASE=knowledge_graph_db
export MONGODB_COLLECTION_PREFIX=kg_ # optionalUsage with Claude Desktop
Setup
Add this to your claude_desktop_config.json:
uv
{
"mcpServers": {
"mongodb-knowledge-graph": {
"command": "uv",
"args": [
"run",
"mongodb_knowledge_graph/main.py",
"run",
"mongodb_knowledge_graph"
],
"env": {
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DATABASE": "knowledge_graph_db",
}
}
}
}VS Code Installation Instructions
Add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).
Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
Note that the
mcpkey is not needed in the.vscode/mcp.jsonfile.
uv
{
"mcp": {
"servers": {
"mongodb-knowledge-graph": {
"command": "uv",
"args": [
"run",
"mongodb_knowledge_graph/main.py"
],
"env":{
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DATABASE": "knowledge_graph_db",
}
}
}
}
}MCP Tools
The server exposes the following tools:
π Graph Overview
get_graph_summary- Get graph statistics without loading full dataread_graph- Retrieve entire graph (use sparingly for large datasets)
π Entity Management
create_entities- Batch create entities efficientlydelete_entities- Remove entities and cascade delete relationsadd_observations- Add observations with deduplicationdelete_observations- Remove specific observations
π Relationship Management
create_relations- Batch create relationships efficientlydelete_relations- Remove specific relationships
π― Query & Search Operations
search_nodes- Search entities by name, type, or observation contentopen_nodes- Retrieve specific entities by nameget_subgraph- Explore entity neighborhoods with depth controlfind_path- Discover shortest paths between entities
Running Tests
# Run all tests
uv run pytest
# Test MongoDB functionality (requires running MongoDB)
TEST_MONGODB=1 uv run pytest tests/test_mongodb_*
# Run with coverage
uv run pytest --cov=mongodb_knowledge_graph --cov-report=html
# Test specific functionality
uv run pytest tests/test_knowledge_graph.py -vBest Practices
For Large Graphs
Use
get_graph_summary()instead ofread_graph()Search with
search_nodes()rather than loading everythingExplore locally with
get_subgraph()instead of broad queries
Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes with tests
Run the full test suite (
uv run pytest)Ensure MongoDB tests pass (
TEST_MONGODB=1 uv run pytest)Submit a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For issues, questions, or contributions, please visit the GitHub repository.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Persistent memory for AI agents. Semantic search, memory graph, W3C DID identity.
Shared long-term memory for AI agents: save and recall context as a searchable knowledge graph.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceProvides AI agents with persistent memory and knowledge management through a comprehensive knowledge graph platform. Enables storing, searching, and managing entities, relationships, and observations with advanced features like trending analysis and smart ranking.3MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent knowledge graph memory for AI agents, enabling them to store, recall, and query facts about people, projects, and relationships across sessions.MIT
- AlicenseNot gradedqualityBmaintenanceEnables persistent, graph-based memory for AI agents, allowing them to store, traverse, and recall relationships between facts, decisions, and context across sessions for efficient reasoning and reduced token usage.MIT

RushDB MCP Serverofficial
AlicenseAqualityBmaintenanceEnables AI agents to gain persistent, structured memory that is semantically searchable and graph-traversable, allowing them to store and query records and relationships without managing embeddings or schemas.48343 npmApache 2.0