Skip to content

Commit ff415de

Browse files
committed
Dockerfile for mcp-neo4j-memory
1 parent 462e2fb commit ff415de

File tree

3 files changed

+168
-36
lines changed

3 files changed

+168
-36
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# Virtual Environment
24+
venv/
25+
env/
26+
ENV/
27+
28+
# IDE
29+
.idea/
30+
.vscode/
31+
*.swp
32+
*.swo
33+
34+
# Git
35+
.git
36+
.gitignore
37+
38+
# Docker
39+
Dockerfile
40+
.dockerignore
41+
42+
# Documentation
43+
docs/
44+
*.md
45+
!README.md
46+
!pyproject.toml
47+
48+
# Tests
49+
tests/
50+
test/
51+
testing/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM python:3.11-slim
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Install build dependencies
7+
RUN pip install --no-cache-dir hatchling
8+
9+
# Copy dependency files first
10+
COPY pyproject.toml /app/
11+
12+
# Install runtime dependencies
13+
RUN pip install --no-cache-dir mcp>=0.10.0 neo4j>=5.26.0
14+
15+
# Copy the source code
16+
COPY src/ /app/src/
17+
COPY README.md /app/
18+
19+
# Install the package
20+
RUN pip install --no-cache-dir -e .
21+
22+
# Environment variables for Neo4j connection
23+
ENV NEO4J_URL="bolt://host.docker.internal:7687"
24+
ENV NEO4J_USERNAME="neo4j"
25+
ENV NEO4J_PASSWORD="password"
26+
27+
# Command to run the server using the package entry point
28+
CMD ["sh", "-c", "mcp-neo4j-memory --db-url ${NEO4J_URL} --username ${NEO4J_USERNAME} --password ${NEO4J_PASSWORD}"]

servers/mcp-neo4j-memory/README.md

Lines changed: 89 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# Neo4j Knowledge Graph Memory MCP Server
1+
# 🧠🕸️ Neo4j Knowledge Graph Memory MCP Server
22

3-
## Overview
3+
## 🌟 Overview
44

5-
A Model Context Protocol (MCP) server implementation that provides persistent memory capabilities through Neo4j graph database integration.
5+
A Model Context Protocol (MCP) server implementation that provides persistent memory capabilities through Neo4j graph database integration.
66

77
By storing information in a graph structure, this server maintains complex relationships between entities as memory nodes and enables long-term retention of knowledge that can be queried and analyzed across multiple conversations or sessions.
88

