One governed graph for AI agents — GraphQL + MCP over your databases, files, APIs, and code
One governed graph for AI agents — GraphQL + MCP over your databases, files, APIs, and code
GraphJin is a compiler and runtime that gives AI agents one governed graph over the systems a real company already has: databases, warehouses, files, source code, workflows, metadata, and security policy. Instead of handing an agent raw credentials and hoping it guesses correctly, GraphJin exposes that graph through GraphQL + MCP: the agent discovers before acting, validates queries, runs approved work, observes runtime status — and every answer is checked against an execution ledger before it leaves the server.
It is not only for agents. GraphJin is still a high-performance GraphQL-to-database compiler, Go library, standalone API service, REST/OpenAPI gateway, and real-time subscription server. The agent use case is where everything comes together: the same compiler that serves your apps can also give AI a smart, auditable way to work across data, code, and operations.
Works with PostgreSQL, MySQL, MongoDB, SQLite, Oracle, MSSQL, Snowflake, Redshift, BigQuery, Apache Cassandra / Amazon Keyspaces, S3/GCS/local files, CodeSQL source indexes - and models from Claude/GPT-4 to local 7B models.
/api/v1/agent (or call the ask_graphjin_agent MCP tool) and GraphJin runs the discovery loop itself - as the caller, under the caller's permissions - and returns a typed, evidence-backed answer. See Server-Side Agent.query_catalog(search: "<user instruction>"), graphql_help, relationship evidence, examples, config recipes, and safety notes before writing or running queries.gj_config preview/apply keep changes auditable.gj_security, gj_runtime, and the built-in console expose policy and bounded runtime status so agents can check what is safe before they act.gj_watch and GraphJin keeps answering it under the owner's permissions, resumes from persisted cursors across restarts, treats absence as a first-class event, and files what it finds in a durable inbox (gj_watch_event), a webhook, or a workflow. Evaluation runs on database polls, not model calls - a model writes the watch once, and nothing calls one again unless you turn on optional per-watch triage. See Watches.gj_artifacts store. Normal watches are durable by default; explicit ephemeral watches use TTL leases.npm (all platforms)
npm install -g graphjinmacOS (Homebrew)
brew install dosco/graphjin/graphjinWindows (Scoop)
scoop bucket add graphjin https://github.com/dosco/graphjin-scoop
scoop install graphjinLinux
Download .deb/.rpm from releases
Docker
docker pull dosco/graphjinDocker — as an agent environment
The same binary also ships as a graded environment for training and evaluating agents. It boots ready with nothing mounted: the demo world and a 113-task verified suite are built in.
docker run -d -p 8090:8090 --tmpfs /tmp:size=1g dosco/graphjin:env-latest/health says what it is — build, suite fingerprint, dataset fingerprint,
reward contract, and whether the suite matches the world it is served on.
/tmp must be writable: each world provisions its own database there.
See the environment docs for the full story.
One command, no clone, no Docker. The binary ships with a built-in demo — a SaaS company ops app (accounts, subscriptions, invoices, support tickets) on SQLite with seeded data, saved queries, and workflows:
graphjin serve --demoThe demo project is extracted to ./graphjin-demo, and its state lives under
./graphjin-demo/demo/. Delete the demo/ folder to reset the data, or
delete ./graphjin-demo entirely for a fresh copy. You'll see output like
this:
GraphJin started
───────────────────────
Web UI: http://localhost:8083/
GraphQL: http://localhost:8083/api/v1/graphql
REST API: http://localhost:8083/api/v1/rest/
Workflows: http://localhost:8083/api/v1/workflows/<name>
MCP: http://localhost:8083/api/v1/mcpAsk the built-in agent
With a model API key in ./.env (OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_APIKEY), the same command switches into agentic mode and enables GraphJin's built-in agent - one instruction in, a typed, evidence-backed answer out:
curl -sS localhost:8083/api/v1/agent \
-H 'content-type: application/json' \
-d '{"instruction": "Which account is most at risk of churning?"}'Answers come back as {status, answer, data, evidence, actions, next}, grounded by server-side protocol guards. You can also chat with it in the built-in web console at localhost:8083/agent — it streams every tool call live as it works. See Server-Side Agent below, AGENTIC.md, and graphjin.com/agentic/server-agent.
More demo verticals
The bigger demos live in the repo — clone it and pass --path:
git clone https://github.com/dosco/graphjin
cd graphjin
graphjin serve --demo --path examples/webshop # classic GraphQL starter (Postgres)
graphjin serve --demo --path examples/coffee-roastery # flagship agentic demo (Postgres + BigQuery-emu + CodeSQL)Each demo keeps its state under <path>/demo/ and reuses it on later starts.
A MySQL corrugated-box plant with JWT roles and a PCB fab spanning Postgres +
Snowflake-emu + MongoDB + a file source + an OpenAPI supplier API live in
examples/, each with an end-to-end smoke suite
(make smoke-all runs them all). The full tour is at
https://graphjin.com/start/demos/.
Use GraphJin's helper when you want one command that normalizes the URL, probes auth, and installs the right Codex or Claude config:
graphjin mcp add codex
graphjin mcp add claude
graphjin mcp add all http://localhost:8080Defaults are client=codex, server=http://localhost:8080, and project scope.
The command normalizes the server to http://localhost:8080/api/v1/mcp. Local
non-TLS HTTP is correct for loopback development; hosted servers should use
HTTPS.
If you prefer native client commands, add GraphJin's Streamable HTTP endpoint directly:
codex mcp add graphjin --url http://localhost:8080/api/v1/mcp
claude mcp add --transport http graphjin http://localhost:8080/api/v1/mcpGraphJin's /api/v1/mcp endpoint is Streamable HTTP, so Claude should use
--transport http for GraphJin. SSE is only for older/custom MCP servers.
Use --global when you want the MCP connection available outside the current project:
graphjin mcp add codex --globalCodex can also add non-URL stdio MCP servers with the generic command shape:
codex mcp add <server-name> -- <command> [args...]When mcp.oauth.enabled: true is configured on a hosted GraphJin server, modern
MCP clients can add it by URL and handle OAuth login themselves:
codex mcp add graphjin --url https://graphjin.example.com/api/v1/mcp
claude mcp add --transport http graphjin https://graphjin.example.com/api/v1/mcpThis is the native remote-MCP path. GraphJin serves OAuth protected-resource
metadata, authorization-server metadata, DCR/CIMD discovery, and MCP 401
challenges so the client can discover login automatically. See the official
OpenAI Docs MCP quickstart for the
Codex mcp add --url flow and the
Claude Code MCP docs for
Claude's HTTP transport and authentication flow.
For legacy/custom SSE servers, use Claude's SSE transport explicitly:
claude mcp add --transport sse <name> <url>
claude mcp add --transport sse private-api https://api.company.com/sse \
--header "X-API-Key: your-key-here"auth_login FallbackIf a server still uses GraphJin's current auth_login device-code flow instead of standards OAuth, graphjin mcp add detects that automatically:
graphjin mcp add codex https://graphjin.example.comThe command opens the device-code login, saves ~/.config/graphjin/client.json, and installs a credential-free local proxy config for the AI client. Re-run graphjin mcp setup https://graphjin.example.com later only when you want to refresh or rotate that saved CLI/proxy token.
The deprecated aliases still work for scripts:
graphjin mcp install codex https://graphjin.example.com
graphjin mcp plugin install https://graphjin.example.com # deprecated Claude aliasBefore graphjin cli can talk to a server, point it at one. There are no --server or --token flags — both come from a single saved config file (~/.config/graphjin/client.json, mode 0600):
graphjin cli setup http://localhost:8080 # local dev, no auth needed
graphjin cli setup https://graphjin.example.com # signs in via the server's OIDC IdPWhat setup does, depending on the server:
auth_login.enabled: false): saves only the URL. CLI calls send no Authorization header.client.json.After setup every graphjin cli ... command just works:
graphjin cli health
graphjin cli query list
graphjin cli schema tables
graphjin cli setup show # print the saved config (token redacted)
graphjin cli setup logout # delete client.json
graphjin cli setup # re-run sign-in against the same server (refresh token)To enable built-in login, set this on the server:
auth:
type: jwt
jwt:
secret: "long-random-shared-secret" # used to sign and verify local JWTs
auth_login:
enabled: true
audience_graphjin: true # shorthand for audience: "graphjin-cli"
oidc:
issuer_url: "https://accounts.google.com"
client_id: "..."
client_secret: "..." # or $GJ_AUTH_LOGIN_OIDC_CLIENT_SECRET
allowed_domains: ["example.com"] # optional allow-list
mcp:
oauth:
enabled: true
mode: builtin # reuses auth_login identity
scopes: ["mcp"]Successful authentication is recorded in structured logs with the verified email and name claims (when present), giving you a clean audit trail of who called every endpoint.
To use GraphJin with your own databases you have to first create a new GraphJin app, then configure it using its config files and then launch GraphJin.
Step 1: Create New GraphJin App
graphjin serve new my-appStep 2: Start the GraphJin Service
graphjin serve --path ./my-appStep 3: Add GraphJin to an AI client
graphjin mcp add claude http://localhost:8080No open issues yet, or sync has not completed.