Mercatorgraph Docs

Getting Started

Run the stack, index a project, connect an AI agent.

Getting Started

Prerequisites

Docker Engine 20.10+ with the Compose v2 plugin (docker compose version).

1. Run the stack

Grab the compose file and env template from the example/ folder, then:

cp .env.example .env      # set POSTGRES_PASSWORD, TAG
docker compose up -d      # postgres + worker + mcp + view

Check it is up:

curl -s localhost:19883/health     # worker -> {"status":"ok"}

2. Register + build a project

docker compose exec -T postgres psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c \
  "INSERT INTO projects (slug, repo_url) VALUES ('demo','https://github.com/octocat/Hello-World.git') ON CONFLICT DO NOTHING;"

curl -X POST localhost:19883/projects/demo/rebuild
curl localhost:19883/projects/demo/status     # wait for "succeeded"

3. Mint a scoped agent token

TOKEN="my-agent-token"
HASH=$(python3 -c "import hashlib;print(hashlib.sha256('$TOKEN'.encode()).hexdigest())")
docker compose exec -T postgres psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c \
  "INSERT INTO tokens (token_hash, principal, scopes) VALUES ('$HASH','my-agent', ARRAY['demo']);"

4. Connect an agent

claude mcp add mercatorgraph --transport http http://localhost:19884/mcp \
  --header "Authorization: Bearer my-agent-token"

Tools: list_projects, query_graph, get_node, trace_path, blast_radius, search, add_annotation, graph_diff.

See Configuration for all env vars and Deployment for running from published images.

On this page