99
With [Neo4j Aura](https://console.neo4j.io) you can host your own database server for free or share it with your collaborators. Otherwise you can run your own Neo4j server locally.
1010

1111
The MCP server leverages Neo4j's graph database capabilities to create an interconnected knowledge base that serves as an external memory system. Through Cypher queries, it allows exploration and retrieval of stored information, relationship analysis between different data points, and generation of insights from the accumulated knowledge. This memory can be further enhanced with Claude's capabilities.
1212

13-
### Graph Schema
13+
### 🕸️ Graph Schema
1414

1515
* `Memory` - A node representing an entity with a name, type, and observations.
1616
* `Relationship` - A relationship between two entities with a type.
1717

18-
### Usage Example
18+
### 🔍 Usage Example
1919

2020
```
2121
Let's add some memories
@@ -29,17 +29,13 @@ Results in Claude calling the create_entities and create_relations tools.
2929

3030
![](./docs/images/employee_graph.png)
3131

32-
## Components
32+
## 📦 Components
3333

34-
<!--
35-
### Resources
36-
### Prompts
37-
-->
38-
### Tools
34+
### 🔧 Tools
3935

4036
The server offers these core tools:
4137

42-
#### Query Tools
38+
#### 🔎 Query Tools
4339
- `read_graph`
4440
- Read the entire knowledge graph
4541
- No input required
@@ -57,7 +53,7 @@ The server offers these core tools:
5753
- `names` (array of strings): Entity names to retrieve
5854
- Returns: Subgraph with specified nodes
5955

60-
#### Entity Management Tools
56+
#### ♟️ Entity Management Tools
6157
- `create_entities`
6258
- Create multiple new entities in the knowledge graph
6359
- Input:
@@ -73,7 +69,7 @@ The server offers these core tools:
7369
- `entityNames` (array of strings): Names of entities to delete
7470
- Returns: Success confirmation
7571

76-
#### Relation Management Tools
72+
#### 🔗 Relation Management Tools
7773
- `create_relations`
7874
- Create multiple new relations between entities
7975
- Input:
@@ -89,7 +85,7 @@ The server offers these core tools:
8985
- `relations`: Array of objects with same schema as create_relations
9086
- Returns: Success confirmation
9187

92-
#### Observation Management Tools
88+
#### 📝 Observation Management Tools
9389
- `add_observations`
9490
- Add new observations to existing entities
9591
- Input:
@@ -106,24 +102,24 @@ The server offers these core tools:
106102
- `observations` (array of strings): Observations to remove
107103
- Returns: Success confirmation
108104

109-
## Usage with Claude Desktop
105+
## 🔧 Usage with Claude Desktop
110106

111-
### Released Package
107+
### 💾 Installation
112108

113-
Can be found on PyPi https://pypi.org/project/mcp-neo4j-memory/
109+
```bash
110+
pip install mcp-neo4j-memory
111+
```
114112

115-
Add the server to your `claude_desktop_config.json` with configuration of
113+
### ⚙️ Configuration
116114

117-
* db-url (for [Neo4j Aura](https://console.neo4j.io) `neo4j+s://xxxx.databases.neo4j.io` for local `bolt://localhost`)
118-
* username
119-
* password
115+
Add the server to your `claude_desktop_config.json` with configuration of:
120116

121117
```json
122118
"mcpServers": {
123119
"neo4j": {
124120
"command": "uvx",
125121
"args": [
126-
"mcp-neo4j-memory",
122+
"mcp-neo4j-memory==0.1.1",
127123
"--db-url",
128124
"neo4j+s://xxxx.databases.neo4j.io",
129125
"--username",
@@ -135,29 +131,86 @@ Add the server to your `claude_desktop_config.json` with configuration of
135131
}
136132
```
137133

138-
### Development
134+
Alternatively, you can set environment variables:
139135

140136
```json
141-
# Add the server to your claude_desktop_config.json
142137
"mcpServers": {
143138
"neo4j": {
144-
"command": "uv",
139+
"command": "uvx",
140+
"args": [ "mcp-neo4j-memory==0.1.1" ],
141+
"env": {
142+
"NEO4J_URL": "neo4j+s://xxxx.databases.neo4j.io",
143+
"NEO4J_USERNAME": "<your-username>",
144+
"NEO4J_PASSWORD": "<your-password>"
145+
}
146+
}
147+
}
148+
```
149+
150+
### 🐳 Using with Docker
151+
152+
```json
153+
"mcpServers": {
154+
"neo4j": {
155+
"command": "docker",
145156
"args": [
146-
"--directory",
147-
"parent_of_servers_repo/mcp-neo4j/servers/mcp-neo4j-memory/src/mcp_neo4j_memory",
148157
"run",
149-
"mcp-neo4j-memory",
150-
"--db-url",
151-
"bolt://localhost",
152-
"--username",
153-
"neo4j",
154-
"--password",
155-
"<your-password>"
158+
"--rm",
159+
"-e", "NEO4J_URL=neo4j+s://xxxx.databases.neo4j.io",
160+
"-e", "NEO4J_USERNAME=<your-username>",
161+
"-e", "NEO4J_PASSWORD=<your-password>",
162+
"mcp/neo4j-memory:0.1.1"
156163
]
157164
}
158165
}
159166
```
160167

161-
## License
168+
## 🚀 Development
169+
170+
### 📦 Prerequisites
171+
172+
1. Install `uv` (Universal Virtualenv):
173+
```bash
174+
# Using pip
175+
pip install uv
176+
177+
# Using Homebrew on macOS
178+
brew install uv
179+
180+
# Using cargo (Rust package manager)
181+
cargo install uv
182+
```
183+
184+
2. Clone the repository and set up development environment:
185+
```bash
186+
# Clone the repository
187+
git clone https://github.com/yourusername/mcp-neo4j-memory.git
188+
cd mcp-neo4j-memory
189+
190+
# Create and activate virtual environment using uv
191+
uv venv
192+
source .venv/bin/activate # On Unix/macOS
193+
.venv\Scripts\activate # On Windows
194+
195+
# Install dependencies including dev dependencies
196+
uv pip install -e ".[dev]"
197+
```
198+
199+
### 🐳 Docker
200+
201+
Build and run the Docker container:
202+
203+
```bash
204+
# Build the image
205+
docker build -t mcp/neo4j-memory:latest .
206+
207+
# Run the container
208+
docker run -e NEO4J_URL="neo4j+s://xxxx.databases.neo4j.io" \
209+
-e NEO4J_USERNAME="your-username" \
210+
-e NEO4J_PASSWORD="your-password" \
211+
mcp/neo4j-memory:latest
212+
```
213+
214+
## 📄 License
162215

163216
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

0 commit comments

Comments
 (0)