What you’ll build
- A Graphify MCP server on HTTP at
/mcp, protected by an API key. - A Docker container that runs as a non-root user and reads a mounted graph.
- Agents connected to it from Claude Code and other MCP clients.
Setup
graphify-out/graph.json. Generate a long random key and keep it in your secret manager:
Step 1: Run it locally over HTTP
GRAPHIFY_API_KEY and logs api-key required. It binds to 127.0.0.1 by default. Check that the key is enforced:
Authorization: Bearer <key> or X-API-Key: <key>. Without one, the server returns 401 with {"error": "unauthorized"}.
Step 2: Build the Docker image
The repository includes aDockerfile. It installs the mcp extra on python:3.12-slim, runs as user 10001, and serves /data/graph.json on port 8080:
Step 3: Run the container
0.0.0.0, so it can take traffic from Docker. Publishing on 127.0.0.1 keeps it off the network until a proxy sits in front. If you start it on 0.0.0.0 without a key, the server prints a warning that the graph is exposed unauthenticated. Don’t ignore it.
Step 4: Put TLS in front
Never send the key over plain HTTP. Put a reverse proxy such as Caddy in front:Step 5: Connect your agents
Step 6: Refresh the graph
The server checks the graph file’s modification time and size, and reloads when they change. Rebuild in CI and copy the newgraph.json into the mounted folder. No restart needed.
When it goes wrong
Every request returns401. The key doesn’t match, or the proxy strips the Authorization header. Try X-API-Key, or call the container directly to rule out the proxy.
HTTP transport needs the mcp extra. Install graphifyy[mcp]. The Docker image already has it.
Requests are rejected for the Host header. When bound to a specific address, the server only accepts that address and localhost as the Host. Bind 0.0.0.0 behind your proxy, as the image does.
Behind a load balancer, sessions drop. Start with --stateless so any instance can serve any request.
Production patterns
- Rotate the key like any other secret, and give each team its own server and key.
- Mount the graph read-only, as in Step 3.
- Use
--pathto serve at a path other than/mcp. - Graphify, the hosted product, runs this for you with sign-in, team access and automatic rebuilds. See Connect cloud coding agents.
Complete example
What you built
One MCP server, behind TLS and an API key, that serves your code graph to every teammate and agent, and picks up new graphs without a restart.Next steps
Shared HTTP server
Reference for running the MCP server over HTTP.
Shared team graph
Keep the graph that you serve up to date.
Try it in Graphify
We build and host the graph for you. Start with a 14-day Pro trial, then keep up to 3 repositories on Free. No card required.