A data-layer ecosystem for the Model Context Protocol — a reactive client and the governance, testing, and fixture tooling built around it. Same shape as the GraphQL world (Apollo Client + a gateway + schema checks + mocking), but for MCP.
This repo is an npm-workspaces monorepo. The packages share one core (mcp-query) and
compose along a clean seam (an interceptor chain + a transport tap), so each does one job
and they stack:
┌─────────────────────────────────────────────┐
your app / agent host ──▶│ mcp-query │──▶ MCP servers
│ reactive client · cache · codegen · core │
└─────────────────────────────────────────────┘
▲
┌──────────┬──────────┬──────────┬───────┴──┬──────────┬──────────┐
┌─────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
│ mcp-gate│ │contract│ │ lint │ │ docs │ │ bench │ │ record │
│ govern │ │ guard │ │ lint │ │generate│ │ measure│ │ freeze │
│ runtime │ │ drift │ │ quality│ │ref docs│ │ latency│ │ traffic│
└─────────┘ └────────┘ └────────┘ └────────┘ └────────┘ └────────┘
└──────── share capture / connect (the surface) ───────┘
| Package | What it does | When you reach for it |
|---|---|---|
| @mcp-query/cli | The unified mcpq CLI: one entry point over every tool below (mcpq lint/docs/bench/…), plus a server registry (mcpq add, honoring the .mcp.json/mcpServers standard) and client verbs (mcpq tools/call/read) to drive any registered server. |
You want one command for the whole toolkit and to call your MCP servers by name from the terminal. |
| mcp-query | The reactive, cached, embeddable MCP client: TanStack-Query-style document cache, RTK-Query tags, LSP-client lifecycle, React hooks, codegen, an interceptor chain, and optional server-side modules (gateway, metrics, OTel, sessions, Redis L2). | You're consuming MCP servers from an app or backend and want a real data layer, not raw SDK calls. |
| @mcp-query/gate | A config-driven security/policy proxy. Fronts many upstreams as one governed endpoint: declarative authorization, DLP redaction, rate-limit, circuit-breaking, audit. | You're handing MCP servers to an agent and need a runtime choke point — allow/deny, scrub secrets, log everything. |
| @mcp-query/contract | Contract testing / drift detection. Pin a server's capability surface, then fail CI when a live server changes incompatibly (with proper input/output variance). The dual of codegen. | You generated/wrote code against an MCP server and want CI to catch breaking drift before it ships. |
| @mcp-query/lint | Quality lint (ESLint for MCP). Check a single surface against design rules — descriptions, annotations, typed inputs, naming — and gate CI on it. | You're authoring an MCP server and want a quality bar enforced in CI. |
| @mcp-query/docs | Reference docs (Redoc for MCP). Render Markdown docs from a live server or a contract: tool arg tables, annotation badges, resources, prompts. | You want always-current reference docs for an MCP server, generated not hand-written. |
| @mcp-query/bench | Benchmarking. Latency (p50/p95/p99) + throughput per tool, with perf budgets that fail CI. Local or hosted servers. | You want to track an MCP server's performance or gate on a latency budget. |
| @mcp-query/record | Record / replay (VCR for MCP). Capture real server traffic to a cassette, replay it offline as a deterministic mock. | Your tests/demos need a server's real output but fast, offline, and frozen. |
Reference applications that prove you can build real product UIs on MCP — each chosen to
exploit a different MCP-native capability REST/GraphQL lack. They share a spine (apps/shared:
the WS proxy, transport, OAuth, schema-form, and React glue).
| App | What it shows | Stack |
|---|---|---|
| inspector | Protocol debugger — raw message log, manual sampling, OAuth stepper, cache view | Web Components |
| socialgpt-studio | One backend, two consumers — a creator-analytics UI over the live OAuth-gated SocialGPT tool surface an agent also uses | React, Deno desktop (+ token-injecting backend proxy) |
| console | Capability discovery — a polished operator UI auto-generated from any server's tools/resources/prompts | Web Components |
| ops-cockpit | Aggregation + live tiles — a NOC dashboard over many servers, reactive on health + list_changed |
React |
| approvals | Human-in-the-loop — agent sampling/elicitation proposals approved/edited in a queue, on the InteractionBroker |
React |
| notebook | Subscriptions — a notes UI where agent and app share one live view via resources/subscribe |
React |
| composer | Tools as input — a chat where the user drives MCP tools to assemble grounded input (the inverse of agentic tool use), with a pluggable model picker via ai.matey | React |
| prompt-studio | Prompts as a product surface — run server prompts with live completion/complete typeahead (incl. dependent completions), expand resource templates into subscribed reads, over codegen-typed hooks |
React |
| switchboard | One governed endpoint, many tenants — an @mcp-query/gate sidecar fronting local + live remote upstreams, an interceptor trace waterfall, and per-tenant cache partitions via client.scope() |
React |
Browser apps reach stdio servers through apps/shared's WebSocket proxy (the dev script runs
it alongside Vite); the React apps dogfood mcp-query's React hooks, the Web-Components apps the
framework-agnostic core.
![]() ops-cockpit — a NOC dashboard with live health tiles over many servers at once. |
![]() socialgpt-studio — creator analytics over a live, OAuth-gated MCP server. |
![]() inspector — a protocol debugger with the raw JSON-RPC message log. |
![]() composer — tools as input: a user-driven, grounded chat. |
Each app's README has a full Screenshots section.
- One core, composable seams.
mcp-gateis justmcp-query'sMCPClientbehind itscreateGateway, with an interceptor stack.mcp-recordtaps the sameinstrumentTransportseam the devtools use.mcp-contract's mock andmcp-record's replay both build on the sharedMockMCPServer. - One capture, four uses.
mcp-contractcaptures a server's surface;mcp-lintandmcp-docsreuse that samecaptureContract— to grade the surface and to document it. Pin it (contract), lint it (lint), document it (docs). - contract vs lint: contract is relative (did it change incompatibly between two versions?); lint is absolute (is this one version well-designed?). Run both in CI.
- contract vs record: a contract pins the shape (schemas/annotations) to catch drift; a cassette freezes the real results for offline replay. Use both — contract in CI, cassettes in tests.
One entry point over the whole toolkit, a server registry, and a terminal MCP client:
# register a server once (stdio or hosted; honors ~/.mcp-query/servers.json + project .mcp.json)
mcpq add everything --command npx --args "-y @modelcontextprotocol/server-everything"
mcpq add linear https://mcp.linear.app/mcp # hosted
mcpq login linear # browser OAuth (DCR+PKCE), token cached + auto-refreshed
mcpq servers # list them
mcpq import claude # pull servers from Claude/Cursor/VS Code configs
# drive any registered server (by name) from the terminal
mcpq tools everything # list tools as typed signatures
mcpq call everything echo --message hi # flag style …
mcpq call everything 'get-sum(a: 2, b: 40)' # … or function-call style (coerced by inputSchema)
mcpq read everything file:///x · mcpq ping everything
mcpq session everything # interactive REPL on ONE live connection
mcpq call --daemon everything echo --message hi # keep-alive daemon reuses the connection
mcpq daemon status · mcpq daemon stop # across invocations (great for stateful stdio servers)
# every tool is a verb — and accepts a registered name
mcpq lint everything · mcpq docs linear --out API.md · mcpq bench everything --call echo:'{}'
mcpq contract snapshot everything --out api.json · mcpq gate ./gate.config.ts.mcp.json/mcpServers configs from Claude, Cursor, and VS Code are read natively (no secrets
stored — OAuth lives in ~/.mcp-query/oauth/). The individual mcp-* bins still work standalone.
npm install # install all workspaces
npm test # run every workspace's test suite
npm run build # build the publishable mcp-query package (dist/)
npm run typecheck # typecheck all workspaces
# work in one package
npm test -w mcp-query
npm test -w @mcp-query/gate
npm run dev -w @mcp-query/inspectorIn this monorepo the satellite packages consume mcp-query directly from its TypeScript
source (packages/mcp-query/src) for a zero-build dev loop; only mcp-query itself
emits a dist/ for publishing.
mcp-query is the publishable core (0.0.1); the gate / contract / lint / docs / bench /
record packages and the inspector are MVPs (private) tracking it. See each package's README
for specifics.



