graphjin 3.21.19 → 3.21.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +62 -894
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,100 +1,69 @@
1
- # GraphJin — One Governed Graph for Your AI Agents
1
+ # DeepORG — One AI Agent for Your Whole Organization
2
2
 
3
3
  [![Apache 2.0](https://img.shields.io/github/license/dosco/graphjin.svg?style=for-the-badge)](https://github.com/dosco/graphjin/blob/master/LICENSE)
4
4
  [![NPM Package](https://img.shields.io/npm/v/graphjin?style=for-the-badge)](https://www.npmjs.com/package/graphjin)
5
5
  [![Docker Pulls](https://img.shields.io/docker/pulls/dosco/graphjin?style=for-the-badge)](https://hub.docker.com/r/dosco/graphjin/tags)
6
6
  [![Discord Chat](https://img.shields.io/discord/628796009539043348.svg?style=for-the-badge&logo=discord)](https://discord.gg/6pSWCTZ)
7
7
  [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/dosco/graphjin/core/v3)
8
- [![GoReport](https://goreportcard.com/badge/github.com/gojp/goreportcard?style=for-the-badge)](https://goreportcard.com/report/github.com/dosco/graphjin/core/v3)
9
8
 
10
- 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.
9
+ > **DeepORG was formerly GraphJin.** The CLI (`graphjin`), the Go module, the npm package and the Docker images keep the `graphjin` name for now.
11
10
 
12
- 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.
11
+ DeepORG is an AI agent that answers questions and makes changes across the
12
+ systems your company already runs: databases, warehouses, APIs, files and
13
+ source code. Ask it in plain words; it finds the right tables, has the database
14
+ do the work, and answers with the data behind it. It can only see and change
15
+ what your access rules allow, and by default a change waits for your approval.
13
16
 
14
- 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.
17
+ ## Why it's different
15
18
 
16
- ## Why GraphJin For Agents
19
+ **No hand-built tools.** Most company agents are wired up one tool at a time:
20
+ a "get customer" tool here, a "list invoices" tool there, each written and
21
+ maintained by hand. They break when a schema changes, and every new question
22
+ or new system means more tools. DeepORG gives the agent a searchable map of
23
+ everything you connect, and the agent writes its own queries against it. The
24
+ engine checks each query against your access rules and runs it as one efficient
25
+ database query. Connecting a new database or API is a few lines of config, not
26
+ a new set of tools.
17
27
 
18
- - **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](#server-side-agent).
19
- - **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.
20
- - **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.
21
- - **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.
22
- - **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.
23
- - **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](#watches-and-standing-questions).
24
- - **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.
28
+ **Proven on a public benchmark.** [DeepORG, the Organizational Agent
29
+ Benchmark](https://graphjin.com/benchmarks/deeporg/) scores AI models on real
30
+ organizational work against a live system: answers, changes, alerts, follow-ups
31
+ and questions that span several sources. The best published run scores 97 of
32
+ 100 with zero unsafe actions, and every score links to the exact test and build
33
+ that produced it.
25
34
 
26
- ## Installation
35
+ **Turn your organization into a training environment.** The same machinery
36
+ generates checked tasks from your own systems and serves them as graded
37
+ episodes, so you can measure an agent, or train one with reinforcement
38
+ learning, on your organization instead of a toy.
39
+ [Agent environment](https://graphjin.com/environment/)
27
40
 
28
- **npm (all platforms)**
29
- ```bash
30
- npm install -g graphjin
31
- ```
32
-
33
- **macOS (Homebrew)**
34
- ```bash
35
- brew install dosco/graphjin/graphjin
36
- ```
37
-
38
- **Windows (Scoop)**
39
- ```bash
40
- scoop bucket add graphjin https://github.com/dosco/graphjin-scoop
41
- scoop install graphjin
42
- ```
41
+ Underneath is GraphJin, the open-source engine that compiles each query into a
42
+ single database query. It is also a GraphQL API server and a Go library in its
43
+ own right.
43
44
 
44
- **Linux**
45
-
46
- Download .deb/.rpm from [releases](https://github.com/dosco/graphjin/releases)
47
-
48
- **Docker**
49
- ```bash
50
- docker pull dosco/graphjin
51
- ```
52
-
53
- **Docker — as an agent environment**
54
-
55
- The same binary also ships as a graded environment for training and evaluating
56
- agents. It boots ready with nothing mounted: the demo world and a 113-task
57
- verified suite are built in.
45
+ ## Install
58
46
 
59
47
  ```bash
60
- docker run -d -p 8090:8090 --tmpfs /tmp:size=1g dosco/graphjin:env-latest
48
+ curl -fsSL https://graphjin.com/install.sh | bash # macOS and Linux
49
+ npm install -g graphjin # any platform
50
+ brew install dosco/graphjin/graphjin # macOS
61
51
  ```
62
52
 
63
- `/health` says what it is — build, suite fingerprint, dataset fingerprint,
64
- reward contract, and whether the suite matches the world it is served on.
65
- `/tmp` must be writable: each world provisions its own database there.
66
-
67
- See [the environment docs](https://graphjin.com/environment/quickstart/) for
68
- the full story.
69
-
70
- ## Try It Now
53
+ Windows: `scoop bucket add graphjin https://github.com/dosco/graphjin-scoop`
54
+ then `scoop install graphjin`. Linux packages are on the
55
+ [releases page](https://github.com/dosco/graphjin/releases), and Docker is
56
+ `docker pull dosco/graphjin`.
71
57
 
72
- One command, no clone, no Docker. The binary ships with a built-in demo — a
73
- SaaS company ops app (accounts, subscriptions, invoices, support tickets) on
74
- SQLite with seeded data, saved queries, and workflows:
58
+ ## Try it
75
59
 
76
60
  ```bash
77
61
  graphjin serve --demo
78
62
  ```
79
63
 
80
- The demo project is extracted to `./graphjin-demo`, and its state lives under
81
- `./graphjin-demo/demo/`. Delete the `demo/` folder to reset the data, or
82
- delete `./graphjin-demo` entirely for a fresh copy. You'll see output like
83
- this:
84
-
85
- ```
86
- GraphJin started
87
- ───────────────────────
88
- Web UI: http://localhost:8083/
89
- GraphQL: http://localhost:8083/api/v1/graphql
90
- REST API: http://localhost:8083/api/v1/rest/
91
- Workflows: http://localhost:8083/api/v1/workflows/<name>
92
- MCP: http://localhost:8083/api/v1/mcp
93
- ```
94
-
95
- **Ask the built-in agent**
96
-
97
- 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:
64
+ This starts a demo SaaS company (accounts, subscriptions, invoices, support
65
+ tickets) with seeded data. Put a model key in `./.env` (`OPENAI_API_KEY`,
66
+ `ANTHROPIC_API_KEY` or `GOOGLE_API_KEY`) and ask it something:
98
67
 
99
68
  ```bash
100
69
  curl -sS localhost:8083/api/v1/agent \
@@ -102,837 +71,36 @@ curl -sS localhost:8083/api/v1/agent \
102
71
  -d '{"instruction": "Which account is most at risk of churning?"}'
103
72
  ```
104
73
 
105
- 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](#server-side-agent) below, [AGENTIC.md](AGENTIC.md#server-side-agent), and [graphjin.com/agentic/server-agent](https://graphjin.com/agentic/server-agent/).
106
-
107
- **More demo verticals**
108
-
109
- The bigger demos live in the repo — clone it and pass `--path`:
110
-
111
- ```bash
112
- git clone https://github.com/dosco/graphjin
113
- cd graphjin
114
- graphjin serve --demo --path examples/webshop # classic GraphQL starter (Postgres)
115
- graphjin serve --demo --path examples/coffee-roastery # flagship agentic demo (Postgres + BigQuery-emu + CodeSQL)
116
- ```
117
-
118
- Each demo keeps its state under `<path>/demo/` and reuses it on later starts.
119
- A MySQL corrugated-box plant with JWT roles and a PCB fab spanning Postgres +
120
- Snowflake-emu + MongoDB + a file source + an OpenAPI supplier API live in
121
- [examples/](examples/README.md), each with an end-to-end smoke suite
122
- (`make smoke-all` runs them all). The full tour is at
123
- <https://graphjin.com/start/demos/>.
124
-
125
- ## Add GraphJin To Your AI Client
126
-
127
- ### Local / Dev
128
-
129
- Use GraphJin's helper when you want one command that normalizes the URL, probes
130
- auth, and installs the right Codex or Claude config:
131
-
132
- ```bash
133
- graphjin mcp add codex
134
- graphjin mcp add claude
135
- graphjin mcp add all http://localhost:8080
136
- ```
137
-
138
- Defaults are `client=codex`, `server=http://localhost:8080`, and project scope.
139
- The command normalizes the server to `http://localhost:8080/api/v1/mcp`. Local
140
- non-TLS HTTP is correct for loopback development; hosted servers should use
141
- HTTPS.
142
-
143
- If you prefer native client commands, add GraphJin's Streamable HTTP endpoint
144
- directly:
145
-
146
- ```bash
147
- codex mcp add graphjin --url http://localhost:8080/api/v1/mcp
148
- claude mcp add --transport http graphjin http://localhost:8080/api/v1/mcp
149
- ```
150
-
151
- GraphJin's `/api/v1/mcp` endpoint is Streamable HTTP, so Claude should use
152
- `--transport http` for GraphJin. SSE is only for older/custom MCP servers.
153
-
154
- Use `--global` when you want the MCP connection available outside the current project:
155
-
156
- ```bash
157
- graphjin mcp add codex --global
158
- ```
159
-
160
- Codex can also add non-URL stdio MCP servers with the generic command shape:
161
-
162
- ```bash
163
- codex mcp add <server-name> -- <command> [args...]
164
- ```
165
-
166
- ### Hosted GraphJin With OAuth
167
-
168
- When `mcp.oauth.enabled: true` is configured on a hosted GraphJin server, modern
169
- MCP clients can add it by URL and handle OAuth login themselves:
170
-
171
- ```bash
172
- codex mcp add graphjin --url https://graphjin.example.com/api/v1/mcp
173
- claude mcp add --transport http graphjin https://graphjin.example.com/api/v1/mcp
174
- ```
175
-
176
- This is the native remote-MCP path. GraphJin serves OAuth protected-resource
177
- metadata, authorization-server metadata, DCR/CIMD discovery, and MCP 401
178
- challenges so the client can discover login automatically. See the official
179
- [OpenAI Docs MCP quickstart](https://platform.openai.com/docs/docs-mcp) for the
180
- Codex `mcp add --url` flow and the
181
- [Claude Code MCP docs](https://docs.claude.com/en/docs/claude-code/mcp) for
182
- Claude's HTTP transport and authentication flow.
183
-
184
- For legacy/custom SSE servers, use Claude's SSE transport explicitly:
185
-
186
- ```bash
187
- claude mcp add --transport sse <name> <url>
188
- claude mcp add --transport sse private-api https://api.company.com/sse \
189
- --header "X-API-Key: your-key-here"
190
- ```
191
-
192
- ### Legacy / Current `auth_login` Fallback
193
-
194
- If a server still uses GraphJin's current `auth_login` device-code flow instead of standards OAuth, `graphjin mcp add` detects that automatically:
195
-
196
- ```bash
197
- graphjin mcp add codex https://graphjin.example.com
198
- ```
199
-
200
- 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.
201
-
202
- The deprecated aliases still work for scripts:
203
-
204
- ```bash
205
- graphjin mcp install codex https://graphjin.example.com
206
- graphjin mcp plugin install https://graphjin.example.com # deprecated Claude alias
207
- ```
208
-
209
- ## Authenticate The CLI
210
-
211
- 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`):
212
-
213
- ```bash
214
- graphjin cli setup http://localhost:8080 # local dev, no auth needed
215
- graphjin cli setup https://graphjin.example.com # signs in via the server's OIDC IdP
216
- ```
217
-
218
- What `setup` does, depending on the server:
219
-
220
- - **No built-in login** (the server has `auth_login.enabled: false`): saves only the URL. CLI calls send no `Authorization` header.
221
- - **Built-in login enabled**: kicks off an [RFC 8628 device-code flow](https://www.rfc-editor.org/rfc/rfc8628). 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`.
74
+ Or chat with it at <http://localhost:8083/agent>. More demos:
75
+ [Demos](https://graphjin.com/start/demos/).
222
76
 
223
- After setup every `graphjin cli ...` command just works:
77
+ ## Use it from Claude, Codex or any MCP client
224
78
 
225
79
  ```bash
226
- graphjin cli health
227
- graphjin cli query list
228
- graphjin cli schema tables
229
- graphjin cli setup show # print the saved config (token redacted)
230
- graphjin cli setup logout # delete client.json
231
- graphjin cli setup # re-run sign-in against the same server (refresh token)
232
- ```
233
-
234
- To enable built-in login, set this on the server:
235
-
236
- ```yaml
237
- auth:
238
- type: jwt
239
- jwt:
240
- secret: "long-random-shared-secret" # used to sign and verify local JWTs
241
-
242
- auth_login:
243
- enabled: true
244
- audience_graphjin: true # shorthand for audience: "graphjin-cli"
245
- oidc:
246
- issuer_url: "https://accounts.google.com"
247
- client_id: "..."
248
- client_secret: "..." # or $GJ_AUTH_LOGIN_OIDC_CLIENT_SECRET
249
- allowed_domains: ["example.com"] # optional allow-list
250
-
251
- mcp:
252
- oauth:
253
- enabled: true
254
- mode: builtin # reuses auth_login identity
255
- scopes: ["mcp"]
256
- ```
257
-
258
- 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.
259
-
260
- ## Getting started
261
-
262
- 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.
263
-
264
- **Step 1: Create New GraphJin App**
265
- ```bash
266
- graphjin serve new my-app
267
- ```
268
-
269
- **Step 2: Start the GraphJin Service**
270
- ```bash
271
- graphjin serve --path ./my-app
272
- ```
273
-
274
- **Step 3: Add GraphJin to an AI client**
275
-
276
- ```bash
277
- graphjin mcp add claude http://localhost:8080
278
- ```
279
-
280
- **Step 4: Ask Claude questions like:**
281
- - "What tables are in the database?"
282
- - "Show me all products under $50"
283
- - "List customers and their purchases"
284
- - "What's the total revenue by product?"
285
- - "Find products with 'wireless' in the name"
286
- - "Add a new product called 'USB-C Cable' for $19.99"
287
-
288
- ## How It Works
289
-
290
- 1. **Connects to database** - Reads your schema automatically
291
- 2. **Discovers relationships** - Foreign keys become navigable joins
292
- 3. **Exposes metadata** - Built-in `gj_*` tables make discovered databases, tables, columns, relationships, functions, and indexes queryable when their feature capabilities are enabled
293
- 4. **Indexes source code** - CodeSQL turns tree-sitter syntax trees and database references into a managed SQLite database
294
- 5. **Exposes MCP tools** - Teach any LLM the query syntax
295
- 6. **Runs JS workflows** - Chain multiple GraphJin MCP tools in one reusable workflow
296
- 7. **Compiles to SQL** - Every request becomes a single optimized query
297
-
298
- No resolvers. No ORM. No N+1 queries. Just point and query.
299
-
300
- ## CodeSQL: Query Source Code Like a Database
301
-
302
- CodeSQL is a managed source kind for source trees. Configure a source folder and GraphJin creates a SQLite cache under `config/codesql/`, indexes it with tree-sitter, and updates it on restart. In development it also watches for changes while the service runs; in production live watching is disabled.
303
-
304
- ```yaml
305
- sources:
306
- - name: app
307
- kind: database
308
- type: postgres
309
- connection_string: postgres://app:secret@db/app
310
- default: true
311
-
312
- - name: code
313
- kind: code
314
- path: /srv/app
315
- infer_db_refs: true
316
-
317
- tables:
318
- - name: users
319
- source: app
320
-
321
- - name: gj_code
322
- source: code
323
- read_only: true
324
- ```
325
-
326
- GraphJin exposes CodeSQL through one ordinary GraphQL root, `gj_code`. Use `kind` to select files, symbols, references, imports, database references, docs, parse errors, change sets, and locks:
327
-
328
- ```graphql
329
- query {
330
- gj_code(where: { kind: { eq: "symbol" }, name: { iregex: "handler|resolver" } }, limit: 20) {
331
- name
332
- symbol_kind
333
- language
334
- start_row
335
- path
336
- hash
337
- }
338
- }
339
- ```
340
-
341
- GraphJin's built-in catalog creates `gj_catalog` according to the deployment-mode defaults; no source entry is required. Schema, catalog, entrypoint, capability, workflow, and system metadata are catalog items; table and column metadata are selected by `kind`. When one CodeSQL source is active, GraphJin links catalog items to code references automatically:
342
-
343
- ```graphql
344
- query {
345
- gj_catalog(where: { kind: { eq: "column" }, table_name: { eq: "users" }, column_name: { eq: "email" } }) {
346
- database_name
347
- table_name
348
- column_name
349
- gj_code {
350
- kind
351
- ref_kind
352
- path
353
- symbol_id
354
- }
355
- }
356
- }
357
- ```
358
-
359
- This is where the model gets genuinely powerful: the same agent can inspect production data systems and the code that operates them. It can ask, "which handlers touch customer invoices?", "what tables do these workflows depend on?", or "show me the imports and call sites near this data path" without switching tools or inventing a new backend.
360
-
361
- ## What AI Can Do
362
-
363
- **Simple queries with filters:**
364
- ```graphql
365
- { products(where: { price: { gt: 50 } }, limit: 10) { id name price } }
366
- ```
367
-
368
- **Nested relationships:**
369
- ```graphql
370
- {
371
- orders(limit: 5) {
372
- id total
373
- customer { name email }
374
- items { quantity product { name category { name } } }
375
- }
376
- }
377
- ```
378
-
379
- **Aggregations:**
380
- ```graphql
381
- { products { count_id sum_price avg_price } }
382
- ```
383
-
384
- **Analytics directives:**
385
- ```graphql
386
- {
387
- orders {
388
- account_id
389
- month
390
- total
391
- running_total: total @running(aggregate: sum, by: "account_id", orderBy: { month: asc })
392
- moving_avg_total: total @moving(aggregate: avg, rows: 6, by: "account_id", orderBy: { month: asc })
393
- previous_total: total @previous(by: "account_id", orderBy: { month: asc })
394
- rank_by_total: total @rank(by: "account_id", order: desc)
395
- }
396
- }
397
- ```
398
- Use analytics directives when each original row should remain visible while adding report metrics such as running totals, moving averages, previous/next values, first/last values, and rank within a group. Ordinary one-row-per-group summaries still use `distinct` plus aggregate fields. Supported SQL databases validate analytics support at compile time; MongoDB and known-old database versions return clear errors.
399
-
400
- **Mutations:**
401
- ```graphql
402
- mutation {
403
- products(insert: { name: "New Product", price: 29.99 }) { id }
404
- }
405
- ```
406
-
407
- PostgreSQL and SQLite also support an update-free insert conflict policy for a single row. GraphJin infers one supplied unique key and returns the stored row unchanged on conflict:
408
-
409
- ```graphql
410
- mutation {
411
- users(insert: { email: "ada@example.com", full_name: "Ada" }, on_conflict: get) {
412
- id email full_name
413
- }
414
- }
80
+ graphjin mcp add claude http://localhost:8083
415
81
  ```
416
82
 
417
- **Spatial queries:**
418
- ```graphql
419
- {
420
- stores(where: { location: { st_dwithin: { point: [-122.4, 37.7], distance: 1000 } } }) {
421
- name address
422
- }
423
- }
424
- ```
425
-
426
- ## Real-time Subscriptions
427
-
428
- Get live updates when your data changes. For databases with batching support, GraphJin handles thousands of concurrent subscribers with a single database query - not one per subscriber.
429
-
430
- ```graphql
431
- subscription {
432
- orders(where: { user_id: { eq: $user_id } }) {
433
- id total status
434
- items { product { name } }
435
- }
436
- }
437
- ```
438
-
439
- **Why it's efficient:**
440
- - Traditional approach: 1,000 subscribers = 1,000 database queries
441
- - GraphJin: 1,000 subscribers = 1 optimized batch query
442
- - Automatic change detection - updates only sent when data actually changes
443
- - Built-in cursor pagination for feeds and infinite scroll
444
-
445
- Dialects that do not implement GraphJin's batched polling path are listed as unsupported in the database support matrix.
446
-
447
- Subscribe over **WebSockets** (`graphql-ws` / `graphql-transport-ws` subprotocols) or **Server-Sent Events** — set `Accept: text/event-stream` on a `POST /api/v1/graphql` request and GraphJin streams `event: next` frames for each result, terminated by `event: complete`. Works from Node.js, Go, or any browser `EventSource` / WebSocket client.
448
-
449
- ## Filesystem Tables (Local, S3, GCS)
450
-
451
- Object stores show up as ordinary tables in your GraphQL schema. Declare them in config and they get the same query surface as a database table — no per-storage GraphQL plumbing on your side.
452
-
453
- ```yaml
454
- sources:
455
- - name: avatars
456
- kind: filesystem
457
- backend: s3
458
- bucket: my-bucket
459
- prefix: avatars/
460
- region: us-east-1
461
- presign_ttl: 15m
462
-
463
- - name: invoices
464
- kind: filesystem
465
- backend: gcs
466
- bucket: invoices
467
- prefix: 2026/
468
-
469
- - name: uploads_local
470
- kind: filesystem
471
- backend: local
472
- root: /var/lib/graphjin/uploads
473
-
474
- tables:
475
- - name: avatars
476
- source: avatars
477
- read_only: true
478
-
479
- - name: invoices
480
- source: invoices
481
- read_only: true
482
-
483
- - name: uploads_local
484
- source: uploads_local
485
- ```
486
-
487
- Every filesystem table exposes the same columns regardless of backend:
488
-
489
- ```graphql
490
- { avatars(
491
- where: { key: { like: "users/%" } }
492
- order_by: { key: asc }
493
- limit: 50
494
- ) {
495
- key size content_type modified_at url
496
- }
497
- }
498
-
499
- { avatars(id: "users/42.png") {
500
- key size url data # data is base64 because the field was selected
501
- }
502
- }
503
- ```
504
-
505
- The legacy `prefix`, `key`, and `inline_data` arguments remain accepted, but new callers should use the normal GraphJin read surface: `id`, `where`, `order_by`, `limit`, `offset`, `first`, `last`, `after`, and `before`.
506
- For cursor pagination, request the standard root cursor field, e.g. `avatars_cursor`, and pass it back through `after: $cursor`.
507
-
508
- `url` is a presigned GET URL by default (15 min, configurable per table). Auth follows the standard credential chain: AWS env / `~/.aws` / IRSA / EC2 IMDS for S3, Application Default Credentials for GCS — never embedded in GraphJin config.
509
-
510
- Slim builds drop SDK weight: `-tags no_s3` or `-tags no_gcs` excludes either backend. Custom backends register through `core.OptionSetFilesystemBackend(name, factory)` — same SDK GraphJin uses for the built-ins.
511
-
512
- ## File Uploads
513
-
514
- The GraphQL endpoint accepts multipart bodies per the [graphql-multipart-request-spec](https://github.com/jaydenseric/graphql-multipart-request-spec). Files can be inlined as base64 (default) or streamed straight to a filesystem table:
515
-
516
- ```yaml
517
- uploads:
518
- enabled: true
519
- storage: avatars # name of a filesystems[] entry; omit to inline as base64
520
- storage_key_prefix: "{date}/" # {date} → YYYY/MM/DD
521
- max_size: 25_000_000
522
- allowed_mime: ["image/*", "application/pdf"]
523
- ```
524
-
525
- When `storage` is set, the file body is written to the backend and the GraphQL variable becomes a stable reference — mutations persist this directly into a JSONB column:
526
-
527
- ```json
528
- { "key": "2026/05/08/abc123.png",
529
- "url": "https://s3.../...?presigned",
530
- "size": 12345,
531
- "content_type": "image/png" }
532
- ```
533
-
534
- When `storage` is empty the variable carries the bytes inline as `{filename, content_type, size, data}` (base64) — useful for small uploads going straight into `bytea`.
535
-
536
- ## Apollo Federation v2
537
-
538
- GraphJin can register as a federation subgraph so it composes with other services behind Apollo Router / Cosmo / Hive Gateway:
539
-
540
- ```yaml
541
- federation:
542
- enabled: true
543
- version: "v2.5"
544
- keys:
545
- users: ["id"] # auto-derived from PKs by default
546
- orders: ["id", "tenant_id"] # composite keys via override
547
- shareable: ["Tag.name"] # field-level @shareable
548
- inaccessible: ["Users.encrypted_password"]
549
- ```
550
-
551
- `_service { sdl }` returns a federation-flavoured SDL with `@link`, `@key`, `@shareable`, `@inaccessible`, `@tag`, `_Service`, and `_Entity`. Composition succeeds out of the box; `_entities` resolution is on the roadmap (the engine returns a clear error today, so gateways see the gap rather than silent failures).
552
-
553
- ## HTTP API Routes
554
-
555
- `graphjin serve` exposes everything under a single host/port. All routes go through the configured auth handler unless noted.
556
-
557
- | Route | Methods | Purpose |
558
- |---|---|---|
559
- | `/api/v1/graphql` | `GET`, `POST` | GraphQL queries and mutations. Subscriptions if the request is a WebSocket upgrade or carries `Accept: text/event-stream` (SSE). |
560
- | `/api/v1/rest/<name>` | `GET`, `POST` | Run a saved/persisted query by name. Variables go in `?variables=…` (GET) or the JSON body (POST). |
561
- | `/api/v1/workflows/<name>` | `GET`, `POST` | Legacy workflow execution endpoint. In source mode it is registered only when `mcp.legacy_discovery: true`; use `gj_workflow_execution(insert)` through GraphQL otherwise. |
562
- | `/api/v1/openapi.json` | `GET` | OpenAPI 3 spec generated from your saved REST queries. |
563
- | `/api/v1/mcp` | `POST` | MCP (Model Context Protocol) HTTP transport — Streamable HTTP, stateless. |
564
- | `/api/v1/mcp/message` | `POST` | Legacy MCP message route for older local proxy/client integrations. New clients should use `/api/v1/mcp`. |
565
- | `/api/v1/agent` | `POST` | Server-side agent: send one instruction, get a typed evidence-backed answer (only when `agent.enabled`). See [Server-Side Agent](#server-side-agent). |
566
- | `/.well-known/oauth-protected-resource[/api/v1/mcp]` | `GET` | MCP OAuth protected-resource metadata (only when `mcp.oauth.enabled`). |
567
- | `/.well-known/oauth-authorization-server` | `GET` | Built-in MCP OAuth authorization-server metadata (only when `mcp.oauth.enabled`). |
568
- | `/api/v1/oauth/register` | `POST` | Built-in MCP OAuth dynamic client registration (only in builtin mode). |
569
- | `/api/v1/oauth/authorize` | `GET` | Built-in MCP OAuth authorization-code + PKCE start (only in builtin mode). |
570
- | `/api/v1/oauth/token` | `POST` | Built-in MCP OAuth token exchange/refresh (only in builtin mode). |
571
- | `/api/v1/discovery` | `GET` | Legacy discovery document. In source mode it is registered only when `mcp.legacy_discovery: true`; use catalog GraphQL roots otherwise. |
572
- | `/api/v1/discovery/<section>` | `GET` | Legacy discovery drill-down (e.g. `tables`, `insights`), gated the same way as `/api/v1/discovery`. |
573
- | `/api/v1/auth/device` | `POST` | OIDC device-flow start (only if `auth_login.enabled`). |
574
- | `/api/v1/auth/device/token` | `POST` | OIDC device-flow poll. |
575
- | `/api/v1/auth/login` | `GET` | OIDC login redirect. |
576
- | `/api/v1/auth/callback` | `GET` | OIDC callback. |
577
- | `/health` | `GET` | Liveness probe. **No auth.** |
578
- | `/` | `GET` | Built-in Web UI. Defaults on in `dev` and `agentic` modes, off in `prod`; set `web_ui` explicitly to override. The UI uses `/api/v1/graphql` and GraphJin system roots such as `gj_catalog`, `gj_security`, `gj_runtime`, `gj_code`, and `gj_config`; there is no separate admin REST API. |
579
-
580
- **Mode flags that change which routes are live:**
581
- - `mcp.disable: true` — removes `/api/v1/mcp` and `/api/v1/mcp/message`.
582
- - `mcp.only: true` — keeps only `/health` and `/api/v1/mcp*`. Legacy `/api/v1/workflows/*` and `/api/v1/discovery*` remain only when `mcp.legacy_discovery: true`.
583
- - Source mode (`sources:` present) disables legacy `/api/v1/workflows/*` and `/api/v1/discovery*` unless `mcp.legacy_discovery: true`.
584
- - `web_ui: false` — drops `/` even in dev or agentic mode.
585
-
586
- ## MCP Tools
587
-
588
- GraphJin exposes a catalog-first MCP surface that guides AI models to discover before acting. The surface is caller-aware: `tools/list`, `graphql_help`, and `query_catalog` reflect the caller's visible tools, `gj_*` roots, catalog capabilities, and blocked/admin-only actions.
589
-
590
- - Start goal-driven work with `query_catalog(search: "<user instruction>")` when it is listed.
591
- - Inspect the best row with `query_catalog(id: "...")` before writing queries, choosing relationships, or using GraphJin-specific syntax.
592
- - Use `config_recipe` rows for operator work; they spell out preflight, preview/apply, unsupported apply, verification, stop conditions, and forbidden patterns.
593
- - Act through governed GraphQL roots such as `gj_workflow_execution(insert)`, `gj_workflow(insert/update/delete)`, and `gj_config(id: "current", update: ...)` only when policy exposes them.
594
- - In source mode, `gj_config` writes must run `mode: "preview"` with `expected_catalog_revision`, then resend the exact same payload with `mode: "apply"` and `preview_id`.
595
- - Source access and GraphJin root changes should use `source_patches` by exact source name instead of rewriting the full `sources` array.
596
- - Watches are managed through the unified `gj_watch` lifecycle/review root plus the `gj_watch_event` inbox and REST wrappers (`/api/v1/watches`, `/api/v1/watch-events/unseen`). A deterministic notification is a plain watch; semantic or noisy triage adds inline, tool-free AxFlow in `enrich_json`; only an explicitly requested autonomous action adds workflow/webhook delivery. Review a flow with `flow_review_json` and its `flow_hash`, or a proposed action with `action_review_json` and its `action_hash`. Flow failures deliver the raw notification but never execute autonomous delivery. MCP clients can subscribe to the aggregate `graphjin://watch-events/unseen` resource or the per-watch `graphjin://watch-events/unseen/{watch_id}` template; exact subscriptions keep independent conversations from waking for each other's watches. Unsubscribing does not pause or delete durable watches.
597
- - Use `/api/v1/watches/cleanup-preview` before `/api/v1/watches/cleanup-apply`. Expired ephemeral watches can be expired automatically, but durable watch deletion is always explicit.
598
- - Legacy discovery tools are migration shims and are disabled unless `mcp.legacy_discovery: true`.
599
-
600
- Schema reloads, schema changes, where-clause validation, and query repair remain MCP action tools.
601
-
602
- For teams building MCP agents, internal copilots, workflow agents, or enterprise automation, see [AGENTIC.md](AGENTIC.md). It explains the catalog-first agent loop in detail: discover, inspect, validate, act, observe, and refine.
603
-
604
- Key discovery tools, when listed for the caller:
605
- - `graphql_help` to choose a catalog-backed topic route when the task is broad or unclear
606
- - `query_catalog` to search schema, relationship, workflow, language, `config_recipe`, config, policy, capability, and query-pattern items. Use `search` for ranked text discovery and `where` for exact filters.
607
- - `query_catalog(id: "...")` to inspect evidence, examples, details, safety notes, and graph edges for one row
608
- - `validate_where_clause` to validate filters before execution
609
-
610
- For JS orchestration, use:
611
- - `query_catalog` with `where: { kind: { eq: "workflow" } }` to discover reusable workflows
612
- - `graphql_help(for: "workflow_runtime")` and workflow catalog rows to discover exactly which globals/functions are available inside workflow scripts
613
- - `gj_workflow_execution(insert: { workflow_name: "...", variables: {...} })` to run `./workflows/<name>.js` through GraphQL. This is mutation-only and returns an ephemeral result row; it does not store run history. Mark the workflows source or `gj_workflow_execution` table `read_only` to block it. The `execute_workflow` MCP compatibility tool is available only when `mcp.legacy_discovery: true` and `mcp.allow_workflow_execution: true`.
614
-
615
- Legacy prompts such as `write_query` and `fix_query_error` are available only when the caller's MCP surface lists them; in source mode their guidance lives in `graphql_help`, `query_catalog`, and GraphJin repair hints.
616
-
617
- ## Server-Side Agent
618
-
619
- Instead of your client chaining `query_catalog` → `validate_where_clause` → `execute_saved_query`, let GraphJin run the catalog-first discovery loop for you. Dev and agentic modes enable the agent and expose `ask_graphjin_agent` alongside the primitive MCP tools by default. The REST endpoint `POST /api/v1/agent` takes the same instruction and returns a typed, evidence-backed answer (`status`, `answer`, `data`, `evidence`, `actions`, `next`).
620
-
621
- - **Zero configuration:** dev and agentic modes also enable a private `.graphjin/artifacts.sqlite3` store, watches (`runner: all`), and stateful MCP HTTP. No application subscription starts until an active, approved watch exists. Production defaults are unchanged.
622
- - **Execution control:** there are no per-request agent modes. `agent.read_only: true` forces the server-side agent to reject mutations, including saved-query mutations; otherwise core roles, row-level security, source/table `read_only`, and Go protocol guards decide what can run.
623
- - **Caller-scoped:** the agent runs as the caller, so core roles + row-level security enforce access. The caller's role only changes which *guidance* the agent follows, never what it can read or write.
624
- - **Grounded:** Go protocol guards keep every answer backed by real catalog/validation/execution evidence and downgrade to `blocked` (with evidence) when a step is skipped.
625
- - **Semantic-aware discovery:** when semantic catalog search is ready, the agent uses short business-intent phrases and may make one private two-or-three-phrase coverage batch; one Ax request embeds cache misses, and only real catalog relationship paths count as join evidence. Lexical-only prompts and public MCP stay unchanged.
626
- - **Machine-actionable refusals:** blocked responses carry a structured `refusal` (code, reasons, unblock steps, `policy_final`/`retryable`) so a calling agent can course-correct in one step instead of guessing.
627
- - **Server-owned model:** `ask_graphjin_agent` always uses the provider, model, and credential environment variable configured under `agent`. Without server credentials it fails closed with `model_credentials_required`.
628
-
629
- It is an RLM loop — the model writes JavaScript that calls the discovery tools, and the typed result is parsed from `key: value` output. It needs strong **code generation**, not provider tool-calling. Ax requests structured JSON for typed stages, choosing the mechanism from the named deployment profile (`agent.provider`) and its rules for the selected model; `agent.structured_output_mode: auto` is the default, with `native`, `function`, and `json_object` available as overrides. `agent.service_tier` similarly defaults to provider-delegated `auto`, with portable `standard`, `flex`, and `priority` requests available when the profile/model supports them. See [AGENTIC.md](AGENTIC.md#server-side-agent) and [CONFIG.md](CONFIG.md#agent-configuration).
630
-
631
- ## Watches And Standing Questions
632
-
633
- Asking is a pull: it only produces value when someone thinks to ask. A watch is the
634
- push direction. You hand `gj_watch` a cursor-paginated subscription once, and GraphJin
635
- keeps answering it against live data, under the owner's stored identity and role.
636
-
637
- ```graphql
638
- mutation {
639
- gj_watch(insert: {
640
- name: "failed_invoices"
641
- description: "Alert when a failed invoice changes."
642
- query: "subscription failed_invoices { invoices(where: {status: {eq: \"failed\"}}, first: 25, after: $cursor) { id account_id status attempts } invoices_cursor }"
643
- }) { id name status enabled }
644
- }
645
- ```
646
-
647
- - **It costs database polls, not model calls.** The runner rides GraphJin's existing
648
- cursor-backed subscriptions, compares a hash of each result, and writes a cursor
649
- checkpoint even when nothing changed. No model is consulted to decide whether
650
- something happened. A model writes the watch once; after that the only optional model
651
- cost is per-watch triage in `enrich_json`, which is off by default and capped per day.
652
- - **Absence is a first-class event.** A watch with `absence_json` fires when the
653
- expected thing *does not* arrive, so silence stops being indistinguishable from
654
- health.
655
- - **It survives restarts.** Cursors are persisted, so a watch resumes where it left off
656
- rather than replaying or skipping.
657
- - **It cannot outrun its owner.** A watch only ever sees what its owner could already
658
- query, and both `gj_watch` and `gj_watch_event` are owner-scoped.
659
- - **Waking you and acting are different permissions.** Inbox delivery is immediate;
660
- autonomous webhook or workflow delivery stays paused until the exact current
661
- `action_hash` is approved. Alerts fail open, actions fail closed.
662
-
663
- The built-in demo registers four standing questions on a first run (declared in
664
- `examples/saas-ops/seed/watches.yml`), three of which have already fired by the time the
665
- console opens. Management, review, cleanup, and MCP resource subscriptions are covered
666
- under [MCP Tools](#mcp-tools); the full model is in
667
- [AGENTIC.md](AGENTIC.md#watches-standing-questions-with-a-durable-inbox).
668
-
669
- ## Train And Measure Agents On Your Own Graph
670
-
671
- The same machinery that grades GraphJin's public benchmark grades agents on
672
- *your* data, and runs as a reinforcement-learning environment for tuning small
673
- models on it.
674
-
675
- ```bash
676
- # Generate a verified task suite from your catalog, with a train/eval split
677
- graphjin eval create --demo --writable --scale 500 --composition coverage --split 0.8
678
-
679
- # Serve it: pooled isolated worlds, one graded episode per request
680
- graphjin env serve --path ./graphjin-demo --suite eval/suite.yml --pool 4 \
681
- --split eval/suite.split.json --side train --freeze-time 2026-08-01T12:00:00Z
682
- ```
683
-
684
- - **Tasks come from your schema, and the reward comes from the database.** Each
685
- task carries a hidden oracle — a read-only query that computes the answer —
686
- so being plausible earns nothing. Writes are graded by the state the database
687
- ended in *and* by every other row staying put.
688
- - **Worlds are isolated and resettable.** An episode leases one, so a task that
689
- writes changes only the world it was given.
690
- - **Your real schema, without your real data.** `graphjin env clone` learns a
691
- running server's schema from its catalog and writes a local synthetic copy.
692
- No rows are read; the only real values that cross over are the closed sets
693
- the catalog already publishes.
694
-
695
- Three ways to drive an episode — GraphJin calls your endpoint, you supply each
696
- completion, or you bring the whole agent over MCP — all grading through the same
697
- contract.
698
-
699
- **→ [The GraphJin Agent Environment](https://graphjin.com/environment/)**
700
-
701
- ## JS Workflows (GraphQL + REST)
702
-
703
- Workflows let an LLM run multi-step logic in JavaScript while still using GraphJin MCP tools for DB-aware operations.
704
-
705
- Create a file in `./workflows`, for example `./workflows/customer_insights.js`:
706
-
707
- ```js
708
- function main(input) {
709
- const tables = gj.tools.queryCatalog({
710
- where: { kind: { eq: "table" } }
711
- }).cards;
712
- const top = gj.tools.executeSavedQuery({
713
- name: "top_customers",
714
- variables: { limit: input.limit || 5 }
715
- });
716
- return { tables, top };
717
- }
718
- ```
719
-
720
- ### Run via GraphQL
721
-
722
- ```graphql
723
- mutation {
724
- gj_workflow_execution(insert: {
725
- workflow_name: "customer_insights"
726
- variables: { limit: 5 }
727
- }) {
728
- status
729
- result_json
730
- error
731
- }
732
- }
733
- ```
734
-
735
- Legacy MCP clients can call `execute_workflow` only when `mcp.legacy_discovery: true`.
736
-
737
- ### Run via REST
738
-
739
- This legacy HTTP endpoint is available in legacy database mode, or in source mode only when `mcp.legacy_discovery: true`.
740
-
741
- - `POST /api/v1/workflows/<name>` with JSON body
742
- - `GET /api/v1/workflows/<name>?variables={...json...}`
743
-
744
- Both map variables to the same workflow input object.
745
-
746
- ## Chat Walkthroughs
747
-
748
- Real conversations showing how an AI assistant uses GraphJin MCP tools to help you go from zero to running queries.
749
-
750
- ### "I have databases running but don't know the details"
751
-
752
- > **You:** I have some databases running locally but I'm not sure about the ports or connection details. Can you help me set up GraphJin?
753
-
754
- > **Claude:** Let me scan your system to find running databases.
755
- >
756
- > *calls `discover_databases`*
757
- >
758
- > I found 2 databases on your system:
759
- > - **PostgreSQL** on localhost:5432 (TCP) — listening, auth: ok (user: postgres), databases: `myapp`, `myapp_test`
760
- > - **MySQL** on localhost:3306 (TCP) — listening, auth: auth_failed — default credentials failed, provide username and password
761
- >
762
- > The PostgreSQL instance has databases `myapp` and `myapp_test`. Which one would you like to configure GraphJin with?
763
-
764
- > **You:** Let's go with the "myapp" database on Postgres.
765
-
766
- > **Claude:** I'll configure GraphJin to connect to your PostgreSQL database.
767
- >
768
- > *calls `update_current_config` with databases: {"main": {type: "postgres", host: "localhost", port: 5432, user: "postgres", dbname: "myapp"}}*
769
- >
770
- > Connected successfully! Let me discover the catalog surface.
771
- >
772
- > *calls `query_catalog` with `where: {kind: {eq: "table"}}`*
773
- >
774
- > Your database has these tables: `users`, `orders`, `products`, `reviews`. Want me to write a query?
775
-
776
- > **You:** Show me users with their orders.
777
-
778
- > **Claude:** *calls `query_catalog` with `search: "join users orders", where: {kind: {eq: "relationship"}}`, then `query_catalog(id: "<relationship_id>")`, then `execute_graphql` if raw execution is listed*
779
- > ```graphql
780
- > { users { id name email orders { id total status } } }
781
- > ```
782
- > Here are the results — 24 users returned, each with their associated orders.
783
-
784
- ### "I have a Docker Compose project with MySQL"
785
-
786
- > **You:** I'm running a Docker Compose stack with MySQL. Help me connect GraphJin to it.
787
-
788
- > **Claude:** Let me check what database containers you have running.
789
- >
790
- > *calls `discover_databases`*
791
- >
792
- > Found a MySQL Docker container:
793
- > - **MySQL** via Docker — container `myapp-db-1`, image `mysql:8.0`, port mapped to localhost:13306
794
- >
795
- > I'll configure GraphJin with the discovered connection details.
796
- >
797
- > *calls `update_current_config` with databases: {"main": {type: "mysql", host: "localhost", port: 13306, user: "root", dbname: ""}}*
798
- >
799
- > What's the database name and password for your MySQL instance?
800
-
801
- > **You:** Database is "shop_db", password is "secret123".
802
-
803
- > **Claude:** *calls `update_current_config` with the full credentials*
804
- >
805
- > Connected! Let me explore the catalog.
806
- >
807
- > *calls `query_catalog` with `where: {kind: {eq: "table"}}`*
808
- >
809
- > Tables found: `customers`, `products`, `orders`, `order_items`, `categories`. Let me check how they relate.
810
- >
811
- > *calls `query_catalog` with `search: "join orders customers order_items products", where: {kind: {eq: "relationship"}}`, then `query_catalog(id: "<relationship_id>")` for the relevant relationship items*
812
- >
813
- > `orders` connects to `customers` (via customer_id) and `order_items` (via order_id), and `order_items` links to `products`. Here's a nested query:
814
- >
815
- > ```graphql
816
- > { orders { id total customer { name email } order_items { quantity product { name price } } } }
817
- > ```
818
-
819
- ### "I want to query my SQLite app database"
820
-
821
- > **You:** I have a SQLite database file in my project. Can GraphJin work with it?
822
-
823
- > **Claude:** Absolutely! Let me scan your project directory for SQLite files.
824
- >
825
- > *calls `discover_databases` with scan_dir: "."*
826
- >
827
- > Found 1 SQLite database:
828
- > - **data/app.sqlite3** — file found
829
- >
830
- > I'll configure GraphJin to use it.
831
- >
832
- > *calls `update_current_config` with databases: {"main": {type: "sqlite", path: "data/app.sqlite3"}}*
833
- >
834
- > Connected! Let me see your tables.
835
- >
836
- > *calls `query_catalog` with `where: {kind: {eq: "table"}}`*
837
- >
838
- > Tables: `tasks`, `projects`, `tags`, `task_tags`. Want to query something?
839
-
840
- > **You:** Show me all tasks with their project name, sorted by due date.
841
-
842
- > **Claude:** *calls `query_catalog` with `search: "join tasks projects", where: {kind: {eq: "relationship"}}`, then `query_catalog(id: "<relationship_id>")`, then `execute_graphql` if raw execution is listed*
843
- > ```graphql
844
- > { tasks(order_by: {due_date: asc}) { id title due_date completed project { name } } }
845
- > ```
846
- > Here are your 12 tasks sorted by due date, each showing the parent project name.
847
-
848
- ## Database Support
849
-
850
- | Database | Queries | Mutations | Subscriptions | Full-Text | GIS | Schema DDL |
851
- |----------|---------|-----------|---------------|-----------|-----|------------|
852
- | PostgreSQL | Yes | Yes | Yes | Yes | PostGIS | Yes |
853
- | MySQL | Yes | Yes | Yes | Yes | 8.0+ | Yes |
854
- | MariaDB | Yes | Yes | Yes | Yes | Yes | Yes |
855
- | MSSQL | Yes | Yes | Yes | No | Yes | Yes |
856
- | Oracle | Yes | Yes | Yes | No | Yes | Yes |
857
- | SQLite | Yes | Yes | Yes | FTS5 | SpatiaLite | Yes |
858
- | MongoDB | Yes | Yes | Yes | Yes | Yes | No |
859
- | Cassandra / Keyspaces | CQL-native | Single-table PK | Partition-bound polling | No | No | No |
860
- | Snowflake | Yes | Yes | No | No | No | Yes |
861
- | Redshift | Experimental queries | Experimental PK writes | Experimental batched polling | Limited search | Limited | Experimental basic DDL |
862
- | BigQuery | Yes (experimental) | No | No | No | No | No |
863
- | CockroachDB | Yes | Yes | Yes | Yes | No | No |
864
-
865
- Also works with AWS Aurora/RDS, Google Cloud SQL, and YugabyteDB. Snowflake supports key pair (JWT) authentication and SHOW-based catalog discovery/paging. Redshift support is experimental: queries/discovery, single-table primary-key writes, batched polling subscriptions, limited `ILIKE` search over configured `full_text` columns, limited spatial filters, and basic generated DDL. Redshift subscriptions are polling-based warehouse queries, not native change streams. BigQuery support is experimental and query-focused. Cassandra / Keyspaces support CQL-native queries, partition-bound polling subscriptions, and single-table primary-key writes; aggregates, full scans, OR-style cross-partition filters, full-text, and GIS remain outside the generic surface.
866
-
867
- ## Production Security
868
-
869
- **Query allow-lists** - In production, only saved queries can run. AI models call `execute_saved_query` with pre-approved queries. No arbitrary SQL injection possible.
870
-
871
- **Source-mode access** - New multi-user deployments should use `sources:` with request-wide `identity` and source-level access defaults. GraphJin compiles those defaults into the existing qcode/SQL enforcement path, so account filters and trusted mutation presets are enforced by the generated database query.
872
-
873
- ```yaml
874
- identity:
875
- user_id_claim: sub
876
- role_claims: [role, roles]
877
- namespace_claim: account_id
878
-
879
- sources:
880
- - name: app
881
- kind: database
882
- access:
883
- read: account
884
- write: blocked
885
- delete: blocked
886
- namespace_column: account_id
887
- ```
888
-
889
- See [SECURITY.md](SECURITY.md) for the security model and [Source Mode Migration](docs/SOURCE-MODE-MIGRATION.md) for legacy `roles[].tables` migration steps. In source mode, user-written `roles[].tables` rules are rejected intentionally.
890
-
891
- **JWT authentication** - Supports Auth0, Firebase, JWKS endpoints.
892
-
893
- **Response caching** - Redis with in-memory fallback. Automatic cache invalidation on mutations. **Stale-while-revalidate** support: serve cached responses immediately while a background worker refreshes the entry — concurrent refreshes for the same key are deduplicated via singleflight, and the worker pool is bounded so a thundering herd can't spawn unbounded goroutines.
894
-
895
- ```yaml
896
- caching:
897
- ttl: 3600 # hard expiry in seconds
898
- fresh_ttl: 300 # soft expiry — entries past this trigger SWR refresh
899
- ```
900
-
901
- ## Also a GraphQL API
902
-
903
- GraphJin works as a traditional API too - use it from Go or as a standalone service.
904
-
905
- ### Go
906
- ```bash
907
- go get github.com/dosco/graphjin/core/v3
908
- ```
909
- ```go
910
- db, _ := sql.Open("pgx", "postgres://localhost/myapp")
911
- gj, _ := core.NewGraphJin(nil, db)
912
- res, _ := gj.GraphQL(ctx, `{ users { id email } }`, nil, nil)
913
- ```
914
-
915
- ### Standalone Service
916
- ```bash
917
- brew install dosco/graphjin/graphjin # Mac
918
- graphjin serve new myapp && cd myapp
919
- graphjin serve
920
- ```
83
+ Other clients: [MCP](https://graphjin.com/agentic/mcp/). Hosted servers with sign-in:
84
+ [MCP OAuth](https://graphjin.com/agentic/oauth/).
921
85
 
922
- Built-in web UI at `http://localhost:8080` for query development.
86
+ ## Learn more
923
87
 
924
- ## Documentation
88
+ | | |
89
+ |---|---|
90
+ | Get started | [Quick start](https://graphjin.com/start/quick-start/) · [Your first query](https://graphjin.com/start/first-query/) |
91
+ | The agent | [How it works](https://graphjin.com/agentic/server-agent/) · [Conversations](https://graphjin.com/agentic/lead-agent/) · [Watches](https://graphjin.com/agentic/watches/) · [Workflows](https://graphjin.com/agentic/workflows/) |
92
+ | Connect your systems | [Databases](https://graphjin.com/reference/database-support/) · [APIs](https://graphjin.com/integrations/openapi/) · [Files](https://graphjin.com/integrations/filesystem-uploads/) · [Source code](https://graphjin.com/integrations/codesql/) |
93
+ | Run it in production | [Production](https://graphjin.com/configure/environment-production/) · [Access rules](https://graphjin.com/configure/auth-rbac/) · [Config reference](CONFIG.md) |
94
+ | GraphQL and Go | [Query language](https://graphjin.com/core/) · [Go examples](https://pkg.go.dev/github.com/dosco/graphjin/core#pkg-examples) |
95
+ | Measure agents | [Benchmark](https://graphjin.com/benchmarks/deeporg/) · [Agent environment](https://graphjin.com/environment/) |
925
96
 
926
- - [Configuration Reference](CONFIG.md)
927
- - [Feature Reference](FEATURES.md)
928
- - [Agent Environment](https://graphjin.com/environment/) — train and measure agents
929
- - [Agent Evaluation](https://graphjin.com/agentic/evaluation/) — gate a release
930
- - [Go Examples](https://pkg.go.dev/github.com/dosco/graphjin/core#pkg-examples)
97
+ Works with PostgreSQL, MySQL, SQLite, MongoDB, Oracle, SQL Server, Snowflake,
98
+ BigQuery, Cassandra, S3, GCS and local files.
931
99
 
932
- ## Get in Touch
100
+ ## Community
933
101
 
934
- [Twitter @dosco](https://twitter.com/dosco) | [Discord](https://discord.gg/6pSWCTZ)
102
+ [Discord](https://discord.gg/6pSWCTZ) · [Twitter @dosco](https://twitter.com/dosco)
935
103
 
936
104
  ## License
937
105
 
938
- [Apache Public License 2.0](https://opensource.org/licenses/Apache-2.0)
106
+ [Apache 2.0](https://opensource.org/licenses/Apache-2.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphjin",
3
- "version": "3.21.19",
3
+ "version": "3.21.21",
4
4
  "description": "GraphJin — one governed graph for AI agents: GraphQL + MCP over your databases, files, APIs, and code",
5
5
  "bin": {
6
6
  "graphjin": "bin/graphjin.js"