Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(typescript): migrate client stack to MCP SDK v2 + slim deps (MCP-2601)#1837

Open
tonxxd wants to merge 14 commits into
canaryfrom
feat/client-sdk-v2
Open

feat(typescript): migrate client stack to MCP SDK v2 + slim deps (MCP-2601)#1837
tonxxd wants to merge 14 commits into
canaryfrom
feat/client-sdk-v2

Conversation

@tonxxd

@tonxxd tonxxd commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the @mcp-use/client stack (connectors, sessions, OAuth, React useMcp, browser client) plus the inspector, CLI, and agent from @modelcontextprotocol/sdk v1 to the official @modelcontextprotocol/[email protected] (MCP TypeScript SDK v2), and slims the client's dependency surface to a single runtime dep.

  • Automatic v1/v2 protocol detection. HTTP connections default to versionNegotiation: "auto" (probe with server/discover, transparently falling back to the 2025 initialize handshake against v1 servers); stdio defaults to "legacy". The negotiated era/version is surfaced on the connector, MCPSession, and the useMcp result. A single client now connects to both v1 and v2 servers seamlessly — no reliance on the v1 SDK.
  • API port. Method-string handlers, SdkHttpError/SdkError, OAuthError + OAuthErrorCode, Web Headers, client/stdio subpath, callTool/request signature changes. OAuth gains issuer-stamp round-tripping, discoveryState()/saveDiscoveryState(), and iss validation on the callback.
  • ESM-only @mcp-use/client (Node 20+); no longer re-exports Zod *Schema constants (use isSpecType / specTypeSchemas).
  • Dependency slimming. Removed posthog-js / posthog-node in favor of a fetch-only PostHog capture, and dropped @modelcontextprotocol/ext-apps (a single MIME constant was inlined). @mcp-use/client now has one runtime dependency (@modelcontextprotocol/client).
  • Consumers. Inspector migrated to @modelcontextprotocol/client (incl. CDN stdio stub alias and ext-apps v1/v2 Tool/CallToolResult boundary casts); CLI gains a --negotiate flag; agent aligned to v2 types.

Test plan

  • @mcp-use/client typechecks and builds (ESM); full unit suite 178/178 pass (incl. new protocol-era + OAuth-store round-trip tests; Node-25 localStorage/jsdom fixed via an in-memory Storage helper).
  • mcp-use, @mcp-use/agent, @mcp-use/cli, and @mcp-use/inspector (incl. the CDN bundle) typecheck and build.
  • pkg.pr.new preview publish (this workflow) succeeds and Deno PR-preview tests pass.
  • Follow-up (separate, cloud repo): consume the canary packages, add 2026 CORS headers on the gateway, and enrich gateway analytics from the v2 _meta envelope.

A changeset is included (@mcp-use/client major; inspector minor; agent/CLI patch).

khandrew1 and others added 8 commits June 29, 2026 16:12
Relocate top-level src/utils/ helpers next to their future package owners
ahead of the v2 package split:
- json-schema-to-zod/ -> client/
- url-sanitize.ts -> auth/
- assert, favicon-detector, proxy-config -> react/

Delete the dead utils barrel and drop the ./utils subpath export (also
removes favicon-detector/proxy-config from the main entry). No logic
changes. Part of MCP-2601.
…se 2)

Add empty package shells ahead of the v2 split:
- @mcp-use/client (base) and @mcp-use/agent (depends on @mcp-use/client)
- mirror @mcp-use/cli conventions: composite tsconfig, tsup + tsc
  declaration build, dual ESM/CJS exports
