Skip to content

Commit d611236

Browse files
committed
Adds support for running multiple instances of the server with different group ids
1 parent 316f8e3 commit d611236

File tree

2 files changed

+226
-0
lines changed

2 files changed

+226
-0
lines changed

Justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ clean:
8181
@rebuild:
8282
{{DC}} down && {{DC}} build --no-cache && {{DC}} up -d && {{DC}} logs -f
8383

84+
@rebuild-local:
85+
{{DC}} down && {{DC}} build --no-cache && {{DC}} -f docker-compose.local.yml up -d && {{DC}} logs -f
86+
8487
@restart:
8588
{{DC}} down && {{DC}} up -d && {{DC}} logs -f
8689

docker-compose.multi-instance.yml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
# Multi-Instance Docker Compose Configuration
2+
# This configuration allows you to run multiple instances of the Graphiti MCP server
3+
# Each instance runs on a different port and has its own group_id
4+
# You can access each instance at:
5+
# * http://localhost:8020/sse?group_id=claude_desktop
6+
# * http://localhost:8022/sse?group_id=cursor_ide
7+
# * http://localhost:8024/sse?group_id=project_xyz
8+
#
9+
# Copy this file locally and modify the environment variables to your liking.
10+
#
11+
# Example:
12+
# $ cp docker-compose.multi-instance.yml docker-compose.local.yml
13+
# $ docker compose -f docker-compose.local.yml up
14+
# # Or use the justfile command
15+
# $ just rebuild-local
16+
services:
17+
neo4j:
18+
image: neo4j:5.26.0
19+
ports:
20+
- "7474:7474" # HTTP
21+
- "7687:7687" # Bolt
22+
environment:
23+
- NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_PASSWORD:-demodemo}
24+
- NEO4J_server_memory_heap_initial__size=512m
25+
- NEO4J_server_memory_heap_max__size=1G
26+
- NEO4J_server_memory_pagecache_size=512m
27+
volumes:
28+
- neo4j_data:/data
29+
- neo4j_logs:/logs
30+
healthcheck:
31+
test: ["CMD", "wget", "-O", "/dev/null", "http://localhost:7474"]
32+
interval: 10s
33+
timeout: 5s
34+
retries: 5
35+
start_period: 30s
36+
37+
# ============================================================================
38+
# Instance 1: Claude Desktop / Default Workspace
39+
# Accessible at: http://localhost:8020/sse?group_id=claude_desktop (optional query param)
40+
# ============================================================================
41+
graphiti-mcp-claude:
42+
build:
43+
context: .
44+
dockerfile: ${DOCKERFILE:-Dockerfile}
45+
secrets:
46+
- ssl_cert
47+
develop:
48+
watch:
49+
- path: ./src
50+
action: sync
51+
target: /app/src
52+
- path: ./pyproject.toml
53+
action: sync
54+
target: /app/pyproject.toml
55+
- path: ./uv.lock
56+
action: sync
57+
target: /app/uv.lock
58+
- path: ./Dockerfile
59+
action: rebuild
60+
env_file:
61+
- path: .env
62+
required: true
63+
depends_on:
64+
neo4j:
65+
condition: service_healthy
66+
environment:
67+
# Neo4j Configuration (shared)
68+
- NEO4J_URI=${NEO4J_URI:-bolt://neo4j:7687}
69+
- NEO4J_USER=${NEO4J_USER:-neo4j}
70+
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-demodemo}
71+
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
72+
# Path configuration
73+
- PATH=/root/.local/bin:${PATH}
74+
- PYTHONPATH=/app
75+
# Server configuration - INSTANCE SPECIFIC
76+
- SEMAPHORE_LIMIT=${SEMAPHORE_LIMIT:-10}
77+
- MCP_SERVER_PORT=8020 # OAuth wrapper port for Claude
78+
- MCP_INTERNAL_PORT=8021 # Internal MCP server port for Claude
79+
- GROUP_ID=claude_desktop # Default group_id for this instance
80+
# OAuth Configuration
81+
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID:-graphiti-mcp-claude}
82+
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET:-graphiti-secret-key-change-this-in-production}
83+
- OAUTH_ISSUER=http://localhost:8020
84+
- OAUTH_AUDIENCE=${OAUTH_AUDIENCE:-graphiti-mcp}
85+
# Analytics Configuration
86+
- GRAPHITI_TELEMETRY_ENABLED=${GRAPHITI_TELEMETRY_ENABLED:-true}
87+
# SSL Certificate paths
88+
- SSL_CERT_FILE=${SSL_CERT_FILE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
89+
- REQUESTS_CA_BUNDLE=${REQUESTS_CA_BUNDLE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
90+
- CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
91+
volumes:
92+
- ${SSL_CERT_DIR:-./.certs}:/app/.certs:ro
93+
ports:
94+
- "8020:8020" # OAuth wrapper exposed port
95+
command: ["sh", "-c", ".venv/bin/python src/graphiti_mcp_server.py --transport sse --port 8021 --group-id claude_desktop & .venv/bin/python src/oauth_wrapper.py"]
96+
97+
# ============================================================================
98+
# Instance 2: Cursor IDE
99+
# Accessible at: http://localhost:8022/sse?group_id=cursor_ide (optional query param)
100+
# ============================================================================
101+
graphiti-mcp-cursor:
102+
build:
103+
context: .
104+
dockerfile: ${DOCKERFILE:-Dockerfile}
105+
secrets:
106+
- ssl_cert
107+
develop:
108+
watch:
109+
- path: ./src
110+
action: sync
111+
target: /app/src
112+
- path: ./pyproject.toml
113+
action: sync
114+
target: /app/pyproject.toml
115+
- path: ./uv.lock
116+
action: sync
117+
target: /app/uv.lock
118+
- path: ./Dockerfile
119+
action: rebuild
120+
env_file:
121+
- path: .env
122+
required: true
123+
depends_on:
124+
neo4j:
125+
condition: service_healthy
126+
environment:
127+
# Neo4j Configuration (shared)
128+
- NEO4J_URI=${NEO4J_URI:-bolt://neo4j:7687}
129+
- NEO4J_USER=${NEO4J_USER:-neo4j}
130+
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-demodemo}
131+
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
132+
# Path configuration
133+
- PATH=/root/.local/bin:${PATH}
134+
- PYTHONPATH=/app
135+
# Server configuration - INSTANCE SPECIFIC
136+
- SEMAPHORE_LIMIT=${SEMAPHORE_LIMIT:-10}
137+
- MCP_SERVER_PORT=8022 # OAuth wrapper port for Cursor
138+
- MCP_INTERNAL_PORT=8023 # Internal MCP server port for Cursor
139+
- GROUP_ID=cursor_ide # Default group_id for this instance
140+
# OAuth Configuration
141+
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID:-graphiti-mcp-cursor}
142+
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET:-graphiti-secret-key-change-this-in-production}
143+
- OAUTH_ISSUER=http://localhost:8022
144+
- OAUTH_AUDIENCE=${OAUTH_AUDIENCE:-graphiti-mcp}
145+
# Analytics Configuration
146+
- GRAPHITI_TELEMETRY_ENABLED=${GRAPHITI_TELEMETRY_ENABLED:-true}
147+
# SSL Certificate paths
148+
- SSL_CERT_FILE=${SSL_CERT_FILE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
149+
- REQUESTS_CA_BUNDLE=${REQUESTS_CA_BUNDLE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
150+
- CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
151+
volumes:
152+
- ${SSL_CERT_DIR:-./.certs}:/app/.certs:ro
153+
ports:
154+
- "8022:8022" # OAuth wrapper exposed port
155+
command: ["sh", "-c", ".venv/bin/python src/graphiti_mcp_server.py --transport sse --port 8023 --group-id cursor_ide & .venv/bin/python src/oauth_wrapper.py"]
156+
157+
# ============================================================================
158+
# Instance 3: Project-Specific (Optional)
159+
# Accessible at: http://localhost:8024/sse?group_id=project_xyz (optional query param)
160+
# ============================================================================
161+
graphiti-mcp-project:
162+
build:
163+
context: .
164+
dockerfile: ${DOCKERFILE:-Dockerfile}
165+
secrets:
166+
- ssl_cert
167+
develop:
168+
watch:
169+
- path: ./src
170+
action: sync
171+
target: /app/src
172+
- path: ./pyproject.toml
173+
action: sync
174+
target: /app/pyproject.toml
175+
- path: ./uv.lock
176+
action: sync
177+
target: /app/uv.lock
178+
- path: ./Dockerfile
179+
action: rebuild
180+
env_file:
181+
- path: .env
182+
required: true
183+
depends_on:
184+
neo4j:
185+
condition: service_healthy
186+
environment:
187+
# Neo4j Configuration (shared)
188+
- NEO4J_URI=${NEO4J_URI:-bolt://neo4j:7687}
189+
- NEO4J_USER=${NEO4J_USER:-neo4j}
190+
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-demodemo}
191+
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
192+
# Path configuration
193+
- PATH=/root/.local/bin:${PATH}
194+
- PYTHONPATH=/app
195+
# Server configuration - INSTANCE SPECIFIC
196+
- SEMAPHORE_LIMIT=${SEMAPHORE_LIMIT:-10}
197+
- MCP_SERVER_PORT=8024 # OAuth wrapper port for Project
198+
- MCP_INTERNAL_PORT=8025 # Internal MCP server port for Project
199+
- GROUP_ID=project_xyz # Default group_id for this instance
200+
# OAuth Configuration
201+
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID:-graphiti-mcp-project}
202+
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET:-graphiti-secret-key-change-this-in-production}
203+
- OAUTH_ISSUER=http://localhost:8024
204+
- OAUTH_AUDIENCE=${OAUTH_AUDIENCE:-graphiti-mcp}
205+
# Analytics Configuration
206+
- GRAPHITI_TELEMETRY_ENABLED=${GRAPHITI_TELEMETRY_ENABLED:-true}
207+
# SSL Certificate paths
208+
- SSL_CERT_FILE=${SSL_CERT_FILE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
209+
- REQUESTS_CA_BUNDLE=${REQUESTS_CA_BUNDLE_DOCKER:-/etc/ssl/certs/ca-certificates.crt}
210+
- CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
211+
volumes:
212+
- ${SSL_CERT_DIR:-./.certs}:/app/.certs:ro
213+
ports:
214+
- "8024:8024" # OAuth wrapper exposed port
215+
command: ["sh", "-c", ".venv/bin/python src/graphiti_mcp_server.py --transport sse --port 8025 --group-id project_xyz & .venv/bin/python src/oauth_wrapper.py"]
216+
217+
volumes:
218+
neo4j_data:
219+
neo4j_logs:
220+
221+
secrets:
222+
ssl_cert:
223+
file: ${SSL_CERT_BUILD_PATH:-/dev/null}

0 commit comments

Comments
 (0)