Skip to content

Examples across the family

Every repo in the family ships numbered examples under examples/NN-name.ts, runnable as npm run example:NN (or npx tsx examples/NN-name.ts) against an in-process mock — no network, no API keys, no subprocess. The two .tsx entries at the end of the mcp-query set are the exception: illustrative React/browser code that compiles but needs a bundler and DOM. This page indexes all of them by what you’re trying to do, since the interesting patterns (approvals, policy, invalidation) repeat across protocols.

The four sets:

Start here — the smallest useful program

Section titled “Start here — the smallest useful program”

Query a server’s tools and route across servers

Section titled “Query a server’s tools and route across servers”
  • mcp-query 01 · minimallistTools is a synchronous cache read after connect; callTool("server.tool", args) is namespaced.
  • mcp-query 04 · multi-server — one client multiplexing several servers: routing by namespace and by URI scheme, with isolated failure.
  • a2a-query 05 · multi-agent — one A2AQuery over several agents, tasks in flight on both, a mini dashboard rendered purely from cache snapshots.
  • acp-query 05 · multi-session — two sessions on one connection, prompts in flight simultaneously, updates interleaving on the wire.

The same InteractionBroker engine, applied per protocol:

Resilience: retries, flaky networks, connection status

Section titled “Resilience: retries, flaky networks, connection status”

Engine plumbing: interceptors and persistence

Section titled “Engine plumbing: interceptors and persistence”

The mcp-query monorepo also carries smaller example sets in its sibling packages — mcp-gate’s library mode, plus recorded-cassette and contract fixtures under mcp-record and mcp-contract — and cross-package examples at the monorepo root composing client + gate + record + contract in one flow.