Scan your whole stack
From OX Research Newsroom
Are you using @nest-mcp/client?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.0.0
@nest-mcp/client was last scanned on 30 Nov 2026 at version 2.0.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.0.0 LATEST | 30 Nov 2026 | No rules fired |
| 1.0.2 | 30 Nov 2026 | No rules fired |
| 1.0.1 | 30 Nov 2026 | No rules fired |
| 1.0.0 | 30 Nov 2026 | Not shown |
Findings for v2.0.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 2.0.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
@nest-mcp/clientA production-oriented, framework-neutral MCP client runtime for Node.js. It manages many named
upstream servers while keeping the official @modelcontextprotocol/client v2 Client available
for advanced protocol features.
It targets Node.js 22.13 or newer, ESM, TypeScript 7, and the official MCP client SDK >=2 <3.
AuthProvider and OAuthClientProvider pass-through for HTTPauto mode by default, with explicit legacy or pinned modesPriorDiscovery reuse@nest-mcp/core operation middleware, authorization, and lifecycle observationClientpnpm add @nest-mcp/client @modelcontextprotocol/client@2
import { createMiddleware, withLogging } from "@modelcontextprotocol/client";
import { McpClientRuntime } from "@nest-mcp/client";
const correlation = createMiddleware(async (next, input, init) => {
const headers = new Headers(init?.headers);
headers.set("x-runtime", "artifact-agents");
return next(input, { ...init, headers });
});
const runtime = new McpClientRuntime({
clientInfo: { name: "artifact-agent-runtime", version: "1.0.0" },
servers: [
{
name: "knowledge",
transport: {
kind: "http",
url: "https://mcp.example.com/mcp",
authProvider: {
token: async () => process.env.MCP_ACCESS_TOKEN,
},
middleware: [correlation, withLogging({ statusLevel: 400 })],
},
},
],
});
await runtime.connect("knowledge");
const { tools } = await runtime.listTools("knowledge");
const result = await runtime.callTool("knowledge", {
name: tools[0]!.name,
arguments: { query: "MCP runtime architecture" },
});
await runtime.close();
When a host dynamically composes discovered tools, convert the remote JSON Schema into a real Zod v4 schema instead of asserting it into a package-local type:
import { createMcpClientToolSchema } from "@nest-mcp/client";
const { tools } = await runtime.listTools("knowledge");
const inputSchema = createMcpClientToolSchema(tools[0]!.inputSchema);
const parsed = inputSchema.parse(candidateArguments);
Zod v4 implements Standard Schema and Standard JSON Schema, so the returned schema also works
directly with vendor-neutral consumers. The schema's Zod refinement delegates the validation
predicate to the official MCP validator. This retains every Draft 2020-12 constraint, does not
apply annotations such as default as transforms, and returns successful values unchanged. The
detached remote definition is preserved as immutable Zod metadata and through the Standard JSON
Schema hook. Explicit non-2020-12 declarations fail during construction, and the returned schema's
projection methods reject requests for another target instead of relabelling 2020-12 keywords.
Structured-output validation stays on the exact McpClientRuntime.callTool() path with the
discovered toolDefinition.
middleware uses the official SDK's applyMiddlewares implementation. A custom fetch can be
provided as the base of that chain. Authentication is passed directly to
StreamableHTTPClientTransport; the runtime does not copy tokens into snapshots or lifecycle
events.
For machine-to-machine OAuth, the package re-exports the official v2 providers:
import { ClientCredentialsProvider, McpClientRuntime } from "@nest-mcp/client";
const authProvider = new ClientCredentialsProvider({
clientId: process.env.MCP_CLIENT_ID!,
clientSecret: process.env.MCP_CLIENT_SECRET!,
expectedIssuer: "https://identity.example.com",
scope: "mcp:tools mcp:resources",
});
const runtime = new McpClientRuntime({
servers: [
{
name: "secured",
transport: {
kind: "http",
url: "https://mcp.example.com/mcp",
authProvider,
},
},
],
});
PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider, CrossAppAccessProvider, the OAuth
discovery helpers, and the official typed OAuth errors are also available from the package root.
Interactive providers can be passed through in the same way; authorization redirects and durable
token storage remain host-application responsibilities.
Multi-tenant hosts should use the dedicated @nest-mcp/client/oauth surface instead of allowing
the transport to start an interactive SDK flow. The strict facade only accepts clients that were
provisioned out of band. It has no Dynamic Client Registration operation, requires exact resource
and issuer bindings plus PKCE S256, validates the RFC 9207 authorization-response issuer parameter
when advertised or returned, and re-checks every discovered or credentialed endpoint through host
policy.
import { McpClientOAuthProtocol } from "@nest-mcp/client/oauth";
const oauth = new McpClientOAuthProtocol({
// This must reject redirects, private/rebound addresses, oversized bodies, and timeouts.
fetch: ssrfGuardedOAuthFetch,
endpointPolicy({ endpoint, credentialed }) {
if (endpoint.port !== "" && endpoint.port !== "443") return false;
if (!allowedOAuthOrigins.has(endpoint.origin)) return false;
return !credentialed || credentialOrigins.has(endpoint.origin);
},
});
const authority = await oauth.discover({
serverUrl: "https://mcp.example.com/mcp",
resource: "https://mcp.example.com/mcp",
issuer: "https://identity.example.com/",
});
const started = await oauth.startAuthorization({
authority,
client: { clientId, authentication: { method: "none" } },
redirectUri: "https://studio.example.com/oauth/callback",
scopes: ["mcp:tools"],
});
// Persist `started.transaction` with authenticated encryption and browser-session binding.
// The plaintext state exists only in `started.authorizationUrl`; the record keeps its digest.
await savePendingAuthorization(started.transaction);
redirectUser(started.authorizationUrl);
On callback, parse the parameters, derive the state lookup digest, and atomically take the pending
transaction before calling exchangeAuthorization. A consumed transaction stays consumed even
when token exchange has an ambiguous network result. The facade validates state lifetime, callback
issuer, client identity, and the authority/endpoints pinned before redirect. When the authority
advertises RFC 9207, callbacks without the exact iss value fail closed. An unadvertised but
present iss is still compared exactly; omission is accepted only when the authority did not
advertise it. The facade never rediscovers an endpoint while redeeming a code.
The subpath also provides a revisioned credential-store port and
McpClientOAuthRefreshCoordinator. Refreshes for one opaque identity and exact revision share one
operation. Before dispatch, the store must atomically claim the exact revision with a durable
fencing token; another process observing that claim never sends the same refresh token. A rotated
refresh token is committed only by that claim owner. Retry-safe pre-dispatch failure can release the
claim explicitly, while an abandoned or indeterminate post-dispatch claim must become terminal and
must never reactivate the old generation. If the outcome becomes unknowable after a refresh request
may have reached the authorization server, the old generation is invalidated instead of replayed.
Terminal invalidation or an observed external disappearance can evict credential-bound client
leases. Successful rotation and a newer winner remain within the same stable binding and do not
invoke the terminal invalidation hook. Identity keys must be non-secret and include every immutable
host isolation coordinate. The coordinator awaits its invalidation hook while the failed request
may still hold that same lease, so a lease-eviction hook must initiate retirement and return without
awaiting active-lease drain; observe and report the eventual drain separately.
Create one McpClientOAuthAuthProvider per credential binding and close it with that binding's
runtime lease. The bridge implements only the SDK's minimal AuthProvider: it loads the current
generation before each request and delegates a 401 refresh to the coordinator, but has no
OAuthClientProvider methods that could trigger redirects or registration. Set the HTTP transport's
options.onInsufficientScope to "throw" so scope escalation returns to host policy instead of
starting an implicit interactive flow. The bridge follows successful token revisions inside one
stable owner/authority binding. A host that treats every token revision as a new runtime identity
must close or reacquire that runtime after the operation instead of pooling it under the old
revision.
The SDK's minimal onUnauthorized callback does not identify the failed request's credential
revision. For isolated concurrent operations, pass expectedCredentialRevision when constructing
each provider. Every credential load is fenced to that exact revision, including the load before
refresh. Concurrent failures for the same revision share the coordinator's refresh, but after
rotation the old operations fail with MCP_CLIENT_OAUTH_AUTH_PROVIDER_CREDENTIAL_REVISION_CHANGED.
A delayed failure cannot refresh the replacement credential. A fresh, authorized acquisition can
use the published revision; the host must not automatically replay a dispatched tool operation.
Omitting the option retains the binding-following behavior and requires the host to coordinate
long-lived or concurrent requests appropriately.
When the bridge is admitted through McpRuntimeManager, the ordinary ensureOnline() keeper is a
pool and does not meet that close-on-release condition. Use the manager operation option
{ leaseMode: "exclusive" } without retaining the generation: it rejects overlapping work for the
same key and closes the dedicated runtime plus admitted material before settlement. Shared manager
generations remain appropriate only when the host provides the request-correlated refresh boundary
and exact revision fence described above. Manager-owned exclusive catalog refreshes serialize their
protocol requests; a custom exclusive withClientRuntime callback must also avoid parallel
credentialed requests when it relies on this no-concurrency guarantee.
Encryption, AAD construction, owner/scope authorization, RLS, callback-session checks, and the
atomic pending-transaction store remain application responsibilities. OAuth fetches should use a
separate guarded path from arbitrary MCP middleware: request logging or middleware that can inspect
headers and form bodies can expose bearer tokens, client secrets, codes, or refresh tokens. Treat
returned id_token values as opaque unless a separate OIDC validator verifies them. The guarded
fetch must never automatically retry a credentialed token POST; one durable refresh claim permits
at most one wire exchange, and an ambiguous result must return to the coordinator unchanged.
const runtime = new McpClientRuntime({
servers: [
{
name: "local-files",
transport: {
kind: "stdio",
command: "node",
args: ["./dist/files-server.mjs"],
env: { MCP_ROOT: "/srv/artifacts" },
stderr: "inherit",
},
},
],
});
await runtime.connect("local-files");
The default factory returns the official StdioClientTransport class exactly. That matters for
the SDK's v2 automatic negotiation path, which can probe stdio through a short-lived sibling
process before opening the session process.
Prefer stderr: "inherit" or "ignore" for a noisy child. The runtime does not expose an owned
stdio transport before the handshake, so an unread "pipe" can fill and block the child. To capture
stderr, provide a custom transport factory that attaches a reader before returning the transport.
The built-in transport definitions cover Streamable HTTP and stdio. A standalone legacy SSE-only endpoint is not automatically detected or exposed as a first-class transport. OAuth transport authentication applies to HTTP; stdio credentials are an out-of-band concern for the spawned process and should be passed only through explicitly controlled configuration.
The repository's default test and verification commands never contact external services. To check the built package against a real Streamable HTTP or stdio server, run the package-local smoke command with environment-only configuration:
export MCP_SMOKE_TRANSPORT=http
export MCP_SMOKE_URL=https://mcp.example.com/mcp
export MCP_SMOKE_AUTH=bearer
export MCP_SMOKE_BEARER_TOKEN="$(read-token-from-your-secret-store)"
pnpm --filter @nest-mcp/client smoke:external
Machine-to-machine OAuth uses the official client-credentials provider and requires issuer binding:
export MCP_SMOKE_AUTH=oauth-client-credentials
export MCP_SMOKE_OAUTH_CLIENT_ID=smoke-client
export MCP_SMOKE_OAUTH_CLIENT_SECRET="$(read-secret-from-your-secret-store)"
export MCP_SMOKE_OAUTH_EXPECTED_ISSUER=https://identity.example.com
export MCP_SMOKE_OAUTH_SCOPE="mcp:tools mcp:resources"
pnpm --filter @nest-mcp/client smoke:external
For stdio, arguments are a JSON string array and only explicitly named environment variables are forwarded in addition to the official SDK's safe default environment:
export MCP_SMOKE_TRANSPORT=stdio
export MCP_SMOKE_COMMAND=node
export MCP_SMOKE_ARGS_JSON='["./dist/server.mjs"]'
export MCP_SMOKE_STDIO_ENV_NAMES=MCP_SERVER_TOKEN
export MCP_SERVER_TOKEN="$(read-token-from-your-secret-store)"
pnpm --filter @nest-mcp/client smoke:external
The command connects, calls server/discover on the modern session transport, uses legacy ping
only when that method is valid for the negotiated era, lists advertised tools/resources/prompts,
and emits only counts and protocol metadata. Set MCP_SMOKE_TOOL_NAME and
MCP_SMOKE_TOOL_ARGUMENTS_JSON to opt into a real tool call; its result is not printed and all
nested scalar argument values are treated as secrets in harness diagnostics. MCP_SMOKE_PROTOCOL
accepts auto (default), legacy, or a valid modern calendar date on or after 2026-07-28 to pin.
Additional HTTP headers can be supplied through MCP_SMOKE_HTTP_HEADERS_JSON; their values are
also treated as secrets in diagnostics.
MCP_SMOKE_TIMEOUT_MS bounds the active phase starting before any development build and covering
the MCP requests. On timeout, an active development build is terminated and
in-flight MCP work is aborted. Runtime teardown then has a separate shutdown bound of the same
duration, so cleanup can extend total elapsed time. Stdio stderr defaults to ignore. Setting
MCP_SMOKE_STDIO_STDERR=inherit sends the child output directly to the terminal, outside the
harness redactor; use it only with a trusted server that does not log credentials or payloads.
The command refuses to run when CI is set unless MCP_SMOKE_ALLOW_CI=true is also set, and it is
not referenced by the normal CI workflow. Use that override only in a trusted, explicitly
configured job backed by a secret store. Interactive browser OAuth is intentionally not automated
here; use a short-lived bearer token obtained by the host flow, while the hermetic interoperability
suite covers authorization-code, PKCE, state, issuer, and reconnect behavior.
Run node packages/client/scripts/external-smoke.mjs --help for every supported variable.
detectMcpClientAuthentication from @nest-mcp/client/oauth performs credential-free,
passive Streamable HTTP detection:
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.