build-mcp-server-4-any-db
Build mcp server for any database based on GraphJin.
English | 中文 · Usage wizard (zh) · Feature status MCP Server with Ontology Build Platform is a desktop tool: enter a database connection, and it starts GraphJin, discovers the schema, and writes your permissions into GraphJin's sources config (database-level read / write / delete modes plus per-role read grants). The result is an HTTP endpoint (/api/v1/mcp) that Claude, Cursor and other MCP clients can connect to directly — no hand-written YAML, no need to learn GraphJin's config format.
Summary extracted from the README.
MCP Server with Ontology Build Platform
Configure GraphJin visually and turn any database into an MCP server.
English | 中文 · Usage wizard (zh) · Feature status
MCP Server with Ontology Build Platform is a desktop tool: enter a database connection, and it starts GraphJin,
discovers the schema, and writes your permissions into GraphJin's sources config
(database-level read / write / delete modes plus per-role read grants). The result is an
HTTP endpoint (/api/v1/mcp) that Claude, Cursor and other MCP clients can connect to
directly — no hand-written YAML, no need to learn GraphJin's config format.
Legacy projects (databases: + roles[].tables) are migrated to sources: before the
service starts; the original file is kept as a .bak and restored automatically if the
migration fails.

Contents
- Usage wizard (zh) — end-to-end walkthrough, from zero to a connected AI client
- Architecture
- Features
- Requirements
- Local startup
- Local test databases (Docker)
- The GraphJin binary
- Data and security
- Verification
- Project layout
- Known limitations
- Author
Architecture
┌───────────────────────────── Electron ─────────────────────────────┐
│ Vue 3 renderer (Pinia + Element Plus + vue-i18n) │
│ │ JSON-RPC over HTTP /rpc │
│ Node backend (sidecar-backend) │
│ ├── GraphJinSupervisor process lifecycle, crash restarts │
│ ├── McpClient MCP Streamable HTTP client │
│ ├── UserStore users / orgs / connections (SQLite) │
│ ├── permission planner sources[].access + per-role grants │
│ └── config migrator legacy databases → sources (pre-start) │
│ │ MCP tools │ child process │
└─────────┼─────────────────────────────────┼─────────────────────────┘
▼ ▼
GraphJin /api/v1/mcp GraphJin (graphjin serve)
│ │
└─────────── business database (PostgreSQL / MySQL / SQLite …)┘
- Why HTTP transport: the bundled stdio proxy in v3.21.14 is broken (see the
baseline doc), so the generated client config points straight at
/api/v1/mcp. - The config model is source mode: connections live in a
sources:array, permissions insources[].access(read / write / delete modes, owner column, table classes) andaccess.grants(per-role read rules).databases:androles[].tablesare the legacy shape — shipping them next tosources:makes the process die at startup, so the backend migrates old projects before starting GraphJin (see "Legacy migration"). - Permission model: the local role name is the GraphJin role name — no mapping layer. Writes take effect immediately.
Features
Runtime
Process state, endpoint, project directory, crash-restart count, health probe, stop, and the copyable MCP client configuration.

Welcome & one-click demo
The app opens on a welcome page that says what this is in one line, then shows three steps
(connect a database / set permissions / plug into your AI) with the completion state computed
from real data — click any step to jump there. "Try the demo" builds a sample project in about
10 seconds (a finance system, an inventory system and an equipment maintenance
system: 21 tables, about 650 rows of realistic data; one read-only role per database,
finance_analyst / inventory_viewer / maintenance_engineer, with the row filter
owner_code = current user, writes and deletes blocked) without touching your own
databases; from there you can jump straight to the schema browser or the permission
matrix — switching databases switches identity: inventory_viewer sees zero rows in the finance
database, and vice versa. The maintenance database is modelled from first principles
(equipment → parts → faults → fault tree → plans / reports → replaced parts and consumables), and
the business constraints live in the schema itself: a repair report has exactly one trigger
(a plan or a fault), a plan's interval must match its type, and a fault can only point at a
leaf cause in the fault tree.
"Self-check" at the bottom reports the GraphJin binary, backend, running instance, database
reachability and role configuration as red/green items.
On first launch the app also opens the in-app usage wizard (connect → set permissions → verify → plug in your AI, each step jumping to the right page). Closing it stops the auto-open; the "Usage wizard" button in the bottom-right or the top bar brings it back anytime.


Connect an AI client
Pick Claude Desktop / Claude Code / Cursor, copy the config JSON or the graphjin mcp add
command in one click, then run the self-check — it calls tools/list so you can see the tools
are actually exposed.

Connections
- Built-in drivers plus custom alias templates (TiDB / CockroachDB connect through the postgres / mysql protocol);
- Three input modes: file path, connection fields, connection string;
- A connection is saved locally once a test or start succeeds; the list below lets you refill the form, start from it, or delete it;
- The "connected" badge is computed from the instance running right now (project directory
plus the source names in
dev.yml); stopping the service or switching projects drops it back to "tested" instead of leaving the last start result in the status column; - Deleting a connection also removes it from the running instance's
dev.yml: the instance restarts when other databases remain, and the service stops when the last one is deleted, so the Schema browser and the permission matrix stop showing it; - Credentials are encrypted with the keystore key before hitting SQLite; the list only shows non-sensitive summary fields;
- Start verifies the connection first: clicking Start on a saved connection really dials the database once and stops with the reason in the message when it cannot be reached (rotated password, database service down, network cut) instead of failing later with a bare "GraphJin failed to start";
- Testing works even when the service is down: the backend spins up a throwaway GraphJin instance, validates, then stops it. Relative database paths are resolved against the connection's own project directory, so no empty database gets created in the temp directory and reported as "no tables";
- Types flagged
driverVerified=false(ClickHouse / Redshift / BigQuery …) have no working driver in the bundled GraphJin version, so Test and Start are disabled and the UI points you at the postgres / mysql protocol instead.

Schema browser
The top bar lists the databases the running instance actually loaded. Picking one loads
its tables, columns and foreign keys only (query_catalog is filtered by
database_name, so multi-database projects never bleed into each other).

MCP Client
The built-in MCP client talks to the running instance over the protocol itself
(initialize → tools/list → tools/call) to prove every database in dev.yml really works:
Test all databases reads each source's catalog and then runs one minimal query against the
first table unique to that database, reporting status, table count, sample table and elapsed time
per database, with failures highlighted. The same page lists tools per role and runs hand-written
GraphQL through execute_graphql, showing the raw response. Below the query box, sample queries
generated from the active database's real table names fill the editor in one click, and the
"Call examples" block shows copyable argument JSON for tools like execute_graphql — paste it
straight into your AI client.
Tables with the same name in several databases cannot be addressed by name alone (in practice the query lands on the default database), so those databases only get a catalog check labelled "catalog only" instead of a false pass.

MCP
execute_graphqldoes not forward the user code, so row filters never apply — this page verifies role-level rules only. Use the verification panel on the permission matrix page (HTTP GraphQL) for row-level rules.
Business ontology
A schema says which tables exist and how they join; it never says what the business is. This page maintains the context the AI needs before it queries data, all written by a human and handed over verbatim. Each database has its own set — the same wording can mean entirely different things in two databases. Six layers, delivered in the order "words → entities → relations → constraints → measures → examples":
- Terms — how the words people actually say map to the schema, optionally bound to a column and carrying that column's real value domain;
- Concepts — business entities, their meaning and boundaries, possibly spanning tables, with an optional primary key and display column;
- Relations — what a foreign key is called in the business, which way it points, and its cardinality. When one table has three foreign keys to the same target, this is what tells the AI which edge "by customer" means;
- Rules — invariants and state machines with a severity (note / warning / enforced), an enforceable form (read filter / hidden column / blocked table / read-only), and a decidable predicate;
- Metrics — named aggregations with grain, unit, time window and an executable fragment;
- Examples — a question paired with a verified query: few-shot for the model, and a regression set for you.
"Tables" and "Relations" both draw their candidates from the currently selected database's schema:
a relation can be picked straight from an existing foreign key, which fills both ends for you.
The preview at the bottom shows exactly what the AI will receive, and deliberately contains only
what a schema cannot tell it: no table structure, columns or foreign keys, because the AI gets
those from query_catalog anyway.
Anything domain-specific the system does not understand goes into extra attributes: passed through verbatim, neither interpreted nor validated — so no schema change and no self-invented entry kind is needed to accommodate an industry.
The page also offers a consistency check: it reconciles the entries against the real schema (are the referenced tables still there, does an enforced rule have a decidable expression, does a metric have a formula, does the bound column exist, do both ends of a relation line up). With the instance stopped it runs only the rules that do not need a schema, and says how many it skipped.
You do not have to start from an empty table: Draft from the schema lists what the database already has but the ontology does not cover — tables without a concept, foreign keys without a relation, commented columns without a term. "Draft" only fills the form and never saves, because meaning still needs a human. Once a term is bound to a column, Scan values samples that column and fills the value domain — accepting low-cardinality columns only (too many values, very long ones, or values containing "=" are rejected), so sensitive values stay out of every conversation's context.
Examples can be evaluated: declare the expected tables / columns / values, then run the evaluation and the platform checks whether the query still runs, whether it matches what you declared, and whether the ontology actually documents the tables that question needs. It does not judge how well a model answers — a passing evaluation means "this context still holds up", not "the AI understands the business".
Enforced rules can be compiled into permissions: pick an enforceable form (read filter, hidden column, blocked table, read-only) and the platform computes a patch and shows the diff. It only computes; applying goes through the Permissions page's own write path and snapshots automatically. Rules GraphJin cannot express (write invariants, state machines) are reported as conflicts rather than silently "applied".
What you maintain is grouped per database and delivered to AI clients through the MCP gateway
in three tiers: the handshake carries only a catalog (per-database counts, every enforced rule
in full, and how to fetch details — with a length cap), the full text or one section comes from
business_ontology on demand, query searches by the words a question uses, and
describe_business_object profiles a single object (itself plus everything touching the same
tables). What is delivered also depends on identity: entries about blocked tables — and, for
non-admins, admin-only tables — are never sent to that role's client, so data and semantics are
restricted together. Clients that connect straight to GraphJin do not see any of it — turn on
"Deliver through the platform gateway" on the Connect AI page, which is also the only way row
filters work because identity comes from the token. With nothing maintained the gateway stays a
plain proxy, so existing clients are unaffected.
A single entry longer than 1000 characters is truncated at render time and marked, and the consistency check suggests splitting it: every entry in the prompt costs budget, and one giant entry displaces ten useful ones.

The consistency check, example evaluation, rule compilation and object profiles live further down the same page:

Permission matrix
The page is split into one tab per database: each database keeps its own role list, matrix and uncommitted edits, so switching tabs never leaks rules across; a dot on the tab means that database has pending changes. Applying only touches the active tab's database, and the confirm dialog names the target database.
Below the tabs is the role → database allowlist: tick the roles that may access this database.
An unticked role is compiled, when the policy is applied, into a filter condition that never holds
(it matches zero rows), and after the write the role is actually used to run one query as a
self-check (boundaryCheck) — so the engine blocks it, not the gateway; a client talking to GraphJin
directly gets nothing either. admin always has access, and a database you never ticked stays
"unrestricted", so older projects are not silently tightened.
Inside a tab there are two panels that mirror the two layers of GraphJin's source mode:
Source access (sources[].access, applies to the whole database):
- read / write / delete modes: read supports
public/authenticated/owner/account/blocked, while write and delete offerauthenticated/owner/account/blocked; - the
ownermode needs an owner column (row ownership filter; inserts filled with the current identity when the owner is omitted); - two table classes: "admin only" (nobody but admin can read) and "blocked" (nobody, including admin, can read).
Read matrix (sources[].access.grants[], role × table):
- the read toggle per role and table; tables not listed in any grant stay fully readable for authenticated roles (engine semantics, verified in practice), so scoping by role must use the role → database allowlist above, and blocking tables must use the two table classes;
- row filters (GraphJin DSL,
$user_codeand friends still work); - column control: an allowlist, or a blocklist converted into its complement allowlist
(GraphJin's
columnsonly accepts an array and rejects an empty one).
Writes and deletes have no per-table switch and no write column allowlist — that is the source-mode boundary, not an oversight (see "Known limitations").
On load everything is filled from the effective policy (empty cells only, local edits are kept); Import effective policy overwrites uncommitted edits on purpose. Every write shows a per-item diff and asks for confirmation.
The × on a role chip removes the local role. If the role is already in the effective
policy you get a confirmation explaining that GraphJin keeps its rules — reclaim them from
the write history.
Verify access runs one real GraphQL request as the selected role (graphql.execute).
GraphJin blocks queries silently (null, no errors) and mutations with errors; the panel
calls out both cases.
Every write also snapshots the current policy first (policy_snapshots in
mcp-builder.db, including sources[].access). Open Write history to inspect snapshots
and restore any of them; the state is snapshotted again before restoring, so a rollback can
itself be rolled back. admin is a reserved platform role: it is not part of the matrix,
the platform never writes restrictive rules for it, and a rollback never removes it.