- wire both into the root tsconfig references; the packages/* glob
  auto-includes them in the workspace + build graph

Both build to dist (js/cjs/d.ts); the agent->client workspace link
resolves. No source moved yet. Part of MCP-2601.
…e 3)

Carve the MCP client out of mcp-use into its own leaf package, the third
phase of the v2 package split.

Moved into @mcp-use/client:
- client core (client.ts, client/base, browser), connectors (base/http/stdio),
  session, task_managers, config + config-file, code executors (vm/e2b),
  code-mode connector, elicitation helpers, json-schema-to-zod.
- Duplicated dependency-free leaves (logging, version, runtime, the telemetry
  set) per the agreed no-core-package strategy; the Day-9 telemetry split will
  collapse the duplicates.

Cutover:
- Repoint mcp-use src/index/tests and the CLI from the old in-package paths to
  @mcp-use/client; add a temporary mcp-use -> @mcp-use/client dependency to
  carry agent code still living in mcp-use until Phase 4.
- Remove the mcp-use "./client" subpath export and its tsup entries.
- Export config-file (loadConfigFile) and client/executors/base (tool-search
  types) from the client public surface.

Tests:
- Move the client-owned white-box unit tests (connectors, session,
  task_managers, config, code executor, client/connector telemetry) into the
  client package and stand up vitest there.
- Keep mcp-use-level tests in place, repointing their MCPClient/BrowserMCPClient
  imports and partial vi.mocks to @mcp-use/client so the mocks stay effective.

Build:
- Build client before mcp-use and exclude it from build:other so the foundation
  package is always built first.
- Add `rimraf dist` to the client build: tsup's clean leaves dist/.tsbuildinfo,
  which made composite tsc skip the .d.ts emit on no-change rebuilds.

Gate: build (incl. idempotent rebuild), client + mcp-use unit tests, and lint
all green.
Move the agent cluster out of the mcp-use server package into the
scaffolded @mcp-use/agent package and sever all agent re-exports from
the server. @mcp-use/agent depends on @mcp-use/client (the one legal
internal edge); the server no longer references the agent at all.

Moved into packages/agent/src: agents/, adapters/, managers/,
observability/, browser-agent.ts, and telemetry/utils.ts
(extractModelInfo). Agent code now imports logger/Telemetry from the
@mcp-use/client public surface; version.ts is duplicated as a
dependency-free leaf.

mcp-use (server):
- index.ts: drop MCPAgent/RemoteAgent, adapters, AI-SDK utils,
  ServerManager, manager tools, observability, and PROMPTS exports
- package.json: remove ./adapters, ./agent, ./browser/agent export
  blocks; drop now-unused langchain/langfuse peer deps and the
  @langchain/openai + ai devDeps (server has zero langchain/ai imports);
  remove dead agent integration/simple test scripts
- telemetry-node/telemetry-browser: getPackageVersion now resolves from
  ../version.js (telemetry/utils.ts moved to the agent)
- tsup.config.ts: drop adapters/agents node entries and browser-agent

agent:
- index.ts, tsup (browser-agent entry), tsconfig (tsBuildInfoFile),
  build script (rimraf dist prefix), vitest.config.ts
- package.json: workspace client dep, langchain peers, ai devDep (for
  the AI SDK interop test), and ported integration test scripts
- agent-telemetry.test.ts: stub Telemetry at the @mcp-use/client
  boundary and assert on trackAgentExecution input rather than reaching
  through the client's compiled dist to PostHog

Build (incl. idempotent rebuild), client/agent/mcp-use unit tests, lint,
and cross-package import boundaries all green.
…ase 5)

Split the React surface across its two homes and move all client-
connection OAuth into @mcp-use/client, keeping the server an island.

React:
- The useMcp connection console cluster (useMcp, McpClientProvider,
  storage providers, rpc-logger, useMcp-helpers, types, assert,
  favicon-detector, proxy-config) moves to @mcp-use/client/react.
- The view runtime (useWidget, useCallTool, useFiles, generateHelpers,
  widget providers/types) stays as mcp-use/react. No file is shared
  across the two clusters.

Auth (whole dir → client, deviating from the written "node stays in
server" plan):
- src/auth/ is entirely client-connection OAuth — node-provider/
  FileKVStore are consumed by the CLI acting as an MCP client, and the
  server's own OAuth is the separate src/server/oauth/. Moving the whole
  dir keeps mcp-use a true island instead of forcing a permanent
  mcp-use → @mcp-use/client dependency.
- Client exposes @mcp-use/client/auth (browser barrel) and
  @mcp-use/client/auth/node (node barrel).

client:
- New ./auth, ./auth/node, ./react export subpaths (tsup object entries
  + tsc rootDir:src layout, no src/ prefix); React as optional peer dep;
  react/jsdom/@types/react/react-test-renderer devDeps; tsconfig gains
  jsx:react + DOM.Iterable. Moved useMcp/auth white-box + jsdom tests in.
- Repointed the moved files' BrowserMCPClient self-import to the relative
  ../client/browser.js, and the moved tests' vi.mock target accordingly.

mcp-use (server):
- Dropped the ./auth + ./auth/node subpaths and the main-entry browser
  OAuth re-exports (breaking, expected in v2); react barrel now exports
  only the view runtime; browser.ts re-exports OAuth from
  @mcp-use/client/auth. Updated the browser/commonjs export-surface tests.

consumers:
- CLI: mcp-use/auth/node → @mcp-use/client/auth/node.
- inspector: console symbols → @mcp-use/client/react (added @mcp-use/client
  dep); MessageContentBlock stays on mcp-use/react; OAuth callback →
  @mcp-use/client/auth.

Build (incl. idempotent rebuild), client/agent/mcp-use unit tests
(170/86/358), lint, and cross-package boundaries all green. The react and
auth runtime seams to the server are resolved; the remaining
mcp-use → @mcp-use/client edges (index re-exports, browser.ts,
mcp-server dynamic import, proxy-client type) are the Phase 6 cleanup.
…ase 6)

`mcp-use`'s main entry is now the server surface only (MCPServer, OAuth
providers, session stores, stream managers, widget adapters, middleware,
helpers, telemetry, elicitation errors). The MCP client lives in
`@mcp-use/client`, the agent in `@mcp-use/agent`, and the MCP-UI view runtime
behind the `mcp-use/react` subpath.

Breaking (expected for v2):
- Removed the `mcp-use/server` subpath — its exports are now the main entry.
- Removed the `mcp-use/browser` subpath (zero external consumers); the browser
  client is `@mcp-use/client`'s `BrowserMCPClient`.
- Dropped all client/agent re-exports from the main entry.

Package boundary:
- `@mcp-use/client` is now an optional peer dep, reached only via a lazy
  `await import("@mcp-use/client")` in `MCPServer.proxy()` and marked external
  in tsup, so client code is never bundled into the server. The server depends
  on nothing else in the repo at runtime.
- Removed the dead `@e2b/code-interpreter` peer dep.

Consumers repointed: CLI, inspector, create-mcp-use-app templates, e2e
fixtures, deno import map, integration tests, JSDoc, and examples now import
server symbols from `mcp-use` and client symbols from `@mcp-use/client`.

Also resolves a pre-existing `window.openai` global collision (unrelated to the
split, previously masked by the incremental .tsbuildinfo cache): `@mcp-ui/server`
augments `Window.openai` with an incompatible `AppsSdkBridge` shape in the same
TypeScript project as the view runtime. The view runtime now reads the bridge
through a locally-typed `getWindowOpenAi()` accessor and exports the
`AppsSdkWindowOpenAi` type instead of re-declaring the global; the inspector uses
that exported type for its iframe host simulation.

Claude-Session: https://claude.ai/code/session_012RQjGLNsXpsxzN9uzkNUkF
…urable basePath, env consolidation (#1831)

* feat(typescript): mcp-use.json config schema + loader (MCP-2601, MCP-2613 P1)

Add the mcp-use.json project config: Zod schema + McpUseConfig/ResolvedConfig
types, a generated JSON Schema, and a zero-execution loader (walk-up discovery,
JSON.parse only, missing-file -> defaults) exposed via the new mcp-use/config
subpath. No CLI/server consumer wired yet -- non-breaking foundation for the
.mcp-use/ workspace + config-driven build (P2+).

* feat(typescript): .mcp-use/ workspace replaces dist/ (MCP-2601, MCP-2613 P2)

Move all per-project build output and runtime scratch out of dist/ into a
single gitignored .mcp-use/ workspace (the Next.js .next analog), derived from
one paths module (mcp-use/config resolveWorkspacePaths/resolveWorkspace):

  .mcp-use/build/      compiled server + views + public + manifest.json (outDir)
  .mcp-use/generated/  tool-registry.d.ts
  .mcp-use/cache/      dev/build scratch (vite entries, metadata extraction)
  .mcp-use/state/      sessions.json, tunnel.json
  .mcp-use/cloud/      link.json (deploy linkage)

mcp-use (server):
- new mcp-use/config paths API; the server resolves outDir from config at boot
  and serves built widgets/public from <outDir> instead of a hardcoded dist/
  (buildDir threaded through the widget ServerConfig carrier).
- session store default -> state/sessions.json; type generator -> generated/.
- dev widget cleanup scoped to cache/ so it no longer deletes sibling workspace
  dirs (build/generated/state/cloud).

cli:
- build writes to config.outDir (default .mcp-use/build); manifest renamed to
  build/manifest.json; entry detection + start fallbacks resolve under the
  build dir.
- tunnel subdomain split out of the manifest into state/tunnel.json (build
  output carries no mutable runtime state).
- project.json -> cloud/link.json; single .gitignore writer (utils/gitignore.ts)
  shared by deploy + link; dist dropped from ignores + tarball excludes.

Verified end-to-end: build + start of the mcp-apps example serves widgets from
.mcp-use/build (HTTP 200), dev scratch lands in cache/ and the workspace
survives cleanup, sessions resolve to state/. 330 mcp-use unit tests pass;
tsc + eslint clean on both packages.

Claude-Session: https://claude.ai/code/session_01C3bE7YbcBWy7nGKdcMxw6g

* refactor(typescript): rename mcp-use.json → mcp-use.config.json (MCP-2613)

The project config filename collided with the `mcp-use` package import: with
`baseUrl: "."` in tsconfig (very common — the example uses it), a bare
`import … from "mcp-use"` resolves to the sibling `mcp-use.json` FILE, which
breaks `mcp-use build` (esbuild bundle: "No matching export in mcp-use.json for
import MCPServer") and direct tsx execution. Renaming to `mcp-use.config.json`
avoids the collision (the extension probe never matches it) and matches the
`next.config.*` / `vitest.config.*` convention.

Changes the CONFIG_FILE_NAME constant (single source of truth; the loader reads
it), the two config tests that write the file, and doc comments.

Claude-Session: https://claude.ai/code/session_01C3bE7YbcBWy7nGKdcMxw6g

* feat(typescript): configurable basePath (MCP-2074, Phase 3)

Relocate the entire framework HTTP surface under a single configurable
basePath (default /mcp): MCP transport, widget/public assets, OAuth endpoints,
and the inspector all move under ${basePath}. Only /.well-known/* and
/favicon.ico stay at the server root. basePath is read solely from
mcp-use.config.json (NOT a runtime constructor field — it is build-time-baked
into widget HTML by the CLI, so a runtime-only override would mount routes
where no assets were baked; mirrors Next.js basePath).

- New config/base-path.ts: normalizeBasePath + widgetAssetBase/publicAssetBase
  route builders centralizing the ~18 hardcoded /mcp-use literals.
- Security: narrow the OAuth bearer guard from app.use("/mcp/*") to the EXACT
  transport paths, so public assets under ${basePath}/mcp-use/* and OAuth under
  ${basePath}/oauth/* are no longer trapped behind the bearer token.
- React: server injects window.__mcpServerUrl + __MCP_BASE_PATH__; drop the
  useWidget.ts suffix-strip that reverse-engineered the origin.
- Inspector fully basePath-aware: client reads __MCP_BASE_PATH__ via a new
  helper, serve-time asset-path rewrite, CLI dev auto-open/health/transport URLs
  prefixed; the inspector now serves only at ${basePath}/inspector.
- Startup [MCP] connect-hint logs print the resolved basePath, not a hardcoded
  /mcp.

Verified: all packages build clean; oauth guard-invariant + base-path unit
tests pass; live curl at default /mcp, custom /app, and root-mount.

Claude-Session: https://claude.ai/code/session_01C3bE7YbcBWy7nGKdcMxw6g

* chore(examples): enable the inspector in the mcp-apps example (MCP-2074)

Add `@mcp-use/inspector` as a devDependency so the example can run the
inspector (via `mcp-use dev` or `build --with-inspector`) under the new
configurable basePath. devDependency, not a runtime dep — the inspector is a
dev-only tool the SDK loads via optional dynamic import.

Claude-Session: https://claude.ai/code/session_01C3bE7YbcBWy7nGKdcMxw6g

* fix(typescript): correct P2 build-dir drift (MCP-2601)

Two spots still referenced the pre-P2 `dist/` build layout:

- cli/utils/tarball.ts: `dist` had fallen out of EXCLUDE_DIRS, so cloud
  upload tarballs re-shipped build output (tarball test asserted it was
  excluded and was failing). Re-added `dist`.
- inspector/server/tunnel.ts: read the tunnel subdomain from the stale
  `dist/mcp-use.json` manifest (nested `.tunnel.subdomain`). Now reads
  `.mcp-use/state/tunnel.json` via `resolveWorkspacePaths().tunnel`
  (top-level `subdomain`), matching where the CLI writes tunnel state.

Claude-Session: https://claude.ai/code/session_01C3bE7YbcBWy7nGKdcMxw6g

* feat(typescript): constructor-only config, MCP_USE_LOG_LEVEL, canonical URL resolution (MCP-2601 P4)

Removes mcp-use.config.json (loader, Zod schema, generated JSON schema)
in favor of MCPServer constructor options introspected off the imported
entry by the CLI. Consolidates DEBUG/MCP_DEBUG_LEVEL/VERBOSE into a
single MCP_USE_LOG_LEVEL (info|debug|trace) and adds the resolve-url
canonical-origin helpers (MCP_URL -> proxy headers -> host:port).

Includes review fixes: getHandler() now resolves the base URL from
MCP_URL like listen() (fixes localhost widget URLs and
localhost:undefined OAuth issuers on serverless), the serve-time widget
rewrite no longer pulls absolute assetPrefix/CDN URLs back to the
server origin, mcp-use build bakes the introspected serverBasePath into
widget HTML (favicon hrefs, __MCP_BASE_PATH__), and the vacuous
display-package-versions test suite is deleted. Adds the branch
changeset.

Claude-Session: https://claude.ai/code/session_016mTqhvE92xGhVy9nV7sT7G

* chore: drop the branch changeset for now

Claude-Session: https://claude.ai/code/session_016mTqhvE92xGhVy9nV7sT7G
…-2601)

Port @mcp-use/client and its React/browser surfaces, inspector, CLI, and
agent from @modelcontextprotocol/sdk v1 to @modelcontextprotocol/client
2.0.0-beta.2 with automatic v1/v2 protocol negotiation, and drop posthog-js /
posthog-node (fetch-only telemetry) and @modelcontextprotocol/ext-apps.

- versionNegotiation defaults: HTTP "auto" (probe server/discover, fall back to
  the 2025 handshake), stdio "legacy"; era/version exposed on connector,
  session, and useMcp. A single client connects to both v1 and v2 servers.
- OAuth ported to v2 (OAuthError, issuer stamp round-trip, discoveryState, iss
  validation). ESM-only; no Zod *Schema re-exports.
- Telemetry now posts to PostHog via fetch only; ext-apps' single MIME constant
  inlined. @mcp-use/client has one runtime dependency now.
- Node 25 localStorage/jsdom test env fixed via an in-memory Storage helper.
@socket-security

socket-security Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​modelcontextprotocol/​client@​2.0.0-beta.2781008395100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Jul 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@mcp-use/agent

npm i https://pkg.pr.new/mcp-use/mcp-use/@mcp-use/agent@1837

@mcp-use/cli

npm i https://pkg.pr.new/mcp-use/mcp-use/@mcp-use/cli@1837

@mcp-use/client

npm i https://pkg.pr.new/mcp-use/mcp-use/@mcp-use/client@1837

create-mcp-use-app

npm i https://pkg.pr.new/mcp-use/mcp-use/create-mcp-use-app@1837

@mcp-use/inspector

npm i https://pkg.pr.new/mcp-use/mcp-use/@mcp-use/inspector@1837

mcp-use

npm i https://pkg.pr.new/mcp-use/mcp-use@1837

commit: c80ec52

Transition the CLI to ESM format, updating the binary path to `dist/index.js`. Adjust tests to reflect the new path. The inspector and CLI now fully support the v2 client, with the CLI gaining a `--negotiate` flag for client connections.
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

MCP MCP Conformance Test Results

Commit: c80ec52

Server Conformance

SDK Score vs main vs canary
typescript 26/30 (87%) 🔴 -4 🔴 -4
4 failure(s) — click to expand
Scenario typescript
completion-complete
dns-rebinding-protection
elicitation-sep1034-defaults ❌ -1
elicitation-sep1330-enums ❌ -1
logging-set-level
ping
prompts-get-embedded-resource
prompts-get-simple
prompts-get-with-args
prompts-get-with-image
prompts-list
resources-list
resources-read-binary
resources-read-text
resources-subscribe
resources-templates-read
resources-unsubscribe
server-initialize
server-sse-multiple-streams
tools-call-audio
tools-call-elicitation ❌ -1
tools-call-embedded-resource
tools-call-error
tools-call-image
tools-call-mixed-content
tools-call-sampling ❌ -1
tools-call-simple-text
tools-call-with-logging
tools-call-with-progress
tools-list

Client Conformance

SDK Score vs main vs canary
typescript-browser-client 0/20 (0%) 🔴 -20 🔴 -20
typescript-node-client 0/20 (0%) 🔴 -20 🔴 -20
typescript-react-client 0/20 (0%) 🔴 -20 🔴 -20
60 failure(s) — click to expand
Scenario typescript-browser-client typescript-node-client typescript-react-client
auth/2025-03-26-oauth-endpoint-fallback ❌ -1 ❌ -1 ❌ -1
auth/2025-03-26-oauth-metadata-backcompat ❌ -1 ❌ -1 ❌ -1
auth/basic-cimd ❌ -1 ❌ -1 ❌ -1
auth/metadata-default ❌ -1 ❌ -1 ❌ -1
auth/metadata-var1 ❌ -1 ❌ -1 ❌ -1
auth/metadata-var2 ❌ -1 ❌ -1 ❌ -1
auth/metadata-var3 ❌ -1 ❌ -1 ❌ -1
auth/pre-registration ❌ -1 ❌ -1 ❌ -1
auth/scope-from-scopes-supported ❌ -1 ❌ -1 ❌ -1
auth/scope-from-www-authenticate ❌ -1 ❌ -1 ❌ -1
auth/scope-omitted-when-undefined ❌ -1 ❌ -1 ❌ -1
auth/scope-retry-limit ❌ -1 ❌ -1 ❌ -1
auth/scope-step-up ❌ -1 ❌ -1 ❌ -1
auth/token-endpoint-auth-basic ❌ -1 ❌ -1 ❌ -1
auth/token-endpoint-auth-none ❌ -1 ❌ -1 ❌ -1
auth/token-endpoint-auth-post ❌ -1 ❌ -1 ❌ -1
elicitation-sep1034-client-defaults ❌ -1 ❌ -1 ❌ -1
initialize ❌ -1 ❌ -1 ❌ -1
sse-retry ❌ -1 ❌ -1 ❌ -1
tools_call ❌ -1 ❌ -1 ❌ -1

View full run details

tonxxd added 2 commits July 5, 2026 18:02
The v2 client split dropped the `./browser` subpath that the monolith
`mcp-use/browser` provided. The root `.` export pulls the Node stdio connector,
so browser consumers (e.g. the cloud dashboard's clientInfo VERSION) need a
browser-safe entry. Restores `@mcp-use/client/browser` mirroring the historical
surface plus `getPackageVersion` / `VERSION`.
The client build never regenerated src/version.ts, so getPackageVersion()
returned the stale monolith version (1.33.0) and telemetry reported it as
mcp_use_version. Add scripts/generate-version.mjs (mirroring mcp-use) and run it
in the build so VERSION tracks package.json (now 2.0.0-alpha.0).
@tonxxd

tonxxd commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Bundle size: v2 @mcp-use/client vs v1 mcp-use

Measured the real consumer bundle — esbuild --bundle --minify --platform=browser with react/react-dom external, then gzip -9. Compared [email protected] (v1 monolith) against the @mcp-use/client preview from this PR (@d504e50a).

Entry v1 mcp-use (min / gzip) v2 @mcp-use/client (min / gzip) Δ gzip
…/react (useMcp, McpClientProvider) 923 KB / 243.2 KB 386 KB / 102.9 KB −58%
…/browser 839 KB / 219.0 KB 338 KB / 89.3 KB −59%

Dependency footprint

v1 mcp-use v2 @mcp-use/client
Declared runtime deps 13 1 (@modelcontextprotocol/client)
node_modules (install, incl. react) 402 MB 24 MB
posthog-js / posthog-node yes no (fetch-only telemetry)
@modelcontextprotocol/ext-apps yes no (single MIME constant inlined)

Why it shrank

  • Dropped posthog-js + posthog-node (fetch-only PostHog capture) and @modelcontextprotocol/ext-apps.
  • The client no longer drags in the monolith's server/CLI/inspector surface (hono, express, @hono/node-server, @mcp-ui/server, @mcp-use/cli, @mcp-use/inspector, …) that a client-only consumer previously paid for.
  • Single, focused SDK dependency (@modelcontextprotocol/client) instead of the full v1 SDK.

Notes: v1 mcp-use is a monolith, so a client-only consumer paid for server/CLI/inspector code that @mcp-use/client no longer includes — part of the point of the v2 split. @mcp-use/client is ESM-only. Numbers are indicative (bundler/minifier/tree-shaking dependent), not a guarantee.

tonxxd and others added 3 commits July 5, 2026 19:45
Change the default protocol negotiation mode from "auto" to "legacy" in both HttpServerConfig and HttpConnectorOptions. Update comments to clarify the behavior of the "legacy" and "auto" modes, including details on OAuth discovery and server compatibility.
… traffic

Adds UseMcpOptions.oauthProxyUrl so consumers can route OAuth requests
(.well-known discovery, DCR, token exchange) through a transparent server-side
proxy for browser CORS while keeping MCP traffic direct. Takes precedence over
the URL derived from proxyConfig.proxyAddress. The transparent proxy swaps the
fetch rather than the metadata URLs, so RFC 8414 §3.3 issuer validation passes —
this replaces the gateway-side authorization_servers rewrite, which broke auth
for spec-compliant clients on every gateway-hosted server.
…#1839) (#1852)

* fix: JSON Schema dialect compat between v1-era servers and v2 clients (#1839)

Client: default jsonSchemaValidator (DialectJsonSchemaValidator) now maps
draft-04/-07/2019-09 $schema URIs to the matching @cfworker/json-schema
draft instead of failing with InvalidParams on callTool. Unknown dialects
still fail fast via the SDK's strict default.

Server: strip the v1 SDK's draft-07 $schema stamp from tool inputSchema/
outputSchema in tools/list responses; omitting $schema is accepted by both
v1 and v2 clients.

* docs: add JSON Schema dialect compatibility documentation

- Document DialectJsonSchemaValidator default in HTTP connectors
- Support https variant of draft-07 JSON Schema URI
- Document tools/list $schema omission for cross-version compat

Addresses all 3 issues from PR #1852 review feedback.

* docs(client): clarify DialectJsonSchemaValidator is default for all connectors

The JSDoc on ConnectorInitOptions.clientOptions previously only mentioned
HTTP connectors, but both HTTP and stdio connectors use the same default.
Updated comment to mention both connector types.

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants