Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build/
*.egg
.graphify/
graphify-out/
.worktrees/
.graphify_*.json
.graphify_python
.claude/
Expand Down
29 changes: 20 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# graphify MCP server as a shared HTTP service (issue #1143).
# graphify MCP server — single-graph and multi-graph targets.
#
# Build: docker build -t graphify .
# Run: docker run -p 8080:8080 -v "$(pwd)/graphify-out:/data" graphify \
# /data/graph.json --transport http --host 0.0.0.0 --api-key "$SECRET"
# Single-graph (existing, default):
# docker build -t graphify .
# docker run -p 8080:8080 -v "$(pwd)/graphify-out:/data" graphify \
# /data/graph.json --transport http --host 0.0.0.0 --api-key "$SECRET"
#
# Builds from source so the image includes the Streamable HTTP transport even
# before it lands on PyPI. The graph.json is mounted at runtime (-v), never
# baked into the image.
FROM python:3.12-slim
# Multi-graph:
# docker build --target multi -t graphify-multi .
# docker run -p 8080:8080 -v "$(pwd)/my-graphs:/graphs:ro" graphify-multi

FROM python:3.12-slim AS base
WORKDIR /app
COPY . /app

Expand All @@ -19,7 +20,17 @@ RUN pip install --no-cache-dir ".[mcp]"
RUN useradd --create-home --uid 10001 graphify
USER graphify

# --- Single-graph target (default, backward-compatible) ---
FROM base AS single
EXPOSE 8080

ENTRYPOINT ["python", "-m", "graphify.serve"]
CMD ["/data/graph.json", "--transport", "http", "--host", "0.0.0.0", "--port", "8080"]

# --- Multi-graph target ---
FROM base AS multi
EXPOSE 8080
VOLUME /graphs
ENV GRAPHS_DIR=/graphs
ENV SCAN_INTERVAL=30
ENV PORT=8080
ENTRYPOINT ["graphify-mcp", "--transport", "http", "--host", "0.0.0.0"]
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,34 @@ docker run -p 8080:8080 -v "$(pwd)/graphify-out:/data" graphify \
> python3 -m venv .venv && .venv/bin/pip install "graphifyy[mcp]"
> ```

### Multi-graph MCP server

Serve multiple knowledge graphs from a single endpoint — useful for multi-repo setups, monorepos with per-service graphs, or comparing codebases.

```bash
# structure: one folder per graph
my-graphs/
frontend/graph.json
backend/graph.json
shared-lib/graph.json

# run with Docker
docker build --target multi -t graphify-multi .
docker run -p 8080:8080 -v "$(pwd)/my-graphs:/graphs:ro" graphify-multi

# or with docker-compose
docker compose -f docker-compose.multi.yml up --build
```

| Env var | Default | Purpose |
|---|---|---|
| `GRAPHS_DIR` | `/graphs` | Mount point to scan for `<name>/graph.json` |
| `SCAN_INTERVAL` | `30` | Seconds between auto-discovery rescans |
| `PORT` | `8080` | HTTP listen port |
| `GRAPHIFY_API_KEY` | — | Require `Authorization: Bearer <key>` |

Tools: same as single-graph (`query_graph`, `get_node`, `get_neighbors`, etc.) plus `list_graphs` and `use_graph`. Each tool accepts an optional `graph` parameter to target a specific graph, or use `use_graph` to set a session default.

---

## Environment variables
Expand Down
18 changes: 18 additions & 0 deletions docker-compose.multi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# docker-compose.multi.yml
# Quick start for multi-graph MCP server.
#
# Place graphs as: ./my-graphs/<project-name>/graph.json
# Start: docker compose -f docker-compose.multi.yml up --build
services:
graphify-mcp:
build:
context: .
target: multi
ports:
- "8080:8080"
volumes:
- ./my-graphs:/graphs:ro
environment:
- SCAN_INTERVAL=30
- PORT=8080
# - GRAPHIFY_API_KEY=your-secret-key
Loading