|
| 1 | +# Graphiti MCP Demo |
| 2 | + |
| 3 | +We are implementing an MCP server and AI agent integration to leverage Zep's Graphiti for persistent memory and context continuity across Cursor and Claude. This will allow AI agents hosted on Cursor and Claude to connect to the MCP for dynamic tool discovery, select the optimal tool for a given query, and formulate responses informed by past interactions, all while Graphiti ensures consistent context across both client platforms. |
| 4 | + |
| 5 | +We use: |
| 6 | + |
| 7 | +- Graphiti by [Zep AI](https://www.getzep.com/) as a memory layer for an AI agent |
| 8 | +- Cursor and Claude (as MCP Hosts) |
| 9 | + |
| 10 | +## Set Up |
| 11 | + |
| 12 | +Follow these steps to set up the project before running the MCP server. |
| 13 | + |
| 14 | +### Clone GitHub Repository |
| 15 | + |
| 16 | +```bash |
| 17 | +git clone https://github.com/getzep/graphiti.git |
| 18 | +cd graphiti/mcp_server |
| 19 | +``` |
| 20 | + |
| 21 | +### Install Dependencies |
| 22 | + |
| 23 | +```bash |
| 24 | +uv sync |
| 25 | +``` |
| 26 | + |
| 27 | +### Configuration |
| 28 | + |
| 29 | +Before running the MCP server, you need to configure the environment variables. Here's a look at the `.env` file you need to create in the `graphiti/mcp_server` directory: |
| 30 | + |
| 31 | +```dotenv |
| 32 | +# Neo4j Database Configuration |
| 33 | +NEO4J_URI=bolt://localhost:7687 |
| 34 | +NEO4J_USER=neo4j |
| 35 | +NEO4J_PASSWORD=demodemo |
| 36 | +
|
| 37 | +# OpenAI API Configuration |
| 38 | +OPENAI_API_KEY=<your_openai_api_key> |
| 39 | +MODEL_NAME=gpt-4.1-mini |
| 40 | +``` |
| 41 | + |
| 42 | +## Use MCP Server |
| 43 | + |
| 44 | +Graphiti MCP server can be run using Docker or directly with Python. Docker is recommended for use, while direct Python execution is useful for troubleshooting. |
| 45 | + |
| 46 | +### Run MCP Server |
| 47 | + |
| 48 | +Docker deployment will start both the Neo4j database and the Graphiti MCP server. |
| 49 | + |
| 50 | +Start the services using Docker Compose: |
| 51 | + |
| 52 | +```bash |
| 53 | +docker compose up |
| 54 | +``` |
| 55 | + |
| 56 | +**Note**: When running the Docker Compose for both the Neo4j database and the Graphiti MCP server, if you encounter the `No server info found` error in the MCP logs, try running the server directly using Python to troubleshoot the issue. |
| 57 | + |
| 58 | +```bash |
| 59 | +python graphiti_mcp_server.py --transport sse |
| 60 | +``` |
| 61 | + |
| 62 | +### Integrate MCP Clients |
| 63 | + |
| 64 | +- **Cursor**: Here's the configuration of the `mcp.json` file to integrate the MCP server with Cursor: |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "mcpServers": { |
| 69 | + "Graphiti": { |
| 70 | + "url": "http://localhost:8000/sse" |
| 71 | + } |
| 72 | + } |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +- **Claude**: Here's the configuration of `claude_desktop_config.json` file to integrate the MCP server with Claude: |
| 77 | + |
| 78 | +```json |
| 79 | +{ |
| 80 | + "mcpServers": { |
| 81 | + "graphiti": { |
| 82 | + "transport": "stdio", |
| 83 | + "command": "/Users/avichawla/.local/bin/uv", |
| 84 | + "args": [ |
| 85 | + "run", |
| 86 | + "--isolated", |
| 87 | + "--directory", |
| 88 | + "/Users/avichawla/Desktop/posts/graphiti/mcp_server", |
| 89 | + "--project", |
| 90 | + ".", |
| 91 | + "graphiti_mcp_server.py", |
| 92 | + "--transport", |
| 93 | + "stdio" |
| 94 | + ] |
| 95 | + } |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +## 📬 Stay Updated with Our Newsletter! |
| 101 | + |
| 102 | +**Get a FREE Data Science eBook** 📖 with 150+ essential lessons in Data Science when you subscribe to our newsletter! Stay in the loop with the latest tutorials, insights, and exclusive resources. [Subscribe now!](https://join.dailydoseofds.com) |
| 103 | + |
| 104 | +[](https://join.dailydoseofds.com) |
| 105 | + |
| 106 | +## Contribution |
| 107 | + |
| 108 | +Contributions are welcome! Feel free to fork this repository and submit pull requests with your improvements. |
0 commit comments