Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

graphjin

> 后端框架
Open source

One governed graph for AI agents — GraphQL + MCP over your databases, files, APIs, and code

3.1K stars0 likes1 views
WebsiteGitHub

About

One governed graph for AI agents — GraphQL + MCP over your databases, files, APIs, and code

GraphJin — One Governed Graph for Your AI Agents

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.

Why GraphJin For Agents

  • A built-in agent, one call away - POST one instruction to /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.
  • One governed surface for many systems - Query operational databases, warehouses, MongoDB, object stores, local files, CodeSQL source indexes, workflows, and GraphJin system roots through GraphQL and MCP.
  • Smart discovery before action - Agents start with query_catalog(search: "<user instruction>"), graphql_help, relationship evidence, examples, config recipes, and safety notes before writing or running queries.
  • Guarded action, not raw access - Source-mode access, query allow-lists, read-only boundaries, policy-aware MCP tools, local encrypted secrets, and gj_config preview/apply keep changes auditable.
  • Operational awareness - 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.
  • Standing questions, not just answers - Hand a cursor-paginated subscription to 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.
  • Durable memory - Saved queries, fragments, and workflows live in the owner-scoped gj_artifacts store. Normal watches are durable by default; explicit ephemeral watches use TTL leases.

Installation

npm (all platforms)

bash
npm install -g graphjin

macOS (Homebrew)

bash
brew install dosco/graphjin/graphjin

Windows (Scoop)

bash
scoop bucket add graphjin https://github.com/dosco/graphjin-scoop
scoop install graphjin

Linux

Download .deb/.rpm from releases

Docker

bash
docker pull dosco/graphjin

Docker — 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.

bash
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.

Try It Now

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:

bash
graphjin serve --demo

The 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/mcp

Ask 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:

bash
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:

bash
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/.

Add GraphJin To Your AI Client

Local / Dev

Use GraphJin's helper when you want one command that normalizes the URL, probes auth, and installs the right Codex or Claude config:

bash
graphjin mcp add codex
graphjin mcp add claude
graphjin mcp add all http://localhost:8080

Defaults 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:

bash
codex mcp add graphjin --url http://localhost:8080/api/v1/mcp
claude mcp add --transport http graphjin http://localhost:8080/api/v1/mcp

GraphJin'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:

bash
graphjin mcp add codex --global

Codex can also add non-URL stdio MCP servers with the generic command shape:

bash
codex mcp add <server-name> -- <command> [args...]

Hosted GraphJin With OAuth

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:

bash
codex mcp add graphjin --url https://graphjin.example.com/api/v1/mcp
claude mcp add --transport http graphjin https://graphjin.example.com/api/v1/mcp

This 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:

bash
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"

Legacy / Current auth_login Fallback

If a server still uses GraphJin's current auth_login device-code flow instead of standards OAuth, graphjin mcp add detects that automatically:

bash
graphjin mcp add codex https://graphjin.example.com

The 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:

bash
graphjin mcp install codex https://graphjin.example.com
graphjin mcp plugin install https://graphjin.example.com   # deprecated Claude alias

Authenticate The CLI

Before 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):

bash
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 IdP

What setup does, depending on the server:

  • No built-in login (the server has auth_login.enabled: false): saves only the URL. CLI calls send no Authorization header.
  • Built-in login enabled: kicks off an RFC 8628 device-code flow. The CLI prints a verification URL + short code, opens your browser, you sign in with the configured identity provider (Google, Okta, Keycloak, Auth0-as-IdP, Azure AD — anything OIDC), and the server mints a 30-day JWT. Both URL and JWT are saved to client.json.

After setup every graphjin cli ... command just works:

bash
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:

yaml
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.

Getting started

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

bash
graphjin serve new my-app

Step 2: Start the GraphJin Service

bash
graphjin serve --path ./my-app

Step 3: Add GraphJin to an AI client

bash
graphjin mcp add claude http://localhost:8080

Issues· 22 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Goagentic-aiai-agentscloud-nativecockroachdb

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架