Legacy migration (databases → sources)
When the project's dev.yml is still in the legacy shape (databases: + roles[].tables),
Start migrates it first and then boots GraphJin with the new config:
- start a throwaway instance and read roles and columns through the read-only config API
(
get_current_config/query_catalog); - move the
databases:connections (the config API returns[REDACTED], so real credentials come from the file) intosources:, foldingroles[].tablesfilters and columns intoaccess.grants; - stop the throwaway instance and let the supervisor restart with the new config.
The migration only reads config and rewrites the file — it never calls
update_current_config: every config write triggers a reload that reconnects all
databases, so a single unreachable database rejects the whole update (see
docs/graphjin-source-migration.md §2.4c, Chinese).
- the original file is backed up as
dev.yml.legacy-<timestamp>.bakand restored automatically when the migration throws, with the real cause in the error; - per-table write switches have no counterpart: write / delete degrade to the database
level (default
blocked) and the UI says so before writing; - when databases are unreachable the catalog is empty, so no columns are known: the
migration records a
missing-columnsconflict and writes no grants — under-granting beats silently allowing every column. Re-run the migration once the databases are back; - the outcome (ok / reason / backup path) shows up in the
migrationfield of the runtime status call.
Users & orgs
Organizations and members live in local SQLite, so this page works even when GraphJin is stopped:
- a member's role is the GraphJin role name; changing it writes straight back to SQLite;
- Sync roles to GraphJin adds the roles used by members to
roles— grants that reference an unknown role are rejected (role "x" is not defined in roles); - the role selector accepts new names (allow-create), so you need not create the role in the permission matrix first;
- MCP access tokens can be issued per member (12 hours by default); external clients then
authenticate to the platform gateway with
Authorization: Bearer; - members can be edited (name / email); the
×on an org chip deletes it, and the backend refuses while the org still has members.

Policy preview
Reads the effective role policy from get_current_config and diffs it against the
pending matrix. The database selector at the top decides which database you compare, and
opening this page directly loads the schema for you.

Settings
Backend port, bundled GraphJin version and cached platforms, copyable version info. The UI switches between 中文 / English (top right) and remembers the choice.

