Scan your whole stack
From OX Research Newsroom
Are you using @johnhenry/mcp-query?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.7.0
@johnhenry/mcp-query was last scanned on 27 Nov 2026 at version 0.7.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.7.0 LATEST | 27 Nov 2026 | No rules fired |
| 0.6.0 | 27 Nov 2026 | No rules fired |
| 0.4.0 | 23 Oct 2026 | No rules fired |
| 0.3.2 | 9 Oct 2026 | Not shown |
| 0.3.1 | 8 Oct 2026 | Not shown |
Findings for v0.7.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.7.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A reactive, cached, embeddable MCP client for ordinary (non-agentic) applications.
MCP is almost always consumed by LLM agents. But an MCP server is just a typed,
introspectable capability surface — tools, resources, prompts — and there's no
reason a normal app can't use it as a universal data/capability layer. mcp-query
gives such apps the developer experience that Apollo/React-Query gave GraphQL/REST
apps: hooks, a cache, reactivity, optimistic updates, devtools — on top of the
official v2 MCP SDK (@modelcontextprotocol/client).
MCP 2026-07-28 ready, v1 by default. Unconfigured connections speak the
classic 2025-era protocol byte-for-byte (no probe, no behavioral changes).
Opt into newer revisions per client or per connection with the additive
versions list:
new MCPClient({ servers, versions: ["2026-07-28", "2025-11-25"] });
// → probe via server/discover; speak 2026-07-28 where offered, fall back
// losslessly to v1 otherwise. A modern-only list (["2026-07-28"]) pins.
On a modern connection you get the full revision — multi-round-trip
elicitation/sampling through the same human-in-the-loop broker, change
notifications over subscriptions/listen, SEP-2549 ttlMs/cacheScope
cache hints, per-request logLevel — while legacy connections keep the
classic behavior (including session resumption). connection(name).era
tells you what was actually negotiated; versionNegotiation remains the
low-level escape hatch. Deprecated
surfaces (sampling/roots/logging per SEP-2577, sessions per SEP-2567, the old
tasks RPCs per SEP-2663) are annotated @deprecated and remain functional on
legacy connections. Tasks are reimplemented on the io.modelcontextprotocol/tasks
extension wire shapes. They work on legacy connections with any SDK and on
2026-07-28 connections with @modelcontextprotocol/client >= 2.3.0 (status is
poll-only on the modern era); see Tasks and SDK versions.
Status: published, working reference implementation.
mainis pre-2026-07-28: this package is at0.0.1, thelatesttag on npm, and speaks MCP 2025-11-25 (v1) only, on top of the official@modelcontextprotocol/sdk@^1.29.0.tsc --noEmitis clean and the full vitest suite passes (npm testfor the current count), including end-to-end coverage of the cache, multiplexing, protocol-driven invalidation, dynamic registration, reconnect, the human-in-the-loop broker, and Inspector-style tooling (message log, manual sampling, auth recorder, CLI) — all driven against a real SDK server over an in-memory transport, with the codegen CLI verified against the live@modelcontextprotocol/server-everything. A preview build with the 2026-07-28 migration (v2 SDK, dual-era support,versionsnegotiation) is in progress on PR #17, held until the spec finalizes on the 28th — try it via thercdist-tag:npm install @johnhenry/mcp-query@rc. See Supported protocol versions below.
npm install @johnhenry/mcp-query
This installs latest (0.0.1), which speaks MCP 2025-11-25 (v1) only. To preview
the in-progress 2026-07-28 migration ahead of its release, install the rc tag instead:
npm install @johnhenry/mcp-query@rc.
| npm tag | Version | Protocol | SDK |
|---|---|---|---|
latest (default, this branch) |
0.0.1 |
MCP 2025-11-25 only | @modelcontextprotocol/sdk@^1.29.0 (v1) |
rc |
0.1.0-rc.1 |
MCP 2025-11-25 + opt-in 2026-07-28 | v2 SDK, dual-era |
The rc preview (built from PR #17,
not yet merged to main) adds opt-in support for the finalized 2026-07-28 revision via
an additive versions list:
new MCPClient({ servers, versions: ["2026-07-28", "2025-11-25"] })
This probes each server with server/discover, speaks 2026-07-28 where the server
offers it, and falls back losslessly to 2025-11-25 (v1) otherwise; a modern-only list
pins (no fallback). Unconfigured connections — and everything installed from latest
today — keep speaking 2025-11-25 byte-for-byte, no probe.
@johnhenry/mcp-query/browser-bundle is one self-contained ES module for hosts that vendor or
sandbox their dependencies (no nested node_modules, no CDN resolution, no peer-dependency
surprises). The MCP SDK client, zod, and @johnhenry/agent-query-core are inlined, so a single
import makes a single request:
import { MCPClient, StreamableHTTPClientTransport, createGateClient } from "/vendor/mcp-query.browser.js";
// or, through a bundler / import map: "@johnhenry/mcp-query/browser-bundle"
const client = new MCPClient({
servers: { api: { transport: () => new StreamableHTTPClientTransport(new URL("https://example.com/mcp")) } },
});
await client.connect();
What is inside:
@johnhenry/mcp-query exports from its main entry (MCPClient, cache, router, interceptors, ...);StreamableHTTPClientTransport, SSEClientTransport, InMemoryTransport
(the Node-only StdioClientTransport is excluded; reach stdio servers through a bridge, below);@johnhenry/mcp-gate, its browser export condition:
createGateClient, compilePolicy, explainPolicy, policyListAnnotator, policyListFilter,
validateGateConfig, redact, redactValue, resolveHttpUpstream, CircuitOpenError. The gateway
Server (createGate) and stdio upstreams are not included.What is not: the React hooks (@johnhenry/mcp-query/react) are not in this bundle. They need your
app's single copy of react, so they stay a normal module import with react external; this
bundle is the framework-free core. Types for the core and transports ship as
dist/browser/mcp-query.browser.d.ts; the gate's types come from @johnhenry/mcp-gate.
The existing export paths (., ./react, ./transports, ...) resolve exactly as before.
The bundle is built by npm run build (scripts/build-browser.mjs, esbuild, minified ESM,
es2022) and checked by test/browser-bundle.test.ts, which serves the single file to
Chromium, intercepts every request to prove nothing else is fetched, constructs an MCPClient
and connects it, plus a governed gate client, over an in-page transport. (The Chromium step needs
Playwright, which is not a dependency of this repo; it runs when require("playwright") resolves or
PLAYWRIGHT_MODULE points at an install, and is skipped otherwise.)
Sizes (regenerate with npm run size-table -w @johnhenry/mcp-query -- --write):
| File | Raw | gzip | brotli |
|---|---|---|---|
mcp-query.browser.js (minified, one file) |
559.7 KiB | 153.1 KiB | 106.5 KiB |
Where the raw bytes come from:
| Inlined package | Raw (minified) |
|---|---|
@modelcontextprotocol/client |
192.8 KiB |
@modelcontextprotocol/server |
129.2 KiB |
@johnhenry/mcp-query (core) |
90.9 KiB |
zod |
84.6 KiB |
@johnhenry/mcp-gate (browser parts) |
26.8 KiB |
@modelcontextprotocol/core |
16.0 KiB |
@johnhenry/agent-query-core |
7.8 KiB |
eventsource |
5.2 KiB |
eventsource-parser |
3.7 KiB |
pkce-challenge |
0.7 KiB |
A page has two ways to reach an MCP server: Streamable HTTP, directly (a remote server, or a local one that speaks HTTP), or through a local bridge for stdio servers.
import { MCPClient, StreamableHTTPClientTransport } from "@johnhenry/mcp-query";
const client = new MCPClient({
versions: ["2026-07-28", "2025-11-25"], // modern first, fall back to the 2025-era handshake
servers: {
api: {
transport: () =>
new StreamableHTTPClientTransport(new URL("https://api.example.com/mcp"), {
requestInit: { headers: { Authorization: `Bearer ${token}` } }, // or an authProvider (OAuth)
}),
},
},
});
The page's fetch is subject to CORS, and MCP's headers are all non-safelisted, so every request
is preflighted. A browser-reachable server (or the reverse proxy in front of it) must therefore
allow and expose the headers below. CORS is not defined by the MCP spec; this table is what the
2026-07-28 and 2025-11-25 Streamable HTTP pages require clients to send and read, which is
what CORS must let through.
| 2026-07-28 | 2025-era (2025-03-26 to 2025-11-25) | |
|---|---|---|
Access-Control-Allow-Methods |
POST, OPTIONS (GET and DELETE are removed; a server answers them 405) |
POST, GET, DELETE, OPTIONS |
Access-Control-Allow-Headers |
Content-Type, Accept, MCP-Protocol-Version, Mcp-Method, Mcp-Name, Authorization, plus one Mcp-Param-<Name> per x-mcp-header your tools declare |
Content-Type, Accept, MCP-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Authorization |
Access-Control-Expose-Headers |
WWW-Authenticate (OAuth discovery on 401) |
Mcp-Session-Id, WWW-Authenticate |
Access-Control-Allow-Origin |
the page's exact origin (echoed from an allowlist) + Vary: Origin |
same |
Details that matter:
MCP-Protocol-Version on every POST; Mcp-Method on every request;
Mcp-Name on tools/call, resources/read and prompts/get (Base64 =?base64?...?= encoded when the
value is not plain ASCII); and Mcp-Param-<Name> for each tool parameter whose inputSchema has an
x-mcp-header annotation (so {"x-mcp-header": "Region"} is sent as Mcp-Param-Region). A server must
validate them against the body and answers a mismatch with 400 and JSON-RPC error -32020. There is
no session id in this revision and nothing session-related to expose.cannot be wildcarded.**Access-Control-Allow-Headershas no prefix patterns, and its* does not coverAuthorization(and is ignored on credentialed requests), so list the header names your tools actually use, plusAuthorizationexplicitly. If the tool set is dynamic, echo the preflight's Access-Control-Request-Headers` back after checking each name against an allowlist.Mcp-Session-Id response header; the browser hides it
from JavaScript unless it is in Access-Control-Expose-Headers, and the client then sends it back as a
request header (so it is also in Allow-Headers). Without Expose-Headers: Mcp-Session-Id a
session-ful server appears to work for initialize and then fails on the next call. Last-Event-ID is
only sent when resuming an SSE stream.versions: ["2026-07-28", ...] the first request is a modern probe;
a legacy server's 400/404/405 then triggers the initialize fallback. CORS must be correct on
those error responses too (headers on non-2xx answers, not only on 200), or the browser reports an
opaque network error instead of the status and the fallback cannot tell what happened.OPTIONS on the MCP endpoint with 204, the Allow-* headers above, and
Access-Control-Max-Age (for example 600). Preflights do not carry Authorization, so do not
require auth on OPTIONS.Origin is still validated. The spec requires servers to reject requests with an invalid Origin
with 403 (DNS-rebinding defence). A CORS allowlist and that check should use the same list.401 should carry WWW-Authenticate (exposed, as above). The OAuth discovery documents
and the authorization server's token and registration endpoints are fetched by the page too, so they
need CORS as well. Run OAuth in the page with an authProvider (see instrumentAuthProvider).https page. Browsers may additionally require a private-network-access
opt-in on the preflight (Access-Control-Allow-Private-Network: true) and block http from https
as mixed content, with http://localhost / http://127.0.0.1 exempted. Check the browser versions
you target.A minimal Node reference (adapt the allowlist):
const ALLOWED = new Set(["https://app.example"]);
const HEADERS = "Content-Type, Accept, MCP-Protocol-Version, Mcp-Method, Mcp-Name, Authorization, Mcp-Param-Region, Mcp-Session-Id, Last-Event-ID";
function cors(req, res) {
const origin = req.headers.origin;
if (origin && !ALLOWED.has(origin)) return res.writeHead(403).end();
if (origin) {
res.setHeader("Access-Control-Allow-Origin", origin);
res.setHeader("Vary", "Origin");
res.setHeader("Access-Control-Expose-Headers", "Mcp-Session-Id, WWW-Authenticate"); // drop Mcp-Session-Id on 2026-07-28-only servers
}
if (req.method === "OPTIONS") {
res.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, OPTIONS");
res.setHeader("Access-Control-Allow-Headers", HEADERS);
res.setHeader("Access-Control-Max-Age", "600");
return res.writeHead(204).end();
}
}
A page cannot spawn a stdio server, so a local bridge relays JSON-RPC between a WebSocket and the
child process. The wire protocol (framing, how the target command is selected, token and Origin
checks, lifecycle, errors) is specified in docs/ws-stdio-bridge.md; the
reference implementation is apps/shared's startProxy and is pinned by tests. mcp-query does not ship
a bridge itself. Because the bridge spawns local processes on behalf of a web page, any
implementation must bind to loopback, check Origin, require a token and refuse to spawn anything it
was not explicitly told to allow; the doc lists the exact requirements. The reference bridge is safe by
default: Origin required and loopback-only, and no target allowed until you pass allowTargets (or the
named, warning-logging allowAnyTarget escape hatch).
The io.modelcontextprotocol/tasks extension (SEP-2663) is driven over raw
requests with mcp-query's own schemas (field names verified against the
ext-tasks v2 schema: ttlMs, pollIntervalMs, inputRequests, inputResponses).
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.