Requirements
| Dependency | Version / notes |
|---|---|
| Node.js | >= 22.5 (the backend uses node:sqlite) |
| npm | ships with Node |
| GraphJin binary | the v3.21.14 tarballs are committed and extracted at build time; see step 3 of "Local startup" |
| Browser (optional) | verify:ui drives a local Edge / Chrome |
| Docker (optional) | only needed for the bundled test databases (Docker + compose v2) |
Local startup
0. Complete startup commands (recommended)
From the project root (the directory containing package.json), run:
# Windows PowerShell example; use your real path on macOS / Linux
cd D:\Code\GitHubs\build-mcp-server-4-any-db
# 1. install dependencies (first time only)
npm install
# 2. prepare and verify the GraphJin binary (first time only; fetch first if the tarball is missing)
npm run prepare:binaries
npm run smoke:binaries
# 3. optional: create a demo SQLite database when you have none
npm run demo:db
# 4. one command: Vite + Electron + Node backend
npm start
npm start does four things:
- starts the Vite dev server (
127.0.0.1:1420); - waits for Vite, then starts Electron;
- Electron starts the Node backend in-process and injects its dynamic port into the page;
- on window close (Windows / Linux),
Cmd+Q(macOS) orCtrl+C, shuts down Electron, the backend and Vite together.
Process chain: npm start → Vite (1420) → Electron → Node backend; GraphJin is started by
the backend when you click Start in the UI.
Once the window is open, GraphJin still has to be started from the UI, because it needs the database connection you enter:
- open Connections, fill in the connection.
- no database yet: run
npm run demo:db, then choose SQLite, file pathprojects/quickstart/demo.db, project directoryprojects/quickstart; - existing database: SQLite points at a
.dbfile; MySQL / PostgreSQL etc. need host, port, database, user and password; - Project directory: something like
projects/demo;
- no database yet: run
- click Test connection, then Start;
- check Schema browser, then configure permissions in Permission matrix.
The equivalent two-terminal way (use either this or npm start):
# terminal 1
npm run dev
# terminal 2 (wait until terminal 1 prints Local)
npm run electron:dev
Use either way; npm start simply chains the two steps.
Startup-related commands:
| Command | Purpose |
|---|---|
npm start |
Vite + Electron + Node backend (recommended) |
npm run dev |
Vite only (127.0.0.1:1420) |
npm run electron:dev |
Electron + backend only; Vite must already be running |
npm run backend |
Node backend only (browser-only mode) |
npm run demo:db |
create a demo SQLite database |
npm run prepare:binaries |
extract GraphJin for the current platform |
npm run smoke:binaries |
execute GraphJin version as a smoke test |
npm run dist:win / dist:mac / dist:linux |
build the matching installer |
The sections below explain each step, browser-only mode and common problems.
1. Requirements
| Dependency | Requirement |
|---|---|
| Node.js | >= 22.5, 24.x recommended (the backend uses built-in node:sqlite) |
| npm | ships with Node |
| GraphJin binary | extracted from graphjin-binaries/ at build time, see step 3 |
| Free port | Vite always uses 127.0.0.1:1420; the backend and GraphJin pick free ports |
| Docker (optional) | only needed for the bundled test databases |
Check the version first:
node -v # must be >= v22.5.0
npm -v
2. Install dependencies
From the repository root:
npm install
Electron downloads a ~100 MB runtime on first install. If that is slow or blocked by a proxy, set a mirror and retry:
# Windows PowerShell $env:ELECTRON_MIRROR = "https://npmmirror.com/mirrors/electron/" npm installYou can also point
HTTPS_PROXY/HTTP_PROXYat a local proxy.
3. Prepare the GraphJin binary
If the repository already contains graphjin-binaries/v3.21.14/*.tar.gz, just extract the
binary for the current platform:
npm run prepare:binaries
If the tarball is missing, download it first and then extract:
# platform: windows-amd64 / windows-arm64 / linux-amd64 /
# linux-arm64 / darwin-amd64 / darwin-arm64
# replace windows-amd64 with your own platform key
npm run fetch:binaries -- --only windows-amd64
npm run prepare:binaries
Verify that it really runs:
npm run smoke:binaries
# expected: PASS windows-amd64 ... GraphJin 3.21.14
The extracted file lands in binaries/graphjin-<target-triple>[.exe].
Set GRAPHJIN_BIN to use a custom executable.
4. Start the desktop app (two terminals)
Use two terminals: start Vite first, then Electron. You can also run the single
npm start command from step 0 instead.
Terminal 1:
npm run dev
Wait until it prints Local: http://127.0.0.1:1420.
Terminal 2:
npm run electron:dev
Electron then:
- starts the Node backend in-process on a dynamic port;
- injects that port into the renderer through launch arguments;
- opens the desktop window pointing at the Vite page.
The window appearing means startup succeeded. On Windows / Linux closing it stops
GraphJin and the backend before exiting; on macOS closing it only hides the window, use
Cmd+Q to quit. Development data lives under Electron's userData/data (on Windows this
is usually %APPDATA%\mcp-builder\data).
The window title carries the current project name (the app name passed at start, stored as
app_name in the project's dev.yml), e.g. Demo Finance & Inventory — MCP Server with Ontology Build Platform. On Windows
the native title bar is hidden, so the name is centred on the custom 40px title strip; with
no project open it falls back to the product name.
5. Browser-only debugging (optional)
If you do not want Electron, start the frontend and backend manually in two terminals:
Terminal 1:
npm run backend
It prints one ready JSON line; note the port:
{"jsonrpc":"2.0","method":"ready","params":{"port":50123,"pid":12345}}
Terminal 2:
npm run dev
Open http://127.0.0.1:1420, go to Settings, enter the port from the ready line and click Save and connect. The header shows "backend online" once connected.
In browser mode data lives in sidecar-backend/data. Keep the npm run backend process
running; the UI reports the backend as offline after it stops.
6. First-run flow
- Connections: enter a name, type and connection details.
- no database: run
npm run demo:dbfirst, then pick SQLite, file pathprojects/quickstart/demo.dband project directoryprojects/quickstart; - SQLite: choose File path and point at an existing
.dbfile; - MySQL / PostgreSQL etc.: fill host, port, database, user, password;
- Project directory: e.g.
projects/demo(relative to the repository root in development; prefer an absolute path in the packaged app). GraphJin writesdev.ymlthere.
- no database: run
- Click Test connection. A successful test saves the connection locally.
- Click Start. The backend creates/merges
dev.ymland starts GraphJin. - Open Schema browser and confirm tables, columns and relationships were discovered.
- Open Permission matrix, configure source access first (read / write / delete modes, owner column, table classes), tick the roles allowed into this database (the role → database allowlist), then add roles and their read rules (row filters, column control). Apply to GraphJin shows a diff first and snapshots the policy before writing.
- Open Runtime to see the endpoint, probe health and copy the MCP client config.
adminis a reserved platform role: it is not part of the matrix, the platform never writes restrictive rules for it, and a rollback never removes it.
7. Stopping
- Desktop app: on Windows / Linux closing the window stops GraphJin and quits; on macOS
closing the window only hides it, use
Cmd+Qto quit. - Browser mode: click Stop on the Runtime page, then
Ctrl+Cthe backend terminal. - If a terminal was killed, check for a leftover
graphjinprocess holding a port.
8. Troubleshooting
| Symptom | Fix |
|---|---|
npm run dev fails with EADDRINUSE / port 1420 in use |
kill the old Vite process, or find the PID with netstat -ano | findstr :1420 (Windows) and stop it |
| Electron window is blank | make sure terminal 1 printed Local: ... first; optionally set MCP_BUILDER_DEV_URL=http://127.0.0.1:1420 |
| Header says the backend is offline | in browser mode the port is wrong or npm run backend is not running; http://127.0.0.1:<port>/health should return {"ok":true,...} |
| "GraphJin binary not found" | run npm run prepare:binaries and npm run smoke:binaries, or point GRAPHJIN_BIN at the executable |
electron:dev fails with Cannot read properties of undefined (reading 'isPackaged') |
ELECTRON_RUN_AS_NODE=1 is set, so Electron runs as Node; unset it and retry |
| GraphJin exits immediately after start | check the logs on the Runtime page and the project's dev.yml; common causes are port conflicts, unreachable databases or missing connection fields |
node:sqlite errors |
Node is older than 22.5; upgrade Node and re-run npm install |
| Saving a password-protected connection fails | make sure keystore.key exists and is readable in the data directory; lost keys mean old connections must be re-entered |
fetch:binaries fails |
make sure curl exists and GitHub is reachable, or put the official tarball into graphjin-binaries/<version>/ manually |
9. Local verification (optional)
npm test # frontend policy tests + backend unit tests
npm run smoke:binaries # GraphJin binary smoke test
npm run build # production web build
npm run verify:ui # real backend + headless Edge (97 checks)
Full end-to-end verification (starts GraphJin for real, creates databases, writes permissions and rolls back):
cd sidecar-backend
npm run verify:e2e # 24 checks
npm run verify:migration # 12 checks: legacy migration, including an unreachable database
Build installers
npm run dist:win # Windows NSIS
npm run dist:mac # macOS dmg + zip (run on macOS)
npm run dist:linux # Linux AppImage + deb (run on Linux)
All output lands in release/. Every dist:* script first runs npm run check:binaries, which fails fast when binaries/graphjin-<triple> for the current platform
is missing (it points you at fetch:binaries + prepare:binaries), so you never ship an
installer without GraphJin. The matrix in .github/workflows/build.yml packages on
Windows / macOS 13 / macOS 14 / Ubuntu; CI has no signing certificates, so the artifacts are
unsigned.
To sign on macOS, set electron-builder's standard environment variables:
# macOS: certificate + notarization
CSC_LINK=/path/to/dev-id.p12 CSC_KEY_PASSWORD=... \
APPLE_ID=... APPLE_APP_SPECIFIC_PASSWORD=... APPLE_TEAM_ID=... \
npm run dist:mac
Windows code signing
Signing lives in electron-builder.config.js and is driven entirely by
environment variables. With no certificate configured, the build skips signing
(win.signExecutable: false) and prints 跳过 Windows 代码签名; nothing else changes.
| Variable | Purpose |
|---|---|
MCPB_WIN_CERT_FILE |
path to the .pfx / .p12 certificate |
MCPB_WIN_CERT_PASSWORD |
certificate password |
MCPB_WIN_CERT_SUBJECT |
subject name, when the certificate already sits in the Windows store |
MCPB_WIN_TIMESTAMP_URL |
RFC 3161 timestamp server (default: electron-builder's digicert) |
WIN_CSC_LINK / CSC_LINK (base64 or path) still work as a fallback. The password is handed
to CSC_KEY_PASSWORD — the only password variable electron-builder 26 reads, so setting
WIN_CSC_KEY_PASSWORD alone has no effect.
Self-signed certificate for local testing (npm run sign:cert, Windows only; the key lands in
build/signing/, which is git-ignored):
npm run sign:cert
$env:MCPB_WIN_CERT_FILE = "build/signing/mcp-builder-selfsigned.pfx"
$env:MCPB_WIN_CERT_PASSWORD = "mcpb-selfsigned-dev"
npm run dist:win
Check what actually got signed. A self-signed certificate reports Status: UnknownError with
an UntrustedRoot chain status — the signature is present and valid, only the root is not
trusted:
Get-AuthenticodeSignature "release/win-unpacked/MCP Server with Ontology Build Platform.exe" |
Format-List Status, SignerCertificate
Self-signing does not silence SmartScreen; public releases need a trusted OV/EV certificate.
Timestamping talks to digicert, so set $env:ELECTRON_BUILDER_OFFLINE = "true" when building
offline.
Local test databases (Docker)
The repo ships
docs/docker-compose-4-test-db-connection.yml:
four free-tier databases in one command, for exercising the driver list on the
Connections page (Oracle is commented out — the image is big).
docker compose -f docs/docker-compose-4-test-db-connection.yml up -d
docker compose -f docs/docker-compose-4-test-db-connection.yml ps
docker compose -f docs/docker-compose-4-test-db-connection.yml down
| Database | Port | User | Default database |
|---|---|---|---|
| MySQL 8.0 | 3306 | root | testdb |
| PostgreSQL 16 | 5432 | test | testdb |
| MongoDB 7.0 | 27017 | test | — |
| SQL Server 2022 | 1433 | sa | — |
| Oracle 23 Free (commented) | 1521 | test | FREE |
Passwords are not duplicated here — take them from the environment block in the yml
(MYSQL_ROOT_PASSWORD, POSTGRES_PASSWORD, MONGO_INITDB_ROOT_PASSWORD, SA_PASSWORD,
ORACLE_PASSWORD). Pick the matching type on the Connections page, use host 127.0.0.1
with the port / user / password from the yml, then click "Test connection". To change a
password, edit the yml and recreate the container. To use Oracle, uncomment the block
(gvenzl/oracle-free:23.4-slim) and give it at least ~4 GB of memory.
These containers are local test fixtures only: credentials are plain text in the file, no volumes are mounted (
restart: no), and data is dropped on stop. They also start empty — create tables before expecting anything in the Schema browser.
The GraphJin binary
At build time the tarball in graphjin-binaries/<version>/ is extracted and renamed to
graphjin-<target-triple> inside binaries/ (packaged into
resources/binaries/ via extraResources).
# download official release assets and verify sha256 (needs network and curl)
npm run fetch:binaries -- --only windows-amd64
# extract and rename the binary for the current platform
npm run prepare:binaries
# really execute graphjin version and check it (CI runs this on all three platforms)
npm run smoke:binaries
Version and checksums live in graphjin-binaries/version.json; measured GraphJin
behaviour is documented in
docs/graphjin-3.21.14-baseline.md (Chinese).
Data and security
| Item | Location |
|---|---|
| Data directory | userData/data when packaged; sidecar-backend/data for npm run backend |
| Users / saved connections / policy snapshots | mcp-builder.db inside it (override: MCP_BUILDER_DB) |
| Encryption key | keystore.key inside it (override dir: MCP_BUILDER_DATA_DIR) |
| Connection templates | db-templates.json inside it |
| GraphJin project | the "project directory" from the Connections page, e.g. projects/app/dev.yml |
- The connection
payloadis encrypted with AES-256-GCM (reusing GraphJin's keystore key); passwords and connection strings are never stored in clear text, and the list endpoint only returns host / port / dbname / user / path summaries. - If
keystore.keyis lost, old records cannot be decrypted: the UI marks them "re-enter required" and still restores the non-sensitive fields. - Policy snapshots store role read rules and source access modes as plain JSON (no database credentials); the 30 most recent snapshots per project are kept and can be restored from the permission matrix's Write history dialog.
Verification
cd sidecar-backend
npm test # backend unit tests (378)
npm run verify:e2e # real end-to-end: start → discover → write → rollback (24)
npm run verify:migration # legacy migration: roles/columns, degrade, unreachable DB (12)
cd ..
npm run test:frontend # policy normalization / diff + i18n key parity (22)
npm run smoke:binaries # execute graphjin version for real
npm run build
npm run verify:ui # real backend + headless Edge: locales, window title, pinned sidebar / expanded by default / tooltip / collapse + remembered, orgs/members, write/verify/rollback, per-db tabs, MCP probe + call examples, bottom-right floating button present / opens, usage wizard open/close/reopen/jump, status fallback, schema reset after delete, welcome / connect / demo / diagnostics, offline policy read from dev.yml, JSON-arg unwrapping, ontology consistency check reporting stale references, drafting candidates from the schema, drafting scoped to the database selected on the page (not the Schema page one), example evaluation passing structure and coverage, enforced-rule compilation reporting impossible rules, catalog-only handshake, search and object profiles, the demo building three sample databases with a role each and querying the maintenance faults through GraphQL, the five wizard nodes walked end to end on the demo project (connect / permissions / verify / ontology / plug into AI), and the role-to-database allowlist really denying an unchecked role (97)
npm run verify:ui -- --shots=docs/screenshots # regenerate both locale screenshot sets
verify:ui starts its own backend and creates two SQLite databases (app /
analytics); no manual setup required.
Project layout
electron/ Electron main process, preload (injects the backend port)
src/ Vue 3 renderer
views/ ten pages (lazy-loaded routes)
locales/ zh-CN / en-US copy
stores/app.js Pinia: service state, schema, permission matrix, snapshots
sidecar-backend/ Node backend
src/ JSON-RPC, GraphJin client, permission planner, legacy migration,
snapshots, connections
test/ node:test suites
scripts/ real-machine verification scripts
scripts/ local startup, demo DB, binary prep / smoke, UI smoke test
.github/workflows/ four-platform packaging CI
docs/ baseline notes, migration design, feature matrix, UI screenshots
build/ app icon: icon.png (1024×1024, converted to ico / icns when packaging)
binaries/ GraphJin binaries (extracted at build time)
Known limitations
- Installer signing / notarization is not wired up: CI produces unsigned artifacts, and macOS needs a manual first-launch approval;
- source mode has no per-table write switch: write / delete are database-level, and
grants[].columnsonly constrains reads — write column allowlists are not enforced (docs/graphjin-source-migration.md§2.2); - roles have no table visibility: within a database, tables absent from grants stay fully readable for authenticated roles, so blocking tables has to use the "admin only" / "blocked" table classes; the role → database allowlist only scopes whole databases;
gj_securityneeds an admin JWT, so the source of truth for policy is the MCP toolget_current_config;dev.ymlmerging understands this project's output, flat single-line flow arrays, quoted keys and GraphJin's rewritten file, but is not a general YAML parser: anchors / aliases / merge keys or nested flow values (e.g.access: {...}) insidesources:are rejected with an explicit error instead of silently corrupting the file;- when databases are unreachable the migration cannot read columns and writes no grants
(a
missing-columnsconflict); re-run the migration after the databases come back; - non-Windows coverage is currently the CI binary
versionsmoke; the full UI smoke script still requires Windows + Edge.
The full done / not-done matrix is in docs/FEATURES.md (Chinese).
Author
Zhen (Evan) Wang
- Email: 18901599114@163.com
- Tel: +86 18901599114
- WeChat: +86 18901599114
Common Errors
GraphJin didn't start or graphjin idle
-
「Connections」→ Start one Connection, it will start GraphJin automatically; The graphjin idle change to graphjin live.
-
If the Step 1 doesn't work, you need to verify the binary whether can work or not manually Based on win11:Enter into build-mcp-server-4-any-db\binaries folder and run cmd.exe
npm run prepare:binaries
graphjin-x86_64-pc-windows-msvc.exe serve
License
MIT — see LICENSE. Use, modify and redistribute freely, including commercially, as long as the copyright notice and the permission notice stay with the copies; the software comes with no warranty.