Commit Graph

51 Commits

Author SHA1 Message Date
Ayaan Gazali c72efe5a17 ci: run the TypeScript jobs when ci.yml itself changes (#2311)
detect-changes gates every TypeScript job on the `typescript` path filter,
which only matches `libraries/typescript/**`. A pull request that edits
nothing but this workflow therefore matches no filter, so every job the
workflow defines is skipped on the change that defines them.

The three most recent workflow-only fixes all merged without the job they
were wiring up ever executing:

  #2201 "actually run the inspector unit tests"    typescript/inspector skipped
  #2214 "run the create-mcp-use-app unit tests"    typescript/create-app-tests skipped
  #2213 "actually run the mcp-use unit tests"      no TypeScript job ran

Add `.github/workflows/ci.yml` to the typescript and create-mcp-use-app
filters, matching what #2331 already did for knip. GitHub uses the pull
request's own copy of the workflow for `pull_request` runs, so the jobs
that run are the edited ones.
2026-08-30 10:44:09 -07:00
Andrew Khadder 8b6494f604 ci: use Knip's native GitHub reporter (#2331) 2026-08-25 12:49:48 -07:00
Ayaan Gazali 88565c20f7 fix(ci): actually run the release-channel tests (#2179)
* fix(ci): actually run the release-channel tests

scripts/release-channel.test.mjs and the test:release-channel script
landed with #2167, but nothing invokes them. The only mention of
test:release-channel in the repo is its own definition, so the six tests
guarding release versioning never run.

Runs them in typescript-changeset-check, which already owns the
release-channel preflight and has the toolchain set up.

* fix(ci): run the release-channel tests in their own job

Addresses review feedback. The step was under typescript-changeset-check,
which skips canary-targeted PRs, and release-channel changes commonly land
through canary. It also never ran on this PR, because that job needs
detect-changes.typescript and this branch only touches ci.yml.

Move it to typescript-release-channel-test with its own path filter covering
the helper, its tests, the package manifest that holds the script, and the CI
and release workflows. No base_ref condition, so it runs for main and canary
PRs alike, and the filter includes ci.yml so changes to this wiring exercise
the suite.

* ci: always run the release-channel test on reusable-workflow runs

The approved-fork path calls this workflow with only python, typescript
and create_mcp_use_app inputs, so it cannot report that a release
workflow changed. Deriving the release-channel flag from the typescript
input meant a workflow-only PR promoted through that path skipped the
test the direct path would have run.

The helper test takes a few seconds, so run it whenever the workflow is
called rather than infer a flag the caller never sends.
2026-08-25 10:03:23 -07:00
Ayaan Gazali b09401a90e ci: keep both CLI matrix legs running when one fails (#2325)
typescript-test-cli is the only TypeScript job with more than one matrix
leg: ubuntu-latest and windows-latest. It leaves fail-fast at the default,
which is true, so the first leg to fail cancels the other one.

That throws away the only thing a two-OS matrix is for. When the Windows
leg goes red, the question is always whether Ubuntu went red too, and
cancelling it removes the answer.

It nearly happened last week. On run 32652809882 the Windows leg failed
on a load-sensitive timeout while Ubuntu passed:

  ubuntu-latest    success   completed 16:51:12Z
  windows-latest   failure   completed 16:52:17Z

Ubuntu finished 65 seconds before Windows failed. Had it been a minute
slower it would have been cancelled, and the failure would have looked
like it could be either platform-wide or Windows-only.

Every other multi-leg matrix in this repo already sets fail-fast: false,
including python-transport-tests, python-primitive-tests,
python-agent-tests and create-mcp-use-app-tests. The remaining TypeScript
matrices are single-leg, so the setting does not affect them.
2026-08-25 09:06:49 -07:00
Ayaan Gazali 13ca58db78 fix(ci): actually run the mcp-use unit tests (#2213)
The step ran `pnpm --filter mcp-use --if-present test:unit`, but the mcp-use
package has no test:unit script, so --if-present turned it into a silent pass
and 447 tests never ran.

Point it at test:run, which is the script that exists and the same one the
client step above already uses.

Two failures were hiding behind the skip:

- usage.test.ts asserted telemetry was sent, but the step sets
  MCP_USE_ANONYMIZED_TELEMETRY=false, which short-circuits recordUsage. Those
  cases are about identity persistence, not the opt-out, so capture() now sets
  the variable itself. The file already tracks and restores it in afterEach.
- budgets/runtime-boundary.test.ts compared the builtin list with toEqual, so
  it depended on module resolution order between node:process and node:http.
  Sorted, which is what the case means by "loads only".

Verified with the step's own env: MCP_USE_ANONYMIZED_TELEMETRY=false
pnpm --filter mcp-use test:run gives 43 files, 447 passed, exit 0.

Closes #2203
2026-08-13 15:14:26 -07:00
Ayaan Gazali 68a0a48465 fix(ci): run the create-mcp-use-app unit tests (#2214)
The package has 25 vitest cases under src/__tests__, and no workflow ran
them. create-mcp-use-app-build builds and packs, and create-app-tests only
scaffolds a project with each package manager and checks the files exist.

Add the step to the build job, which already installs and builds, so the
unit tests run before the artifact is packed.

Verified: pnpm --filter create-mcp-use-app test gives 2 files, 25 passed.
2026-08-13 15:12:15 -07:00
Ayaan Gazali dbe5b8a4e8 fix(ci): actually run the inspector unit tests (#2201)
The "Run Inspector Tests" step calls `--if-present test`, but
@mcp-use/inspector has no `test` script, only `test:unit`. With
--if-present a missing script is a silent success, so the step has been
passing without running anything while 159 unit tests sat unexecuted.

Points it at test:unit, matching the sibling steps for mcp-use and
@mcp-use/agent. Dropped --if-present since the script exists and a
missing one should fail rather than pass quietly.
2026-08-13 15:09:06 -07:00
Enrico 668a312100 add standalone WebSocket tunnel package 2026-08-06 15:22:59 +02:00
Enrico 2a5e196f37 Merge origin/canary into fix/cli-source-ownership 2026-08-06 14:48:02 +02:00
Enrico Toniato bbee135dc8 fix(ci): ignore applied canary changesets (#2170) 2026-08-06 12:28:15 +02:00
Enrico Toniato 87b5d5fc13 fix(ci): give path filtering full git history (#2169)
Avoid concurrent shallow-fetch updates in dorny/paths-filter on branch push runs.
2026-08-06 12:12:31 +02:00
Enrico Toniato fe0f1aab51 fix(release): enforce monotonic stable and canary versions (#2167)
Restore stable source versions to npm truth and harden the stable/canary release workflow against version regressions and partial publication failures.
2026-08-06 12:09:18 +02:00
Enrico ad06e50e87 fix(typescript): enforce CLI package boundaries 2026-08-06 11:52:10 +02:00
Andrew Khadder 33e30cb8e3 Canary (#2117)
* fix(cli): report success from mcp-use typecheck (#2099)

`tsc --noEmit` prints nothing on a clean project, so `mcp-use typecheck`
exited 0 with no output at all, which is indistinguishable from the
command hanging or silently failing.

Print `[mcp-use] no type errors (<duration>ms)` on exit code 0, matching
the existing `[mcp-use] built ... (<duration>ms)` line from `build`.
Failing runs are untouched and still show only the compiler's own
diagnostics.

Closes #2083

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* chore: sync main into canary (#2119)

* chore(release): exit prerelease mode and publish npm README hotfix

Publishes mcp-use 2.0.1 and @mcp-use/inspector 20.0.1 with the repository README included in the mcp-use package tarball.

* chore(release): exit prerelease mode and publish npm README metadata hotfix

Publishes mcp-use 2.0.2 and @mcp-use/inspector 20.0.2 after preparing README metadata before npm publication.

* chore(release): exit prerelease mode and commit npm package README

Publishes mcp-use 2.0.3 and @mcp-use/inspector 20.0.3 with a committed package-root README.

* chore(release): exit prerelease mode and fix npm README assets

Fix npm README asset and repository links, publish mcp-use 2.0.4, and keep Inspector aligned at 20.0.4.

* Update libraries/typescript/packages/server/README.md

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Signed-off-by: Andrew Khadder <54488379+khandrew1@users.noreply.github.com>

* docs: sync migration guide link

---------

Signed-off-by: Andrew Khadder <54488379+khandrew1@users.noreply.github.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix(cli): say whether `start` mounted the inspector (#2100)

* fix(cli): say whether start mounted the inspector

`mcp-use dev` advertises the inspector in its banner, but `mcp-use start`
says nothing about it and `${basePath}/inspector` 404s unless
`--with-inspector` was passed. With no hint, that reads as a broken
production build rather than an opt-in.

Plain `start` now prints that the inspector is not mounted and how to
mount it, and `--with-inspector` prints the URL it was mounted at, which
was previously silent too.

Closes #2084

* fix(cli): drop the inspector-not-mounted line from start

Per review: most people running start do not want the inspector, so
announcing its absence is noise. Plain start is now silent about the
inspector again, and only the --with-inspector path prints its URL.

Updates the spec, the changeset, and swaps the test to pin the silence
instead of the message.

* chore(typescript): version packages (canary)

* chore: upgrade changesets cli to 2.31.1 (#2121)

* fix(ci): pin pnpm in the docs workflow so the job can start (#2116)

The docs job fails in "Set up pnpm" before it generates anything:

  Error: No pnpm version is specified.

pnpm/action-setup@v4 was used with no version:, so it falls back to
reading packageManager from package_json_file, which defaults to the
repository root. This repo has no root package.json, so the step could
never succeed and the check was red on every branch including main.

Pins 11.13.1, matching all nine action-setup uses in ci.yml and the
packageManager field in libraries/typescript/package.json.

* fix(cli): support package-manager dev arg forwarding (#2124)

* fix(cli): support package-manager dev arg forwarding (MCP-2549)

* chore: add MCP-2549 changeset

* fix(cli): normalize forwarded arguments across commands

* chore(typescript): version packages (canary)

* docs: fix TypeScript README links into the removed mcp-use package (#2114)

The v2 merge deleted libraries/typescript/packages/mcp-use, but the
TypeScript README still pointed at it in four places: the three logo
sources at the top of the page, and the documentation link at the bottom.

The logo now uses the absolute raw.githubusercontent.com URL that every
sibling package README already uses, and the docs link points at
packages/server, which is where the mcp-use package lives in v2 and what
the create-mcp-use-app and inspector READMEs already link to.

* fix(create-mcp-use-app): drop stale main field and give templates distinct descriptions (#2085)

* fix(create-mcp-use-app): drop stale main field and give templates distinct descriptions

Two small things in the scaffolded package.json, both visible as soon as
you generate a project.

main pointed at dist/index.js. v2 builds emit .mcp-use/build instead, so
that path never exists and main never resolves. These templates are apps
you run with mcp-use start, not packages anyone imports, and .mcp-use is
gitignored build output, so the field is dropped rather than repointed.

All three templates also carried the description 'an mcp-use server'.
--list-templates reads that field, so the three were indistinguishable
from the CLI, and every generated project inherited the same string.
Each now says what it actually gives you.

Closes #2080
Closes #2081

* chore: add changeset for the template package.json fixes

* fix(create-mcp-use-app): stop discarding the template description

updatePackageJson overwrote description with a generic
"<name>: an mcp-use server" on every scaffold, so the per-template
descriptions only ever reached --list-templates and never the generated
project. It now fills that in only when the template has no description
of its own, which keeps the previous behaviour for templates without one.

* chore(typescript): version packages (canary)

* fix(client): stop leaking parent env to stdio servers (#2125)

Port the security fix from #1949 to the v2 client package and verify the child process receives only safe defaults plus explicitly configured variables.

Co-authored-by: VihaanAgarwal <72850668+VihaanAgarwal@users.noreply.github.com>

* chore(typescript): version packages (canary)

* fix(client): bound conformance auth scenarios (#2126)

* fix(client): make stdio errlog actually receive the child's stderr (#2086)

* fix(client): make stdio errlog actually receive the child's stderr

StdioConnectionManager takes an errlog stream and documents that the
child server's stderr is piped to it, but the transport was created
without stderr: "pipe". The SDK defaults to "inherit", which leaves
transport.stderr null, so the forwarding block guarding on it never
ran and the child's stderr always went to the parent instead.

Spawn with stderr: "pipe" by default, spread so an explicit mode in
server params still wins. Tests spawn real child processes: one checks
a custom errlog receives the output, one checks stderr: "ignore" still
opts out.

* chore: drop stray version.ts that does not belong on beta

Left over from a main checkout; packages/mcp-use does not exist on this
branch.

* fix(client): expose stderr mode on the public stdio APIs

Per review, the compatibility escape hatch only worked for callers that
built StdioConnectionManager directly. StdioConnector did not accept or
forward stderr and StdioServerConfig did not expose it, so users of the
normal public APIs could not opt back into inherited stderr.

- Add a StdioStderrMode of "pipe" | "inherit" | "ignore", default "pipe".
- Accept it on StdioConnector and StdioServerConfig, forward it into
  StdioServerParameters, and thread it through the config path.
- Apply the default after the spread so an explicit stderr: undefined no
  longer defeats it.
- Only forward transport.stderr when the mode leaves a readable stream.
- Pipe with { end: false } and unpipe on close, since errlog is
  caller-owned and may be reused across reconnects.
- Handle stream errors instead of letting a destroyed errlog surface as
  an unhandled 'error' event.

Tests now start the transport before asserting, so the non-pipe cases are
exercised against a real child instead of passing by construction.

* fix(client): handle errlog write errors

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* fix(inspector): block loopback proxy targets by default (#2134)

mountInspector defaulted oauthProxyAllowLoopback to true, and the standalone
CLI hardcoded it — including in the published Docker image, which runs the
CLI with NODE_ENV=production on a public port. A publicly reachable inspector
could therefore proxy requests to the host's loopback services (SSRF), while
RFC1918/metadata targets were already blocked.

- mountInspector: default allowLoopback to false; local dev tooling opts in
- CLI: allow loopback unless NODE_ENV=production; INSPECTOR_ALLOW_LOOPBACK
  overrides either way
- Express-adapter test opts in explicitly (it proxies to its own 127.0.0.1
  echo server); new regression test covers the default and the opt-in

* chore(typescript): version packages (canary)

* docs: add v2 changelog updates

* chore: remove retired beta release flow (#2141)

* fix: keep prerelease versioning visible to Knip (#2142)

* fix: patch dependency vulnerabilities (#2151)

* fix: patch vulnerable dependencies

* fix: use mcp-use in client demo servers

* chore(typescript): version packages (canary)

---------

Signed-off-by: Andrew Khadder <54488379+khandrew1@users.noreply.github.com>
Co-authored-by: Ayaan Gazali <ayaangazali.work@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: VihaanAgarwal <72850668+VihaanAgarwal@users.noreply.github.com>
2026-08-05 10:26:37 -07:00
Enrico 06ff3075b5 release: merge v2 beta into main 2026-08-03 14:35:58 +02:00
Ayaan Gazali 6e3b9001e6 fix(ci): pin ruff in python-lint so releases cannot change the check (#2069)
The python-lint job installs ruff unpinned, so it always resolves to the
latest release. ruff 0.16.0 started formatting fenced code blocks inside
Markdown, which brought libraries/python/README.md into the scope of
`ruff format --check .` for the first time. Its quickstart examples were
never formatted that way, so the job now fails on every pull request that
touches libraries/python, regardless of what the change is.

Pin to 0.15.22, the newest release that passes both steps on current main.
This restores a reproducible check and leaves the Markdown question as a
deliberate choice rather than something a tool release decides.

Refs #1856
2026-07-31 12:09:09 -07:00
Enrico 8cc6367f0c ci: skip CI pushes on beta 2026-07-23 12:24:16 -07:00
Enrico Toniato 7d2adffa10 fix(agent): native OpenAI e2e + reasoning/mcpServers regressions (#1981)
Fix MCPAgent not spawning MCPClient for explicit llm + mcpServers URL config, omit reasoning.effort unless opted in, and add CI e2e against remote analytics-demo.
2026-07-22 19:41:16 -07:00
Andrew Khadder 2d1450fdc1 Fix Windows CLI artifact verification (#1979) 2026-07-22 19:05:48 -07:00
Enrico 15798394a4 chore(typescript): raise Node floor to 22.22.2 and CI to 22.23.1
Excludes pre–March 2026 security patches and satisfies npm 12 for trusted beta publishing.
2026-07-18 10:53:48 -07:00
Enrico b47e268f61 chore(typescript): raise Node.js engine floor to 22.13
Unblocks beta releases on pnpm 11.13 and aligns CI, Docker, build targets, and scaffolds with Maintenance LTS Node 22.
2026-07-18 10:47:42 -07:00
Enrico Toniato 50df3a1611 Create mcp use app version (#1924)
* refactor(create-mcp-use-app): replace --canary flag with --sdk-version for version pinning

- Updated GitHub Actions workflows to use --sdk-version instead of --canary for creating apps.
- Modified CLI options and internal logic to support --sdk-version for specifying npm dist-tags or semver.
- Updated documentation and tests to reflect the change from --canary to --sdk-version.

* chore(ci, workflows): downgrade Node.js version to 20.19.0 across all workflows

- Updated GitHub Actions workflows to use Node.js version 20.19.0 instead of 24.15.0.
- Adjusted package.json files to reflect the new Node.js engine requirements.
- Updated pnpm-lock.yaml and TypeScript dependencies to ensure compatibility with the new Node.js version.
2026-07-18 10:30:27 -07:00
Andrew Khadder 5c09447160 fix(ci): repair beta workflow checks (#1909) 2026-07-17 12:25:20 -07:00
Andrew Khadder b7b5ec0dc6 ci(typescript): align beta checks with Node 24 (#1895) 2026-07-16 17:22:07 -07:00
Enrico 4498176657 ci(typescript): add guarded beta npm releases 2026-07-16 12:39:06 -07:00
Enrico 8843e2ef0d fix(ci): simplify version generation command in CI workflow
- Removed redundant version generation command for @mcp-use/client in the CI workflow.
- Updated documentation links in code-mode.mdx and other files to reflect new paths.
- Changed installation instructions from yarn to npm for consistency across documentation.
- Enhanced error handling in client authentication and session management.
- Added a utility function to compare semantic versions in telemetry.
- Removed outdated unit tests for FileKVStore.
2026-07-14 19:28:38 -07:00
Enrico e6ce060a1b refactor(docs): update README and documentation for MCP SDK v2
- Improved formatting and consistency in README.md and various documentation files.
- Updated import paths to reflect the new package structure for @mcp-use/client and @mcp-use/agent.
- Enhanced examples and descriptions for MCPAgent and related components.
- Cleaned up whitespace and formatting for better readability across multiple files.
2026-07-14 18:54:00 -07:00
Andrew Khadder 83271e869f Canary (#1508)
* chore: remove unused mcp-use source files (#1476)

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* docs(cli): clarify inspector skipped-in-production log + start section (#1505)

* docs(cli): clarify inspector skipped-in-production log + start section

The runtime log "[INSPECTOR] Skipped in production (use --with-inspector
flag during build)" reads as if the flag can be passed to `mcp-use
start`, which it can't (the flag is only registered under `build`). The
new wording spells out the rebuild command, and `cli-reference.mdx`
gains a short note under `start` pointing at the build flag for
inspector-in-production.

Closes #1495

* docs(cli): apply reviewer reword on inspector note

* chore(typescript): version packages (canary)

* chore(inspector): remove unused source files (#1510)

Drops the 18 inspector files reported by `pnpm knip` from
libraries/typescript and stops generating the unused client-side
version.ts (the client reads the version from the
window.__INSPECTOR_VERSION__ global injected by the server).

Part of #1446.

* chore(typescript): version packages (canary)

* chore(typescript): prune 187 unused exports and 161 unused export types flagged by knip (#1511)

* chore(typescript): prune 161 unused exported types flagged by knip

Phase 2 of #1450: remove or de-export types that knip flags as unused.
Skipped tuning knip.json (Phase 1) — focused only on the type cleanup.

For each flagged type:
- Used only within its source file → drop `export`
- Re-exported through a barrel but never imported downstream → remove the re-export
- Genuinely dead → delete

No public-API removals: types exposed through the `mcp-use`, `@mcp-use/cli`,
`@mcp-use/inspector`, or `create-mcp-use-app` package entry points remain
exported. `client.ts` switches from inline `import("...")` to a top-level
import so knip can see the `ToolSearchResponse` usage.

Verified `pnpm knip` reports 0 unused types (down from 161) and
`pnpm build` passes across all packages.

* chore(typescript): prune 187 unused exports flagged by knip

Closes #1450.

* chore(typescript): fix prettier formatting

* chore(typescript): delete orphaned PropsSelect.tsx

Removing the unused barrel re-export in the prior commit left this file
with no consumers.

* chore(typescript): version packages (canary)

* ci(knip): enforce knip and clear final baseline findings (#1512)

* chore(knip): clear remaining baseline findings so knip passes clean

- Mark `src/index.tsx` as an entry for create-mcp-use-app so its
  CLI dependencies (chalk, commander, ink, ora, tar, react, etc.)
  stop being flagged as unused.
- Add `lsof`, `sleep`, and `dev` to ignoreBinaries for the mcp-use
  workspace — these appear in example scripts and are either system
  utilities or pnpm script names, not npm-resolvable binaries.
- Turn off the `optionalPeerDependencies` rule. Optional peer deps
  (langchain/langfuse/e2b/etc.) are loaded conditionally by design;
  flagging them as referenced is noise.

After this change `pnpm exec knip` exits 0 against canary.

* ci(knip): enforce knip in CI

The baseline is now clean (canary + previous PRs cleared all findings),
so drop `--no-exit-code` and let the job fail when knip reports issues.
Also generate `packages/mcp-use/src/version.ts` before knip runs so the
gitignored `version.js` imports resolve.

* chore(deps): bump better-auth in /libraries/typescript (#1515)

Bumps [better-auth](https://github.com/better-auth/better-auth/tree/HEAD/packages/better-auth) from 1.6.1 to 1.6.11.
- [Release notes](https://github.com/better-auth/better-auth/releases)
- [Changelog](https://github.com/better-auth/better-auth/blob/main/packages/better-auth/CHANGELOG.md)
- [Commits](https://github.com/better-auth/better-auth/commits/better-auth@1.6.11/packages/better-auth)

---
updated-dependencies:
- dependency-name: better-auth
  dependency-version: 1.6.11
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: tighten PR readiness and docs hygiene (#1509)

* docs: tighten review readiness and doc links

* docs: anchor api-reference redirect and fix missed node note

Move the /typescript/server/api-reference target from a bare redirect
to an anchored one (#mcpserver-api-reference) so existing "API Reference"
links land on the renamed section directly. Drop the self-link in
server/index.mdx and bring the commonjs example's Node note in line with
the package engines range.

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* feat(server/oauth): allow Supabase URL override for self-hosted/local instances (#1517)

* feat(server/oauth): allow overriding Supabase URL for self-hosted/local instances

`oauthSupabaseProvider` previously hardcoded `https://${projectId}.supabase.co`,
preventing use against local Supabase (`http://localhost:54321`) or self-hosted
deployments — even though those instances expose the same OAuth 2.1 server.

Add an optional `supabaseUrl` config (and `MCP_USE_OAUTH_SUPABASE_URL` env var)
that overrides the projectId-derived URL. `projectId` is now optional when
`supabaseUrl` is set; hosted-project users are unaffected.

Closes mcp-use/mcp-oauth-supabase-template#2

* test(server/oauth): trim supabase provider tests to factory contract

Drop low-value string-concatenation and pre-existing-behavior tests; keep
the two that cover the new behavior (supabaseUrl alone is accepted; empty
config throws). Isolate process.env in the factory describe so the
"throws when neither configured" assertion isn't defeated by local
MCP_USE_OAUTH_SUPABASE_* env vars.

* docs(server/oauth): document supabaseUrl override for local/self-hosted Supabase

* chore(typescript): version packages (canary)

* chore: use cross-platform clean commands (#1523)

* chore: use cross-platform clean commands

* chore: add empty changeset for cross-platform clean scripts

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* fix(server/oauth): use URL constructor to avoid double slash in metadata proxy (#1483)

* fix(server/oauth): use URL constructor to avoid double slash in metadata proxy

The DCR-direct metadata proxy was string-concatenating a path onto the
issuer, which canonically ends with a trailing slash:

    `${issuer}/.well-known/oauth-authorization-server`
    // → "https://tenant.auth0.com//.well-known/oauth-authorization-server"

Auth0 returns 404 for any path starting with "//", which broke OAuth
discovery end-to-end against real Auth0 tenants in DCR-direct mode.

new URL(path, base) normalizes the join regardless of trailing slash, so
this works for any provider whose canonical issuer ends with "/".

Fixes #1482.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(server/oauth): normalize issuer trailing slash instead of using URL constructor

`new URL("/.well-known/...", issuer)` resolves the leading-slash path against
the issuer's origin, stripping any path on the issuer. That breaks providers
like Supabase whose issuer is `https://<project>.supabase.co/auth/v1`. Replace
with a trailing-slash-stripping template literal, which handles both Auth0
(issuer ends with `/`) and Supabase (issuer has a path).

* chore(changeset): trim oauth metadata fix entry

* chore(changeset): drop issue reference

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* test(inspector): add OAuth e2e against emulated Google issuer (#1481)

* test(inspector): add OAuth e2e test using emulated Google issuer

Covers the inspector's OAuth redirect flow end-to-end against an
`emulate`-backed Google issuer + MCP server in oauthProxy mode, run
twice across the Direct and Via Proxy connection-type matrix. Both
variants share one fixture in serial mode since the registered redirect
URI pins the MCP server to a fixed port.

* test(inspector): switch loop to factory to satisfy no-loop-func

The for-loop variant captured the mutable `fixture` binding from beforeAll,
which eslint's no-loop-func flags. Hoisting the body into a small factory
keeps the shared fixture without the closure-over-loop pattern.

* test(inspector): close emulator if MCPServer setup fails

Wrap post-createEmulator work in try/catch so the emulator port
doesn't stay bound when MCPServer construction or listen() throws.

* chore(typescript): version packages (canary)

* fix(inspector): surface MCP server auth failures with reconnect banner (#1485)

* fix(inspector): surface MCP server auth failures with reconnect banner (MCP-2111)

When the hosted inspector's chat backend returns 401 because the upstream
MCP server rejected the user's OAuth token (e.g. Linear token expired),
the inspector previously threw a generic `HTTP error! status: 401` and
the cloud response misleadingly pointed users at the Manufact account
login.

The chat now recognises the cloud's `{ error: "mcp_auth_required",
mcpServerUrl }` response and renders an inline banner above the input
("Reconnect to <server>") with a button that calls
`connection.authenticate()`. Reconnect refreshes the OAuth token in
localStorage; the banner clears on success and chat resumes.

Pairs with a cloud-side change that drops the misleading `loginUrl`
field from the 401 response.

* fix(inspector): harden mcp_auth_required handling

- Drop the no-op setMessages filter in the 401 branch; the optimistic
  assistant message is only added after the response check, so there's
  nothing to remove.
- Guard `new URL(serverUrl)` in McpReconnectBanner so a malformed URL
  falls back to the raw string instead of crashing the chat tab.

* refactor(inspector): rename mcpAuthRequired to mcpServerAuthRequired

The hook's internal state was already named `mcpServerAuthRequired`, but
the returned key and clear callback used the shorter `mcpAuthRequired`,
forcing the ChatTab consumer to re-alias them. The shorter name was
also ambiguous in a codebase that has two distinct auth flows: the
Manufact account login (429 path) and the upstream MCP server OAuth
(401 path).

Align the public surface of `useChatMessages` with the internal state
and the consumer's local name. The backend wire value
`"mcp_auth_required"` is unchanged.

* chore(inspector): remove mcpServerAuthRequired comment

* chore(typescript): version packages (canary)

* fix(inspector): keep tab count badges visible in collapsed mode (#1490)

* fix(inspector): keep tab count badges visible in collapsed mode

* Keep tab badges aligned in collapsed mode

* extract TabCountBadge and fix badge visibility

* chore(typescript): version packages (canary)

* fix(inspector): drop unused TabCountBadge barrel re-export (#1533)

The only consumer (LayoutHeader.tsx) imports TabCountBadge directly
from ./shared/TabCountBadge, so the re-export in shared/index.ts is
unused. Knip flagged it and started failing CI on canary after the
TabCountBadge change landed.

* chore(typescript): version packages (canary)

* feat(inspector): add local LLM provider support for chat in Inspector (#1395)

* feat(inspector): integrate ollama provider

* feat(inspector): integrate lmstudio provider

* fix(inspector): preserve no-icon behavior for openai-compatible provider

* refactor(inspector): remove LM Studio provider and address PR feedback

* fix(inspector): remove duplicate ollama union members

Collapses the accidental `"ollama" | "ollama"` duplicates in
ProviderName, MCPChatMessageEventData, and LLMConfig.

* refactor(inspector): drop LLM proxy and call Ollama directly

Ollama allows localhost origins by default, so the inspector talks to
the daemon over CORS and skips the server-side proxy entirely. Surface
an OLLAMA_ORIGINS hint when the browser fetch fails so tunneled or
remote setups know what to configure. Theme the Ollama logo and tighten
its size so the non-circular mark sits cleanly next to the other
provider icons.

* chore(inspector): revert gratuitous field reorders

Restore original ordering of temperature/baseUrl and useCallback deps;
remove stray blank line in vite.config.ts to keep the diff focused.

* test(inspector): add unit tests for parseNDJSON

* refactor(inspector): tighten Ollama provider integration

- Guard Ollama streamChat against duplicate tool-call emissions when a
  chunk's tool_calls are repeated by proxies/forks
- Key the models cache on (provider, baseUrl) for any base-url provider
  so openai-compatible no longer serves stale entries on URL changes;
  normalize Ollama variants (trailing slash, /api suffix) to one entry
- Move OllamaCorsError into the Ollama provider module
- Replace hand-written provider unions in telemetry events and
  server shared-utils with ProviderName
- Single-source DEFAULT_OLLAMA_BASE_URL from ollama/utils.ts
- Drop the unrelated tempApiKey/tempModel trim() drift in saveLLMConfig
- Make OPENROUTER_ICON_URL module-private, clean up merge-artifact
  blank lines

* chore: simplify changeset

* style(inspector): apply prettier to shared-utils

* fix(inspector): drop unused export on DEFAULT_BASE_URLS

DEFAULT_BASE_URLS is only consumed by getDefaultBaseUrl in the same
module. Knip flagged the export as unused and failed CI.

* ci: retrigger after canary knip fix (#1533)

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* fix(inspector): resolve CodeQL polynomial-regex alert in Ollama url normalizer (#1534)

* fix(inspector): replace trailing-slash regex in Ollama url normalizer

CodeQL flagged `/\/+$/` in `normalizeOllamaBaseUrl` as a polynomial
regular expression on uncontrolled input. Swap the regex for an
explicit linear scan and add unit tests covering the trimming
behaviour plus a pathological-input case.

* chore: drop unit test for trivial regex refactor

* chore: drop accidentally committed .antigravitycli symlink

* chore(typescript): version packages (canary)

* chore: remove dead typescript-format-and-lint pre-commit hook (#1541)

The hook entry pointed to `.git/hooks/typescript-pre-commit.sh`, a path
that is never tracked and was never populated by any setup step, so the
hook could not run for anyone. TypeScript formatting and linting are
already handled by Husky (libraries/typescript/.husky/pre-commit),
installed automatically via `pnpm install`'s `prepare` script.

Closes #1536

* fix(inspector): stop ToolInputForm from mutating live tool inputSchema (#1545)

* fix(inspector): stop ToolInputForm from mutating live tool inputSchema

`ToolInputForm` was writing `required: boolean` onto each property of the
live tool inputSchema during render. `required` is not valid as a per-
property boolean — it belongs on the parent object as a `string[]`.
Anthropic's draft 2020-12 validator rejected the resulting payload with
`tools.0.custom.input_schema invalid`, breaking the Inspector chat after
any tool had been opened in the Tools tab.

Replace the mutation with a local `isRequired` const used only for the
`*` indicator render.

Fixes MCP-1970.

* chore(inspector): trim comment on schema-mutation fix

* chore: remove verbose comment

* style(inspector): apply prettier to ToolInputForm

* chore(typescript): version packages (canary)

* Improve tab switch animation timing (#1544)

* chore(ui): improve tab switch animation timing

* chore(changeset): add changeset for tab animation improvement

* chore(typescript): version packages (canary)

* fix(inspector): propagate server alias updates through mcp server wrapper (#1539)

* fix(inspector): propagate server alias updates through McpServerWrapper onUpdate

* chore: add changeset for mcp-use server alias propagation fix

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* chore(typescript): add 3-day install cooldown via pnpm minimumReleaseAge (#1516)

Blocks `pnpm install` from fetching npm versions published less than 3
days ago, mitigating supply-chain attacks where a malicious release is
typically yanked within hours of discovery.

The setting (introduced in pnpm 10.16) lives in pnpm-workspace.yaml — in
modern pnpm only auth/registry config is read from .npmrc, so putting it
there would be silently ignored.

Workspace-published names (`mcp-use`, `@mcp-use/*`, `create-mcp-use-app`)
are exempted so the cooldown never interferes with local development or
fresh releases of our own packages.

* fix(react): improve server management in McpClientProvider (#1561)

Refactor server removal and update logic to use a ref for synchronous access to the latest server state. This change prevents React's warning about updating a component during rendering by ensuring that teardown side effects (`disconnect()` and `clearStorage()`) are executed outside of the state updater functions. The ref is updated in a useEffect hook to maintain the latest server state for event handlers.

* chore(typescript): version packages (canary)

* fix(inspector): forward MCP image tool results as image content (#1487)

* fix(inspector): forward MCP image tool results as image content (MCP-1941)

Previously, the inspector's chat loop and provider adapters serialized MCP
tool results with JSON.stringify, which buried the base64 `data` field of
`image` content blocks inside a text payload. Vision-capable models
received a wall of base64 text instead of the image.

Extract MCP `content` blocks into provider-neutral `ContentPart[]` and
route image bytes through each provider's vision channel:

- Anthropic: image blocks inside `tool_result.content` (base64 source).
- OpenAI: tool role keeps text; image bytes forwarded as a follow-up
  user turn with `image_url` parts.
- Google: `functionResponse.response` keeps text/metadata; image bytes
  forwarded as a follow-up user turn with `inlineData` parts.

Text-only tool results keep the legacy `content: string` path on every
provider.

* style(inspector): apply prettier formatting

* chore(inspector): drop unused export on collapseToString

Only called internally by toolResultToContent — knip flagged it as an
unused export.

* fix(inspector): propagate MCP isError flag and fix image example tools

- Add isToolResultError() helper and use it in toolLoop + replay so
  tool calls that return { isError: true } are flagged the same as
  thrown errors on both live and saved-conversation paths.
- Pick a no-content fallback for OpenAI's tool role when there are
  no image parts to forward.
- Replace via.placeholder.com URLs in the everything example with
  real base64-encoded bytes fetched from picsum.photos, since the
  image() helper expects MCP ImageContent base64 data, not URLs.

* style(inspector): apply prettier formatting

* chore(typescript): version packages (canary)

* fix(server/inspector): normalize 0.0.0.0 to localhost in autoConnect URL (#1552)

* fix(server/inspector): normalize 0.0.0.0 to localhost in autoConnect URL

Browsers cannot resolve 0.0.0.0 as a destination, and the MCP SDK's
OAuth resource validator does strict origin equality — so the inspector
auto-connecting to http://0.0.0.0:PORT/mcp mismatches the resource
metadata published as http://localhost:PORT (which goes through
normalizeUrlHost in server-helpers.ts). Result: OAuth-protected mcp-use
apps fail at the inspector's post-callback validation with "Protected
resource X does not match expected Y".

Mirror the existing normalization for the autoConnect URL and the
banner log so both reflect the browser-reachable host.

Closes #1551

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: add changeset for inspector autoConnect loopback normalization

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* fix(cli): align widget Vite base with /mcp-use/widgets (#1560)

* fix(cli): align widget Vite base with /mcp-use/widgets/ when MCP_URL is set

* chore: add changeset for cli widget base path fix

* chore: format widget-paths.ts

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* feat(cli): headless screenshot with auto-sizing and external MCP server support (#1579)

* feat(cli): headless screenshot command with auto-sizing and external MCP server support

- Make width/height optional; when omitted, clips to the widget's natural rendered size
  by reading body[data-view-*] rect attrs set by the preview page
- Add useBundleReadinessSignal in ViewPreview that uses ResizeObserver to wait for the
  iframe to stabilize before setting data-view-ready, serializing the iframe's bounding
  rect so the CLI can clip tightly instead of capturing the full viewport
- Switch ViewPreviewBundle to displayMode="inline" so widgets auto-size to content height
- Add inlineWidthOverride prop to MCPAppsRenderer to bypass the 768px inline cap when
  screenshotting at an explicit width
- Fix extractViewName to handle external MCP server URIs (ui://<server>/<name>.html)
  by flattening to <server>-<name>; previously only ui://widget/ was handled, causing
  React Router to fail to match the preview route for third-party servers like Excalidraw

* chore: add changeset for screenshot auto-sizing and external MCP fix

* fix(cli): unexport CaptureScreenshotResult to satisfy knip

* chore(typescript): version packages (canary)

* feat(auth): enhance OAuth callback handling with improved state management and user feedback (#1580)

* feat(auth): enhance OAuth callback handling with improved state management and user feedback

- Introduced a module-level cache for in-flight authorization promises to prevent duplicate network requests during the same page load.
- Added utility functions to determine if the current window is a popup and to render user-friendly messages for closing the window after authentication.
- Improved handling of redirect flows and popup scenarios to ensure a seamless user experience, including error handling and messaging for lost opener situations.

* fix(auth): BroadcastChannel fallback when popup opener is severed

Popup callback now broadcasts success/failure over a same-origin
BroadcastChannel("mcp_auth_callback") in the lost-opener branch, and
useMcp subscribes to that channel alongside the existing window.message
listener. Without this, popups whose window.opener was severed by COOP
or cross-origin intermediate redirects would save tokens but leave the
parent stuck in `authenticating`.

Matches the dual-transport pattern used by oidc-client-ts and MSAL.js
for the same COOP scenario.

* chore(auth): unexport MCP_AUTH_BROADCAST_CHANNEL to satisfy knip

It's only used inside callback.ts; the parent side hard-codes the same
string in useMcp.ts. Removing the export drops knip's "unused export"
finding while keeping a single source-of-truth comment that links the
two files.

* fix(mcp-use): split langchain agents out of mcp-use/browser entry

Move MCPAgent, RemoteAgent, adapters, and observability to
mcp-use/browser/agent so Next.js clients importing MCPClient only
no longer pull @langchain/* into the browser bundle.

* chore: format browser bundle test file

* chore(typescript): version packages (canary)

* fix(inspector): add copy button to user messages (#1556)

* fix(inspector): add copy button to user messages

Extract CopyButton into a shared component and add it to UserMessage,
matching the existing assistant message UX.

Resolves #1555

* chore: add inspector copy button changeset

---------

Co-authored-by: Jefsky <jefsky@users.noreply.github.com>
Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* feat(server): add publicLandingPage option for OAuth-protected servers (#1550)

* feat(server): add publicLandingPage option for OAuth-protected servers

* fix(server): keep public landing auth gate in oauth setup

* docs(server): add public landing page example

* chore(server): format mcp endpoint

* chore(server): simplify accept header lookup

* chore(server): restore mcp mount diff

* fix(server): align oauth exports with canary

* chore(server): format oauth exports

* fix(server): remove unused oauth barrel exports

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* Move mcp-apps template pnpm settings to workspace config (#1602)

* fix(inspector): widget fullscreen above embedded host chrome (MCP-2181) (#1605)

* fix(inspector): portal widget fullscreen above host chrome

MCP-2181: cloud chat headers at z-50 covered the fullscreen exit control
because the overlay used z-40 inside a nested stacking context. Portals
the fullscreen shell to document.body at z-[100], sets
data-mcp-widget-fullscreen for hosts, and shows the Apps SDK exit navbar
in CSS fullscreen fallback.

* fix(inspector): native fullscreen first, no portal remount (MCP-2181)

Revert conditional createPortal that remounted widgets on fullscreen toggle.
Use requestFullscreen() as the primary path; apply CSS z-[100] overlay only
when the API fails. Keep exit navbar and data-mcp-widget-fullscreen for both.

* refactor(inspector): consolidate widget fullscreen into shared hook

Extract useWidgetFullscreenControls for native-first fullscreen + CSS
fallback. Removes duplicated handlers, unused helpers, and OpenAI edge-case
branches from MCPAppsRenderer and OpenAIComponentRenderer.

* fix(inspector): preserve widget state when entering fullscreen (MCP-2181)

Route ui/request-display-mode through native fullscreen handling, target
requestFullscreen on the iframe wrapper, and avoid resetting load state on
display-mode-only changes. Stabilize OpenAI iframe listeners so chat
re-renders do not flash the skeleton.

* style(inspector): format OpenAIComponentRenderer for Prettier

* fix(inspector): fullscreen shell includes navbar and fills viewport

Promote the outer widget shell via requestFullscreen so FullscreenNavbar
stays visible and bg-background fills the screen instead of browser black
letterboxing around a nested iframe wrapper.

* fix(inspector): PiP portal and sandbox remount bridge reconnect (MCP-2181)

Port PiP to document.body with z-[100]. Re-run AppBridge when the sandbox
iframe remounts; keep the host spinner until initCount recovers. Unify
display-mode document attributes for optional host chrome hiding.

* fix(inspector): resend widget data after PiP remount

* chore(typescript): version packages (canary)

* Hash Claude resource domains from authored ui.domain (#1599)

* Apply Claude resource domain hashing for UI metadata

* chore: format Claude domain helper

* fix(inspector): drop unused widget-fullscreen exports to satisfy knip (#1607)

widget-fullscreen.ts (added in #1605) exported several symbols that
nothing outside the file consumes, plus pre-emptive @deprecated aliases
for an API that never shipped. Only useWidgetDisplayModeControls is used
(by MCPAppsRenderer and OpenAIComponentRenderer).

- Unexport internal-only constants, the WidgetDisplayMode type, and the
  useWidgetDisplayModeDocumentChrome helper
- Remove the dead useWidgetFullscreenControls / useWidgetFullscreenDocumentChrome aliases

* test(agent): drop live Langfuse API integration tests (#1608)

The observability integration tests queried the live Langfuse REST API
(via getRecentTraces) to verify traces landed. cloud.langfuse.com has
been returning 403 Forbidden for both ingestion and queries, failing the
'should send traces to Langfuse when observability is enabled' test and
reddening canary CI.

Remove the two tests that depend on the live API (the failing test and
the already-skipped manual-trace test) plus the now-unused getRecentTraces
helper. Keep the two tests that verify observability enable/disable
behavior locally with no network dependency.

* chore(typescript): version packages (canary)

* fix(oauth): redact token verification errors (#1573)

* fix(oauth): redact token verification errors

* chore: add oauth error redaction changeset

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* fix(inspector): skip emulate oauth tests in builtin e2e (#1609)

* chore: add codex to gitignore (#1612)

* fix(docs): update server API reference links (#1611)

* fix(mcp-use): pin published dependency versions (#1610)

* docs(changelog): document v1.29.0 / inspector v7.0.0 release

TypeScript changelog gains a v1.29.0 entry (public landing pages, Supabase URL override, Claude UI-resource domain hashing, OAuth callback + React-provider hardening). Inspector changelog gains a major v7.0.0 entry (local Ollama provider, image tool results, MCP-server reconnect banner, widget fullscreen/PiP rework).

* Fix builtin inspector auto-connect to use HTTP (#1613)

* Switch builtin inspector auto-connect to HTTP

* Use plain URL autoConnect in builtin e2e helper

* Fix built-in inspector auto-connect to use HTTP

* chore(typescript): version packages (canary)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: asim48-ctrl <asim48@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Truffle <truffleagent@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: SSharma1103 <shivamsharma11032009@gmail.com>
Co-authored-by: Polæ <steven@polae.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Arpit Maurya <arpitbabu802@gmail.com>
Co-authored-by: Udaykumar Dhokia <udaykumardhokia@gmail.com>
Co-authored-by: Neha Prasad <nehaa9863pd@gmail.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: Jefsky Wong <hwj3344@hotmail.com>
Co-authored-by: Jefsky <jefsky@users.noreply.github.com>
Co-authored-by: Ritwij Aryan Parmar <88580521+RitwijParmar@users.noreply.github.com>
2026-06-03 13:12:45 -07:00
Andrew Khadder 78cfc8a74d Canary (#1434)
* feat(mcp-use): add Clerk OAuth provider for TypeScript (#1429)

* feat(mcp-use): add Clerk OAuth provider

* docs: add Clerk OAuth provider documentation page

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* fix(cli): propagate --env/--env-file to server on deploy redeploys (#1433)

The deploy command only forwarded `--env`/`--env-file` values when creating
a brand-new server (where they ride on the createServer body). On redeploys
to an existing linked server, env vars were parsed and shown in the preview,
then silently dropped before createDeployment. Now upserts each entry against
/api/v1/servers/{id}/env-variables (PATCH for existing keys, POST for new
ones) before triggering the deployment.

Closes MCP-1995

* chore(typescript): version packages (canary)

* chore(typescript): adopt Knip to find and remove unused code (#1359)

* chore(typescript): adopt knip at workspace root

Add Knip as a dev dependency at the TypeScript workspace root with a
root-level knip.json covering all packages. Consolidates the existing
per-package Knip setup in @mcp-use/inspector into the shared config and
delegates its check-deps script to the root install.

Adds `pnpm knip`, `pnpm knip:deps`, and `pnpm knip:production` scripts
and documents them in the TypeScript README. Baseline configuration
suppresses known false positives (build-generated version.js, Tailwind/
Scarf deps, nested example and template workspaces, test helpers and
servers). Actual dead-code removal is deferred to follow-up PRs.

Refs MCP-1707

* ci: add warning-only Knip step

Runs `pnpm knip --no-exit-code --no-progress` on TypeScript-affecting
PRs/pushes and writes the report to the GitHub Actions step summary.
Stays non-blocking by design — tighten to a failing check once the
baseline cleanup PRs land.

* chore(inspector): drop redundant check-deps script

Root-level pnpm knip:deps already covers all workspaces, so the
inspector-only wrapper just duplicated the same delegation. Devs
needing scoped output can use pnpm knip --workspace packages/inspector.

* chore(typescript): drop changeset for dev-only knip adoption

* feat(inspector): support custom base URL for OpenAI-compatible providers (#1437)

* feat(inspector): support custom base URL for OpenAI-compatible providers

* feat(inspector): add support for OpenAI-compatible providers with configurable base URL

Co-authored-by: Copilot <copilot@github.com>

* refactor(inspector): simplify openai-compatible plumbing

- Widen ProviderName union to include "openai-compatible" and drop the
  resolveProvider helper; the providers dispatcher fall-throughs from
  "openai-compatible" to the openai impl, so callers can pass the UI
  provider name straight through.
- openai.ts: extract buildEndpoint/buildHeaders, strip trailing slashes
  on baseUrl, and skip Authorization header when apiKey is empty.
- ConfigurationDialog: defensive parsing of /models response, surface
  CORS hint on fetch failure, mention CORS requirement in helper text,
  move "OpenAI Compatible" to end of dropdown.
- useConfig: persist openai-compatible base URL per-provider in
  localStorage (mirrors api keys), restore on switch + cross-tab sync.
- Drop openai-compatible logo references in ChatHeader / ChatLandingForm
  / ConfigurationDialog dropdown.

* style(inspector): apply prettier formatting

* chore(changeset): bump @mcp-use/inspector to minor for openai-compatible provider

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* feat: integrate OpenRouter as a first-class LLM provider (fixes #1402) (#1403)

* feat(inspector): integrate OpenRouter as a first-class LLM provider

Adds OpenRouter to the inspector chat configuration. Selecting OpenRouter
routes through the existing OpenAI provider with an override base URL and
the required HTTP-Referer / X-Title headers, so users get multi-model
access (OpenAI, Anthropic, Google, etc.) from a single API key without
duplicating provider plumbing.

Co-authored-by: Andrew Khadder <andrew@mcp-use.com>

Closes #1402

* fix(inspector): use inspector.mcp-use.com as OpenRouter HTTP-Referer

* feat(inspector): swap OpenRouter favicon.ico for inline gray SVG

Drops the runtime fetch to openrouter.ai/favicon.ico in favor of an inline
data-URL'd SVG with a neutral #94A3B8 fill. Follow-up will lift this onto
the provider CDN alongside the other provider marks.

* fix(inspector): stop OpenRouter SVG curves from being implicitly filled

The two arrow-body paths are open curves; with the parent svg's fill set,
the browser implicitly closed them and filled the resulting region,
producing visual artifacts at small sizes. Mark those two paths
fill="none" so only their strokes render.

* fix(inspector): use OpenRouter SVG in ChatLandingForm chip

The landing-form provider chip was hardcoded to the CDN png URL, which
404s for the openrouter provider and rendered a broken-image blob clipped
by rounded-full styling. Match the ChatHeader behavior and fall back to
OPENROUTER_ICON_URL.

* fix(inspector): set OpenRouter X-Title to mcp-use Inspector

* refactor(inspector): drop OpenRouter baseUrl path special-case

Set OpenRouter's baseUrl to the API root (/api/v1) and let buildEndpoint
append /chat/completions like the rest of the OpenAI-compatible flow,
removing the includes("/chat/completions") short-circuit that only
existed to defuse the path baked into the override.

* style(inspector): apply prettier formatting

* chore(inspector): drop redundant baseUrl jsdoc comment

---------

Co-authored-by: Andrew Khadder <andrew@manufact.com>

* chore(typescript): version packages (canary)

* feat(auth): pre-registered OAuth client credentials and scopes in Inspector (#1400)

* feat(auth): pre-registered OAuth client credentials and scopes

Wires clientId, clientSecret, and scope end-to-end from the Inspector's
Authentication dialog through useMcp into BrowserOAuthClientProvider's
staticClientInfo. When clientId is set the SDK skips Dynamic Client
Registration (required for proxy-mode servers like Slack/WorkOS that
strip registration_endpoint). When clientSecret is also set, the SDK
auto-switches token-endpoint auth from "none" to client_secret_basic /
client_secret_post, supporting providers that don't support PKCE.

* refactor(inspector): extract OAuthStaticConfig type and builder helper

Replaces six inline copies of `{ clientId?; clientSecret?; scope? }` and
two copy-pasted trim+spread builders with a shared `OAuthStaticConfig`
type and `buildOAuthStaticConfig()` helper in connectionUpdates.ts.
Also widens ServerConnectionModal's connection/onConnect types so the
`as { oauth?: ... }` structural cast can go away (the modal was passing
oauth in the spread without declaring it on the callback type).

* docs: document pre-registered OAuth client credentials

Updates client authentication, useMcp, and inspector connection-settings
docs to cover the new oauth.{clientId, clientSecret, scope} option and the
proxy-mode/confidential-client cases it unlocks. Replaces the inaccurate
snake_case OAuth params table with the actual camelCase API shape.

* chore(typescript): version packages (canary)

* fix(inspector): honor MCP_USE_ANONYMIZED_TELEMETRY in browser telemetry (#1443)

* fix(inspector): honor MCP_USE_ANONYMIZED_TELEMETRY in browser telemetry

The env var previously disabled Node-side telemetry and the inspector's
server-side proxy, but the in-browser posthog-js init triggered by
useMcp still fired POSTs to https://eu.i.posthog.com that ad/tracker
blockers flag. The inspector server now mirrors the env var into a
runtime flag (window.__MCP_USE_ANONYMIZED_TELEMETRY__) and localStorage
before the client bundle runs; both mcp-use's browser telemetry and the
inspector's own client telemetry honor that flag, so a single env var
disables every telemetry path.

* fix(inspector): drop sticky localStorage write; honor opt-out in Vite dev

The previous revision mirrored MCP_USE_ANONYMIZED_TELEMETRY=false into
localStorage, which persisted across sessions even after the env var
was unset. Switch to a per-page window flag only — unsetting the env
var fully restores defaults on the next page load.

Also extend the opt-out to pure-Vite dev mode via a transformIndexHtml
plugin, so the env var works whether the inspector is served by the
backend or by Vite directly.

* chore(typescript): version packages (canary)

* fix(inspector): drop trailing-slash regex flagged by CodeQL

The /\/+$/ regex on user-supplied base URLs triggered js/polynomial-redos.
Most servers normalize a double slash in `${baseUrl}/path` fine, so just
drop the stripping rather than working around the alert.

* docs(changelog): add v1.27.0 / inspector v5.0.0 release notes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddhant Rai <47355538+siiddhantt@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Arpit Maurya <arpitbabu802@gmail.com>
2026-05-06 16:19:28 -07:00
Enrico Toniato ed0fadbb01 Canary (#1200)
* Fix/move-zod-to-peer (#1198)

* chore: update pnpm-lock.yaml and package.json to include zod dependency in mcp-use package and test_app configuration

* feat(cli): implement TypeScript file collection and transpilation with esbuild

- Added `collectTsFiles` function to gather TypeScript files based on tsconfig patterns using Node.js built-ins.
- Introduced `transpileWithEsbuild` function to handle TypeScript transpilation, improving performance and memory usage.
- Updated build command to utilize esbuild for transpilation and added an option to skip TypeScript type checking with `--no-typecheck`.

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* chore: update package dependencies in TypeScript libraries (#1199)

* chore: update package dependencies in TypeScript libraries

- Bump `qs` version from `>=6.14.1` to `>=6.14.2`.
- Add new dependencies: `flatted`, `tar`, `hono`, `@hono/node-server`, `express-rate-limit`, `dompurify`, `minimatch`, `rollup`, `@modelcontextprotocol/sdk`, `ai`, `ajv`, `axios`, `body-parser`, `brace-expansion`, `@isaacs/brace-expansion`, `form-data`, `lodash`, and `@eslint/plugin-kit`.
- Update `tar` version from `^7.5.9` to `^7.5.11` in multiple packages.
- Update `hono` version from `^4.11.10` to `^4.12.7` in relevant packages.
- Update `@modelcontextprotocol/sdk` version from `^1.26.0` to `^1.27.1` in relevant packages.
- Update `express-rate-limit` version from `^7.4.1` to `>=8.2.2` in the example server feature.

* chore: remove ajv dependency from TypeScript libraries

- Removed `ajv` dependency from `package.json` and `pnpm-lock.yaml`.
- Updated peer dependencies for `ajv-formats` to use `^8.0.0` instead of `>=8.18.0`.
- Added new dependencies: `fast-json-stable-stringify`, `json-schema-traverse`, and `uri-js` with their respective versions.

* fix: ensure widget parameter is non-null in setupWidgetRoutes

- Updated the widget parameter retrieval in setupWidgetRoutes to use a non-null assertion, ensuring that the widget variable is always defined when serving static assets and widget index.html files.

* chore(typescript): version packages (canary)

* fix(typescript): use file:// URL in tsImport to fix Windows crash (#1193)

* fix(typescript): use file:// URL in tsImport to fix Windows crash

The tsImport call was passing serverFilePath (raw OS path) instead of
serverFileUrl (file:// URL), causing ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows.

Fixes #1171

* fix(typescript): also fix file:// URL in generate-types and add Windows CI

The original fix addressed tsImport in the dev command but missed the
same bug in generateToolRegistryTypesForServer (used by generate-types
and postinstall). Also adds Windows to the CLI test matrix so
platform-specific path issues are caught in CI.

* fix(typescript): fix Windows path separator issues in CLI tests

- display-package-versions: use path.join instead of hardcoded forward-slash path
- tsx-resolution: use path.join in assertions to handle backslash separators
- cli-integration: skip when dist/index.cjs build artifact is missing

---------

Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore(typescript): version packages (canary)

* fix(workflows): enhance environment variable usage in GitHub Actions

- Updated multiple workflow files to use environment variables for better readability and maintainability.
- Replaced direct references to GitHub context variables with environment variables in `claude.yml`, `conformance.yml`, `create-app-e2e-canary.yml`, `railway-deploy.yml`, and `typescript-pr-preview.yml`.
- Improved conditional checks in scripts to utilize these environment variables, streamlining the workflow logic.

* refactor(tests): format playwrightArgs for better readability

- Reformatted the addition of `--grep-invert` arguments in the run-test-matrix script to improve code clarity and maintainability.

* refactor(cli, mcp-use): update type generation functions to return success status (#1201)

- Modified `generateToolRegistryTypesForServer` and `generateToolRegistryTypes` to return a boolean indicating success or failure instead of void.
- Updated CLI commands to handle and log success or error messages based on the type generation outcome.
- Enhanced error handling in type generation to prevent server crashes while providing feedback on failures.

* chore(typescript): version packages (canary)

* chore(docs): update changelog for v0.24.5 and v1.21.5 releases

- Added entries for v0.24.5, detailing dependency updates and fixes for security alerts.
- Included v1.21.5 changes, highlighting Zod peer dependency adjustments, esbuild transpilation improvements, and Windows path handling fixes.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: guoyangzhen <upgyz@qq.com>
2026-03-17 13:06:26 +01:00
Enrico Toniato 4618c6eced ci: add OPENAI_API_KEY environment variable to CI workflows
* Added OPENAI_API_KEY to the environment variables for both Python and TypeScript CI jobs.
* Conditional execution of agent tests based on the presence of OPENAI_API_KEY.

This change ensures that the necessary API key is available during the CI process for relevant tests.
2026-03-16 20:49:51 +01:00
Enrico Toniato 1dcba404b4 Feat/mcp apps 2 (#886) (#887)
* Feat/mcp apps 2 (#886)

* feat(mcp-use): implement dual-protocol support for MCP Apps and ChatGPT widgets

- Added support for the MCP Apps Extension (SEP-1865) in mcp-use, enabling widgets to function with both ChatGPT and MCP Apps-compatible clients.
- Introduced a new `mcpApps` widget type, allowing unified widget definitions that automatically generate protocol-specific metadata.
- Created protocol adapters for transforming widget definitions into formats compatible with both protocols.
- Enhanced the server and client code to handle dual-protocol metadata generation and widget registration.
- Updated documentation and examples to demonstrate the new functionality and usage patterns.

This implementation improves compatibility and flexibility for developers creating widgets across different platforms.

* feat(cli, mcp-use): implement Zod JIT compilation patching to prevent CSP violations

- Added functionality to post-process JavaScript bundles and patch Zod's JIT compilation to avoid CSP eval violations in sandboxed iframes.
- Introduced a new plugin in mcp-use to transform Zod's globalConfig, ensuring compatibility with strict CSP requirements.
- Enhanced error handling for asset processing to gracefully manage missing directories.

These changes improve security and compatibility for applications using Zod in restricted environments.

* feat(inspector): add MCP Apps debugging support and UI Playground

- Implemented comprehensive debugging capabilities for MCP Apps (SEP-1865) in the inspector, including a new `MCPAppsRenderer` for rendering widgets.
- Introduced a `WidgetDebugContext` to manage widget state, CSP violations, and playground settings.
- Added a UI Playground tab for testing widgets with device emulation, CSP mode switching, and traffic logs.
- Enhanced existing components to support the new debugging features and integrated CSP violation tracking.
- Updated package dependencies to include `@modelcontextprotocol/ext-apps@^0.4.1` for improved functionality.

These changes enhance the developer experience by providing robust tools for testing and debugging MCP Apps alongside existing widgets.

* feat(cli, inspector, mcp-use): enhance widget metadata and logging capabilities

- Updated CLI to allow the server host to default to "0.0.0.0" for broader interface listening.
- Enhanced `MCPAppsRenderer` to include a console logging handler for improved debugging of MCP logging notifications.
- Refactored `WeatherDisplay` widget to utilize additional user agent and context information, improving display accuracy.
- Introduced new properties in `useWidget` and `widget-types` for maximum width and timezone support, enhancing widget adaptability.
- Improved server helper functions to normalize URLs and manage X-Frame-Options for cross-origin iframe embedding.

These changes collectively enhance the developer experience by providing better logging, improved widget context handling, and more flexible server configurations.

* feat(inspector): add MCP Apps support in ResourceResultDisplay

- Integrated MCP Apps detection and rendering into the ResourceResultDisplay component.
- Implemented logic to check for MCP Apps resources and display corresponding badges.
- Enhanced the rendering flow to prioritize MCP Apps over other widget types, improving user experience and functionality.

These changes enhance the inspector's capability to handle MCP Apps, aligning with ongoing development efforts for better widget integration.

* feat(inspector): enhance inspector with new components and constants for MCP Apps

- Updated `tsconfig.client.json` to include constants directory for better module resolution.
- Refactored `LayoutContent` to improve the handling of prompt calls with enhanced argument processing.
- Introduced `PopoverSelect` and `SafeAreaInsetsEditor` components for reusable UI elements in the inspector.
- Added `debug-options` and `iframe` constants for improved configuration management.
- Enhanced `MCPAppsDebugControls` and `MCPAppsRenderer` to utilize new constants and improve widget rendering.
- Implemented dual-protocol support in various components to streamline widget integration.

These changes collectively enhance the inspector's functionality and maintainability, aligning with ongoing development efforts for better widget integration.

* feat(cli): normalize browser host for server connections

- Introduced a `normalizeBrowserHost` function to convert "0.0.0.0" to "localhost" for browser connections, ensuring compatibility.
- Updated CLI logging to reflect the normalized host for local connections, enhancing user experience.
- Refactored MCP endpoint and inspector URL generation to utilize the normalized host.

These changes improve the reliability of server connections from browsers and streamline the logging output in the CLI.

* refactor(inspector): optimize playground handling in OpenAIComponentRenderer

- Removed stale closure handling for playground settings by directly capturing the playground state at effect run time.
- Enhanced logging to provide better visibility into the stored widget data and playground configuration.
- Updated comments for clarity on the handling of dynamic updates to iframe globals without reloading the widget.

These changes improve the efficiency and maintainability of the OpenAIComponentRenderer component.

* refactor(inspector): remove unused SearchableSelect and UIPlaygroundTab components

- Deleted the SearchableSelect component, which was not utilized in the codebase, streamlining the component library.
- Removed the UIPlaygroundTab component, consolidating playground functionality and reducing code complexity.

These changes enhance maintainability by eliminating redundant components from the inspector package.

* refactor(docs): streamline documentation for dual-protocol widget support

- Consolidated and clarified documentation across various guides to emphasize dual-protocol support for MCP Apps and ChatGPT Apps SDK.
- Updated descriptions and examples to reflect the latest features and best practices for widget development.
- Enhanced the inspector documentation to provide clearer instructions for debugging and testing widgets in both protocols.
- Removed redundant content and improved organization for better user navigation.

These changes improve the overall clarity and usability of the documentation, aiding developers in leveraging the dual-protocol capabilities effectively.

* refactor(inspector): optimize MCPAppsRenderer and ToolResultDisplay components

- Replaced useState with useRef for containerRef in MCPAppsRenderer to prevent unnecessary state updates during ref callback.
- Updated effect dependencies in MCPAppsRenderer to remove unused variables, enhancing performance.
- Memoized onSendFollowUp callback in ToolResultDisplay to prevent infinite re-render loops, improving efficiency.
- Enhanced WidgetDebugProvider by using useMemo for context value to minimize re-renders and added a ref for accessing current state without causing updates.

These changes collectively improve the performance and maintainability of the inspector components.

* feat(mcp-use): add landing page generation for browser requests

- Introduced a new `generateLandingPage` function to handle browser GET requests and serve a landing page.
- Updated the `mountMcp` function to detect browser requests and return the generated landing page with appropriate headers.

These changes enhance user experience by providing a dedicated landing page for browser users, improving accessibility and engagement.

* refactor(docs): update documentation for dual-protocol widget migration

- Enhanced documentation to clarify the migration process from `appsSdk` to `mcpApps`, emphasizing the new `metadata` format.
- Added examples demonstrating the updated widget registration and metadata structure for both protocols.
- Included a migration checklist and field mapping reference to assist developers in transitioning to the dual-protocol support.

These changes improve the clarity and usability of the documentation, aiding developers in effectively leveraging the new features.

* refactor(mcp-use): map console log levels to RFC 5424 standards

- Introduced a mapping of JavaScript console log levels to RFC 5424 log levels for improved logging consistency.
- Updated the logging notification helper to utilize the new mapping, ensuring standardized log level reporting.

These changes enhance the clarity and reliability of logging within the MCP Apps Bridge, aligning with best practices for log management.

* refactor(docs): update documentation for MCP Apps migration and dual-protocol support

- Enhanced the documentation to clarify the migration process from `appsSdk` to `mcpApps`, including updates to the `metadata` format.
- Added detailed examples and a migration checklist to assist developers in transitioning to the new dual-protocol support.
- Improved the organization and clarity of the documentation, making it easier for developers to understand and implement the changes.

These updates aim to facilitate a smoother migration experience and better utilization of the new features in the MCP Apps framework.

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* refactor: update templates and documentation for MCP Apps support (#888)

* refactor: update templates and documentation for MCP Apps support

- Replaced references from `apps-sdk` to `mcp-apps` across various files, including CI workflows, documentation, and template configurations.
- Removed the deprecated `creating-apps-sdk-server` documentation and updated links to the new `creating-mcp-apps-server` guide.
- Enhanced the README and other documentation files to reflect the new `mcp-apps` template usage and features.
- Updated CLI commands and package.json scripts to align with the new template naming conventions.
- Improved clarity in documentation regarding the migration from `apps-sdk` to `mcp-apps`, ensuring a smoother transition for developers.

These changes collectively enhance the developer experience by providing clearer guidance and updated resources for working with MCP Apps.

* chore: update pnpm-lock.yaml for package version adjustments and path corrections

- Renamed the path for `mcp-apps` in the lock file to reflect the new directory structure.
- Updated package versions for `vite` and related dependencies from 7.3.0 to 7.3.1, ensuring compatibility with the latest features.
- Adjusted the path for `mcp-use` dependencies to maintain consistency with the new structure.

* chore(typescript): version packages (canary)

* Docs/update/fic (#889)

* refactor(docs): format documentation page entries for consistency

- Updated the `docs.json` file to format the `pages` entries as arrays for better readability and consistency across different groups.
- Ensured that all `pages` attributes are uniformly structured, enhancing the overall organization of the documentation.

* refactor(docs): improve documentation for dual-protocol widget migration

- Updated documentation to clarify the migration process from `appsSdk` to `mcpApps`, including the new `metadata` format.
- Added detailed examples and a migration checklist to assist developers in transitioning to the dual-protocol support.
- Enhanced organization and clarity of the documentation for better usability.

* chore(typescript): version packages (canary)

* refactor(product-search-result): update widget descriptions for MCP Apps consistency (#890)

- Revised text in the ProductSearchResult widget to replace references from "OpenAI apps sdk" to "mcp-apps specification" for clarity.
- Updated the template title from "Apps SDK Template" to "MCP-Apps Template" and adjusted the description to reflect the new naming conventions, enhancing consistency across the documentation and user experience.

* chore(typescript): version packages (canary)

* refactor(product-search-result): update widget configuration and impr… (#891)

* refactor(product-search-result): update widget configuration and improve HTML injection for MCP Apps

- Cleared the connectDomains in the product search result widget to enhance security.
- Removed the title prop from the Accordion component to simplify its usage.
- Preserved devServerBaseUrl during HTML injection in shared routes for better compatibility with MCP Apps.
- Enhanced the logging notification system in the MCP Apps Bridge to handle serialization of console arguments, improving error handling and preventing DataCloneError.
- Updated protocol helpers to ensure proper merging of UI metadata, maintaining resourceUri integrity.

These changes collectively improve the configuration and functionality of widgets within the MCP Apps framework, enhancing security and usability.

* refactor(ci): update template configurations for consistency across workflows

- Replaced the `mcp-ui` template with `blank` in CI workflows to streamline template options.
- Removed outdated logging tips related to the `mcp-ui` template in the create-mcp-use-app package, enhancing clarity for developers.

These changes improve the consistency and clarity of template usage in the CI processes and documentation.

* refactor(inspector): enhance MCP Apps debugging and widget integration

- Improved the MCPAppsRenderer and ToolResultDisplay components for better performance and maintainability.
- Streamlined the handling of widget state and logging within the inspector, enhancing debugging capabilities for MCP Apps.
- Updated documentation to clarify the dual-protocol support and provide clearer instructions for developers.

These changes collectively enhance the developer experience by optimizing component performance and improving the clarity of documentation for MCP Apps integration.

* chore(typescript): version packages (canary)

* chore(package): add lodash override to package.json templates

* chore(typescript): version packages (canary)

* feat(mount-mcp): add helper function to construct full URL with proxy headers

- Introduced `getFullUrl` function to handle URL construction considering proxy headers, improving compatibility for production deployments.
- Updated landing page generation to use the constructed full URL instead of the raw request URL, enhancing accuracy in response handling.

* refactor(weather): simplify weather response in starter template

- Updated the weather response in the starter template to return a static sunny message instead of fetching real-time data, streamlining the functionality for demonstration purposes.

* chore(typescript): version packages (canary)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-26 16:41:17 -08:00
Luigi Pederzani b45d9663ec feat(python): introduce roots support in MCPClient and Server (#751)
* fix(python): expose client capabilities to MCP servers

Add list_roots_callback support to Python connectors to properly
advertise the roots capability during MCP initialization handshake.

Previously, the Python library was not exposing any client capabilities
because the list_roots_callback was not being passed to ClientSession.
This fix ensures the roots capability is always advertised, bringing
the Python library in line with the TypeScript implementation.

Changes:
- Add roots and list_roots_callback params to BaseConnector
- Add get_roots() and set_roots() methods for managing roots
- Pass list_roots_callback to ClientSession in all connectors
- Export Root type from connectors module
- Update unit tests to expect list_roots_callback parameter

Closes MCP-1063

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(python): add roots and list_roots_callback params to connectors

- Add roots and list_roots_callback parameters to StdioConnector,
  HttpConnector, and SandboxConnector constructors
- Add comprehensive unit tests for client capabilities exposure
- Tests verify roots capability, get_roots(), set_roots(), and
  that all callbacks are correctly passed to ClientSession

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: fix import sorting and update API documentation

- Fix import sorting in test_client_capabilities.py (ruff)
- Regenerate API documentation for updated connector classes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(python): add list_roots() method to server Context

Allow MCP servers to request the list of roots from connected clients
via ctx.list_roots(). This follows the same pattern as ctx.sample()
and ctx.elicit() for server-to-client requests.

* feat(python): add roots params to MCPClient and config

- Add roots and list_roots_callback parameters to MCPClient.__init__,
  from_dict(), and from_config_file() methods
- Update create_connector_from_config() to pass roots params to all
  connector types (Stdio, HTTP, Sandbox)
- Allows clients to configure roots at the MCPClient level and have
  them propagate to all sessions

* test(python): add get_client_roots tool to primitive server

Add a tool that demonstrates the roots capability by requesting and
returning the list of roots from the connected client. Used for
integration testing of the roots feature.

* test(python): add integration tests for roots capability

Add comprehensive integration tests for the roots feature:
- test_roots_capability: Verify server can request/receive roots
- test_roots_empty_by_default: Verify empty roots when not provided
- test_roots_with_custom_callback: Verify custom callback precedence
- test_set_roots_updates_server_view: Verify dynamic root updates

* test(python): update unit tests for roots parameters

Update mock assertions in test_client.py to expect the new roots
and list_roots_callback parameters in create_connector_from_config
calls.

* ci(python): add roots to primitive tests and README badge

- Add roots to CI workflow primitive test matrix
- Add roots to PR comment report primitives list
- Add Roots badge to README Primitives row

* feat(docs): enhance MCP client and server documentation for roots feature

- Added `roots` and `list_roots_callback` parameters to MCP client initialization documentation.
- Updated `create_connector_from_config` documentation to include new parameters.
- Introduced `list_roots` method documentation in server context, detailing its usage and return values.
- Improved overall clarity and completeness of API reference for better developer guidance.

* feat(python): add get_client_roots tool to context example

- Introduced a new tool, `get_client_roots`, to the context example, demonstrating how to retrieve and display the list of roots exposed by the client.
- Updated documentation to include the new tool and its functionality, enhancing the example's coverage of context features.

* feat(docs): add roots documentation for client and server

- Introduced new documentation for the `roots` feature, detailing how clients can expose file system roots to MCP servers and how servers can access these roots.
- Added examples for configuring roots in the MCP client and using the `list_roots()` method in the server context.
- Enhanced overall clarity and usability of the documentation to support developers in implementing the roots functionality.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
2026-01-12 11:16:09 +01:00
Enrico Toniato 53fb6703be Merge canary: Multi-server MCP client, telemetry refactor, and UI enhancements (#730)
* Feat/inspector/open in (#717)

* fix(docs): update title and description for Google Cloud Run deployment guide

* feat(docs): enhance command palette with "Add to Client" functionality

- Introduced new "Add to Client" section in the command palette documentation, detailing actions for adding the current MCP server to various AI clients and code editors.
- Updated the index and command palette files to reflect the new feature, including installation methods and usage instructions.
- Added visual aids to improve user understanding of the new functionality.

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* test: add tests to ensure mcp-use/react and mcp-use/browser do not import Node.js dependencies (#729)

* test: add tests to ensure mcp-use/react and mcp-use/browser do not import Node.js dependencies

- Introduced a new test file to verify that the built outputs of mcp-use/react and mcp-use/browser do not include Node.js built-in modules or Node.js-specific npm packages.
- Implemented checks for both static analysis and runtime behavior to ensure compliance with browser compatibility.
- The tests are expected to fail initially, highlighting any existing Node.js dependencies in the bundles.

* refactor(logging): remove Winston dependency and enhance SimpleConsoleLogger

- Eliminated the Winston logger integration, simplifying the logging mechanism to use only the SimpleConsoleLogger across all environments.
- Updated the Logger class to configure and manage instances of SimpleConsoleLogger, allowing for customizable log formats (minimal, detailed, emoji).
- Adjusted the logging methods to ensure consistent behavior without relying on Node.js-specific modules, improving compatibility with browser environments.
- Cleaned up the codebase by removing unused imports and functions related to Winston.

* feat(telemetry): enhance browser compatibility and logging functionality

- Updated the telemetry system to ensure compatibility with both browser and Node.js environments by introducing a new `telemetry-browser.ts` file.
- Refactored the logging methods in `SimpleConsoleLogger` to support additional arguments, improving log message formatting.
- Adjusted the `RemoteAgent` and various utility functions to safely access environment variables, ensuring they work seamlessly in browser contexts.
- Added tests to verify that the `mcp-use/react` and `mcp-use/browser` modules do not import Node.js dependencies, reinforcing browser compatibility.

* fix(inspector): update imports for server-side compatibility

- Changed the import statements for MCPAgent and MCPClient to use the main entry point instead of the browser-specific version, ensuring proper functionality in server-side contexts.

* chore(pnpm-lock): remove unused dependencies and clean up lock file

- Removed several unused packages from the pnpm-lock.yaml file, including Winston and related dependencies, to streamline the project and reduce potential security vulnerabilities.
- Cleaned up the lock file by eliminating optional dependencies that are no longer required, ensuring a more efficient package management experience.

* refactor(telemetry): improve compatibility checks and logging

- Enhanced the `telemetry-browser.ts` and `telemetry-node.ts` files to ensure better compatibility with various environments by adding checks for `localStorage` and `crypto` availability.
- Updated logging to provide more informative debug messages for potential issues, particularly in private browsing scenarios.
- Refactored the `secureRandomString` function to handle ESM-only environments gracefully, ensuring consistent behavior across different Node.js versions.

* feat(inspector): integrate MCP proxy utilities and enhance configuration handling

- Added utility functions from `mcp-use/utils` to streamline proxy configuration in the Inspector components.
- Updated `vite.config.ts` to include the new utility path and optimize dependencies.
- Refactored `InspectorDashboard` and `McpContext` to utilize the new `applyProxyConfig` function for cleaner URL and header management.
- Mounted MCP proxy middleware in `shared-routes.ts` to handle proxy requests more efficiently.
- Exported utility functions from `mcp-use` for better accessibility across the project.

* feat(auth): add OAuth token handling to useMcp hook

- Introduced `authTokens` state in the `useMcp` hook to store OAuth tokens upon successful authentication.
- Updated the `UseMcpResult` type to include `authTokens` for better integration with OAuth workflows.
- Enhanced error handling in the `HttpConnector` by removing SSE fallback message for clarity.

* feat(inspector): add server icon support in Inspector components

- Enhanced `ServerIcon` component to accept a `serverIcon` prop for displaying a Base64-encoded icon.
- Updated `InspectorDashboard` and `ServerList` components to pass the `serverIcon` from `connection.serverInfo`.
- Introduced `ensureIconLoaded` method in `useMcp` hook to manage icon loading and availability.
- Added utility function for favicon detection to improve icon handling.

* fix(inspector): clean up imports and enhance component structure

- Removed duplicate imports in `ServerList.tsx` for better clarity and organization.
- Adjusted the export statement in `index.ts` to ensure `proxy-config.js` is included, improving utility accessibility.
- Reformatted import statements in `types.ts` for consistency and readability.

* feat(inspector): implement embedded mode support and enhance component interactions

- Added support for embedded mode in the `App`, `Layout`, and `McpProvider` components, allowing for dynamic configuration based on URL parameters.
- Updated `LayoutHeader` and `AddToClientDropdown` components to conditionally render elements based on the embedded state, improving user experience in embedded contexts.
- Refactored utility functions for generating deep links and configuration commands to streamline integration with various clients.
- Introduced new utility functions in `mcpClientUtils` for better handling of server configurations and commands.

* chore: changeset

* chore(typescript): version packages (canary)

* fix(inspector): update root path redirection to preserve query parameters

* chore: changeset (#731)

* chore(typescript): version packages (canary)

* Potential fix for code scanning alert no. 55: Shell command built from environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Feat/client-react-provider (#733)

* refactor(inspector): enhance application structure and multi-server support

- Introduced McpClientProvider to manage multiple MCP server connections, allowing dynamic addition and removal of servers.
- Updated App component to include McpClientProvider and reorganized routing structure for better clarity.
- Refactored InspectorDashboard to simplify server connection handling and improve UI responsiveness.
- Enhanced McpContext to support new server management features, including notification and request handling.
- Added a new example demonstrating multi-server management in a React application.

This refactor improves the overall architecture and usability of the inspector, facilitating better server management and user experience.

* refactor(inspector): update components for improved server management and UI enhancements

- Refactored App component to integrate LocalStorageProvider for managing server connections.
- Updated InspectorDashboard and related components to utilize new McpClientProvider for better server state handling.
- Simplified connection settings by removing deprecated transport types and ensuring consistent use of HTTP.
- Enhanced CommandPalette and ServerDropdown components to improve server icon handling and display.
- Removed obsolete McpContext and adjusted imports across components for cleaner architecture.

These changes enhance the overall structure and usability of the inspector, facilitating better server management and user experience.

* feat(logging): filter out noisy endpoints from request logging

- Added functionality to skip logging for specific noisy endpoints that generate excessive log entries, such as telemetry and RPC stream paths.
- Ensured that requests to these paths are still processed without logging, improving log clarity and reducing spam.

* feat(logging): enhance debugging in Layout and useAutoConnect components

- Added detailed logging in the Layout component to track MCP client context values, including server status and storage loading.
- Improved logging in the useAutoConnect hook to provide insights during the auto-connect process, including checks for configuration loading and query parameters.
- These enhancements facilitate better debugging and monitoring of server connection states and application behavior.

* fix(inspector): correct server connection retrieval in OpenAIComponentRenderer

- Updated the method for retrieving the server connection in OpenAIComponentRenderer to directly access the connections array, improving clarity and functionality in server management.

* feat(mcp-agent): export MCPAgent for browser usage with BrowserMCPClient

- Updated the browser entry point to export MCPAgent, enabling its use in the browser when provided with a BrowserMCPClient instance or through RemoteAgent.
- Adjusted import statements in mcp_agent.ts to dynamically import MCPClient, ensuring compatibility with browser environments.

* feat(inspector): enhance UI components and improve responsiveness

- Updated AddToClientDropdown to include new icons and improved button layout for better user experience.
- Adjusted LayoutHeader to change visibility of the Github label based on screen size.
- Refactored LogoAnimated to hide additional information on smaller screens.
- Enhanced PromptsTab and ResourcesTab with new imports and improved error handling for results.
- Updated ServerDropdown to adjust padding for better alignment.
- Improved ToolsTab with additional imports and responsive design adjustments.

These changes collectively enhance the user interface and responsiveness of the inspector components.

* fix(inspector): resolve layout issues in responsive components

- Corrected alignment and visibility issues in various inspector components to enhance user experience on different screen sizes.
- Adjusted styles in AddToClientDropdown, LayoutHeader, and ServerDropdown for improved responsiveness.
- Ensured consistent behavior across PromptsTab and ResourcesTab with better error handling.

These fixes collectively improve the layout and usability of the inspector on various devices.

* fix(server-lifecycle): remove SSE endpoint from server startup logs

- Updated the server startup log message to exclude the SSE endpoint, simplifying the output for clarity.
- This change enhances the readability of the server's listening information during startup.

* feat(inspector): add global sampling and elicitation request handling

- Implemented toast notifications for sampling and elicitation requests in the App component, enhancing user interaction and response management.
- Updated McpClientProvider to support global callbacks for handling sampling and elicitation requests, allowing for centralized processing.
- Refactored server handling in McpServerWrapper to include new global request handlers, improving the overall request management architecture.
- Adjusted package.json scripts in the elicitation example for consistency with the mcp-use command structure.

These changes collectively improve the user experience by providing immediate feedback on sampling and elicitation requests, while also enhancing the underlying architecture for better request handling.

* chore(typescript): version packages (canary)

* feat(inspector): enhance URL parameter handling in Inspector components

- Updated InspectorDashboard, Layout, and useAutoConnect to preserve both tunnelUrl and tab parameters in navigation.
- Improved query parameter management by utilizing URLSearchParams for cleaner and more maintainable code.
- Added validation for tab parameters to ensure only valid tab types are set, enhancing user experience and navigation consistency.

* chore(typescript): version packages (canary)

* feat(inspector): improve URL navigation handling in useAutoConnect hook

- Enhanced the useAutoConnect hook to utilize URLSearchParams for constructing navigation URLs, preserving tunnelUrl and tab parameters.
- This change simplifies the URL management and improves the overall user experience during navigation.

* chore(typescript): version packages (canary)

* feat(inspector): update AddToClientDropdown and LayoutHeader for improved SDK integration

- Modified AddToClientDropdown to accept serverId and enhance dropdown item handling.
- Updated LayoutHeader to integrate TypeScript and Python SDK options, improving user experience for adding clients.
- Enhanced modal rendering and button interactions for better usability.
- Adjusted code formatting in dropdown content for improved readability.

* fix(inspector): resolve layout and responsiveness issues in inspector components

- Corrected alignment and visibility problems in AddToClientDropdown, LayoutHeader, and ServerDropdown for improved user experience across devices.
- Enhanced error handling in PromptsTab and ResourcesTab to ensure consistent behavior.
- Adjusted styles for better responsiveness and usability in various screen sizes.

* chore(typescript): version packages (canary)

* fix(http): reduce default timeout for HttpConnector from 30 seconds to 10 seconds and adjust connection timeout handling

* chore(typescript): version packages (canary)

* fix(react): optimize mcpOptions handling in McpClientProvider to prevent render loops

- Memoized the options passed to useMcp to avoid unnecessary re-renders.
- Extracted callback options to streamline the component's performance.

* fix(react): prevent duplicate scheduling of auto-retry in useMcp hook

- Introduced a ref to track if a retry is already scheduled, avoiding potential render loops.
- Reset the scheduling ref when the connection state changes from failed to another state.

* fix(react): enhance state management in McpClientProvider and useMcp hook

- Renamed variable for clarity in McpClientProvider to improve readability.
- Updated state comparison logic to use a single reference for previous server state, reducing redundancy.
- Introduced refs for function callbacks in useMcp to prevent stale closures and circular dependencies.
- Ensured that retry logic utilizes updated refs to maintain correct behavior during connection attempts.

* fix(react): improve error handling and state management in useMcp hook

- Enhanced error handling logic in useMcp to provide clearer feedback during connection failures.
- Updated state management to ensure accurate tracking of connection status and retries.
- Refactored code for better readability and maintainability.

* chore(typescript): version packages (canary)

* Refactor: Use 'open' package to open browser

Co-authored-by: tonxipad <tonxipad@gmail.com>

* feat(widgets): enhance HMR configuration for better cross-platform support

- Added explicit HMR configuration with WebSocket protocol for improved compatibility.
- Enabled polling for file watching on Linux to address reliability issues in various environments.
- Set polling interval to 100ms for more responsive updates during development.

* feat(inspector): add parsePortFromArgs function to handle port argument parsing

- Introduced a new utility function to parse the port from command line arguments, allowing for dynamic port configuration.
- Updated server.ts to import the new function for enhanced server setup flexibility.

* chore(typescript): version packages (canary)

* 📝 Add docstrings to `canary`

Docstrings generation was requested by @tonxxd.

* https://github.com/mcp-use/mcp-use/pull/730#issuecomment-3711382419

The following files were modified:

* `libraries/typescript/packages/inspector/src/client/App.tsx`
* `libraries/typescript/packages/inspector/src/client/components/CommandPalette.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ConnectionSettingsForm.tsx`
* `libraries/typescript/packages/inspector/src/client/components/InspectorDashboard.tsx`
* `libraries/typescript/packages/inspector/src/client/components/Layout.tsx`
* `libraries/typescript/packages/inspector/src/client/components/LayoutHeader.tsx`
* `libraries/typescript/packages/inspector/src/client/components/LogoAnimated.tsx`
* `libraries/typescript/packages/inspector/src/client/components/OpenAIComponentRenderer.tsx`
* `libraries/typescript/packages/inspector/src/client/components/PromptsTab.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ResourcesTab.tsx`
* `libraries/typescript/packages/inspector/src/client/components/SdkIntegrationModal.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ServerCapabilitiesModal.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ServerConnectionModal.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ServerDropdown.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ServerIcon.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ServerList.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ToolsTab.tsx`
* `libraries/typescript/packages/inspector/src/client/components/chat/AssistantMessage.tsx`
* `libraries/typescript/packages/inspector/src/client/components/logging/JsonRpcLoggerView.tsx`
* `libraries/typescript/packages/inspector/src/client/components/prompts/PromptMessageCard.tsx`
* `libraries/typescript/packages/inspector/src/client/components/prompts/PromptResultDisplay.tsx`
* `libraries/typescript/packages/inspector/src/client/components/shared/MarkdownRenderer.tsx`
* `libraries/typescript/packages/inspector/src/client/components/ui/client-icons.tsx`
* `libraries/typescript/packages/inspector/src/client/context/InspectorContext.tsx`
* `libraries/typescript/packages/inspector/src/client/hooks/useAutoConnect.ts`
* `libraries/typescript/packages/inspector/src/server/server.ts`
* `libraries/typescript/packages/inspector/src/server/shared-static.ts`
* `libraries/typescript/packages/inspector/src/server/shared-utils-browser.ts`
* `libraries/typescript/packages/inspector/src/server/utils.ts`
* `libraries/typescript/packages/mcp-use/src/agents/utils/llm_provider.ts`
* `libraries/typescript/packages/mcp-use/src/logging.ts`
* `libraries/typescript/packages/mcp-use/src/observability/langfuse.ts`
* `libraries/typescript/packages/mcp-use/src/react/McpClientProvider.tsx`
* `libraries/typescript/packages/mcp-use/src/react/rpc-logger.ts`
* `libraries/typescript/packages/mcp-use/src/server/logging.ts`
* `libraries/typescript/packages/mcp-use/src/server/utils/server-lifecycle.ts`
* `libraries/typescript/packages/mcp-use/src/server/widgets/mount-widgets-dev.ts`
* `libraries/typescript/packages/mcp-use/src/telemetry/telemetry-browser.ts`
* `libraries/typescript/packages/mcp-use/src/telemetry/telemetry-node.ts`
* `libraries/typescript/packages/mcp-use/src/utils/favicon-detector.ts`
* `libraries/typescript/packages/mcp-use/src/utils/mcpClientUtils.ts`

* feat(inspector, layout): implement updateServer functionality for connection management

- Added `updateServer` method to handle server configuration updates in both InspectorDashboard and Layout components.
- Introduced state management to track concurrent updates and prevent race conditions during connection updates and reconnections.
- Enhanced error handling for connection updates to provide clearer feedback in case of failures.

* fix: ensure consistent formatting by adding missing newlines at the end of multiple files

- Added newlines at the end of several TypeScript files to adhere to coding standards and improve compatibility with various tools.
- Files modified include components, hooks, and server utilities across the inspector and mcp-use packages.

* chore(typescript): version packages (canary)

* chore(deps): add @types/node@25.0.2 to package.json and pnpm-lock.yaml

* chore(typescript): version packages (canary)

* refactor: update modelcontextprotocol-sdk references to new package name

- Replaced all instances of `@mcp-use/modelcontextprotocol-sdk` with `@modelcontextprotocol/sdk` across various files.
- Updated version in `package.json` and `pnpm-lock.yaml` to `1.25.1`.
- Adjusted import paths in components, utilities, and tests to reflect the new package structure.
- Ensured compatibility with existing code by maintaining type imports and functionality.

* feat(inspector): enhance client configuration and UI components

- Added support for client exports in the build process by introducing a new build script for client exports in `package.json`.
- Enhanced the `CommandPalette` and `SdkIntegrationModal` components to utilize local utility functions instead of external dependencies.
- Introduced a new CSS animation for status indicators in `index.css`.
- Updated the `LayoutHeader` component to conditionally display notification dots based on tab activity.
- Removed the deprecated `AddToClientDropdown` component and adjusted related imports accordingly.
- Improved client configuration examples in the `notification-client` and `sampling-client` files to include client identification for better server-side logging.
- Cleaned up unused imports and ensured consistent formatting across several files.

* fix: pin zod version to 3.24.4 for compatibility with modelcontextprotocol/sdk

- Updated the temporary deno.json in the TypeScript PR preview workflow to use zod@3.24.4, ensuring compatibility with @modelcontextprotocol/sdk@1.25.1.
- Adjusted import URLs to include the pinned zod version as a dependency.

* chore(typescript): version packages (canary)

* fix: update zod version handling in TypeScript PR preview workflow

- Modified the temporary deno.json to use zod from npm instead of pinning to a specific version, resolving potential version conflicts between mcp-use and @modelcontextprotocol/sdk.
- Adjusted import paths to accommodate the new zod versioning and subpath imports.

* fix: refine zod version mapping in TypeScript PR preview workflow

- Updated the temporary deno.json to implement a hybrid mapping for zod, addressing conflicting version requirements between SDK and other dependencies.
- Adjusted import paths to ensure compatibility with both zod v3 and v4, utilizing esm.sh for consistent environment resolution.

* fix: enhance zod version mapping in TypeScript PR preview workflow

- Updated the deno.json to include additional zod subpath imports, ensuring compatibility with both zod v4 and its mini version.
- Adjusted import URLs to reflect the new zod versioning structure, maintaining consistency in the PR preview environment.

* docs: add troubleshooting section for Zod version conflicts in Supabase deployment

- Introduced a new section addressing the "custom is not a function" error related to Zod version conflicts during Deno/Supabase deployments.
- Provided solutions for using npm specifiers in deno.json to resolve compatibility issues between Zod v3 and v4.
- Included example configurations for both npm and esm.sh imports to guide users in managing dependencies effectively.

* chore(typescript): version packages (canary)

* docs: update inspector documentation and changelog

- Added a new "Changelog" section to the inspector documentation for version history and updates.
- Expanded the changelog with multiple updates, including bug fixes, documentation enhancements, and major improvements in browser compatibility and multi-server support.

* docs: improve elicitation documentation for TypeScript client

- Enhanced clarity and formatting in the elicitation documentation, including better structure for modes and parameters.
- Updated code examples for consistency in quotation marks and improved readability.
- Added notes on validation flows and best practices for client-side and server-side validation.
- Ensured all sections are clearly defined and easy to follow for users implementing elicitation in their applications.

* docs: format pages in docs.json for improved readability

- Reformatted the "pages" entries in the docs.json file to use a consistent multi-line structure for better clarity and organization.
- Ensured all groups have a uniform format, enhancing the overall maintainability of the documentation structure.

* ci: add dev command testing to CI workflow

- Implemented a new job in the CI workflow to test the development command without the --dev flag.
- The job starts the dev server in the background, waits for it to initialize, and then stops it, ensuring the server starts and stops successfully.
- Adjusted the shell option in the TypeScript CLI to use the platform-specific shell on Windows for better compatibility.

* ci: add dev command testing to CI workflow & fix issue [#742](https://github.com/mcp-use/mcp-use/issues/742)

* chore(typescript): version packages (canary)

* fix(ci): improve Windows process termination in CI workflow

- Enhanced the method for killing the development server on Windows by using port-based identification for more reliable process termination.
- Added a fallback to the existing process tree kill method to ensure robustness in stopping the server.

* chore(typescript): version packages (canary)

* chore(docs): update changelog for TypeScript and inspector

- Updated changelog entries for TypeScript and inspector documentation to include new features, enhancements, and bug fixes.
- Improved clarity by adding descriptions to version labels and restructuring sections for better readability.
- Notable updates include multi-server support, browser compatibility improvements, and enhanced RPC logging.

* chore(docs): update changelog for inspector and TypeScript

- Revised changelog entries to reflect recent updates, including new features, enhancements, and bug fixes.
- Improved organization and clarity of version labels and descriptions.
- Notable changes include the addition of browser telemetry, improved server middleware, and various bug fixes across components.

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-01-06 10:11:10 +01:00
Enrico Toniato 8a2e84e1ca Canary (#669)
* chore/typescript/package visibility (#654)

* cli - update

* create-mcp-use-app - update

* inspector - update

* mcp-use - update

* canary-changeset

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* Fix mcp agent prompts (#655)

* Refactor: Include resources and prompts in agent tool creation

Co-authored-by: tonxipad <tonxipad@gmail.com>

* feat: Add support for MCP resources and prompts

This commit introduces the ability to load and convert MCP resources and prompts into tools. The `BaseAdapter` now includes abstract methods `convertResource` and `convertPrompt`, and concrete implementations are provided in `LangChainAdapter`. The `MCPAgent` and `ServerManager` have been updated to utilize these new functionalities, allowing agents to leverage a broader range of MCP capabilities beyond just tools.

Co-authored-by: tonxipad <tonxipad@gmail.com>

* refactor(langchain_adapter): default all MCP prompt arguments to string type

Updated the LangChainAdapter to ensure that all MCP prompt arguments default to string type due to the absence of type definitions in the Prompt specification. This change simplifies the argument handling and enhances type safety in the schema generation process.

* fix: ruff lint

* fix: streamline server connection message formatting

Removed unnecessary line breaks in the connection message for improved readability. The message now presents a more concise format while maintaining clarity about the number of available tools, resources, and prompts after connecting to the MCP server.

* chore: update TypeScript preview package publishing command to use pnpm flag

Modified the GitHub Actions workflow for TypeScript PR previews to include the `--pnpm` flag in the package publishing command, ensuring compatibility with the pnpm package manager.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>

* chore(typescript): version packages (canary)

* feat(mcp-use): enhance session management with HEAD request support a… (#659)

* feat(mcp-use): enhance session management with HEAD request support and idle cleanup improvements

- Added handling for HEAD requests in the mountMcp function to support keep-alive and health checks.
- Updated the startIdleCleanup function to close associated transports during session cleanup, preventing errors on reconnection with expired session IDs.
- Enhanced documentation to clarify the new behavior and parameters for idle cleanup.

* feat(telemetry): enhance telemetry tracking and browser support

- Added support for browser environments in the Telemetry class, including dynamic imports of posthog-js for event tracking.
- Introduced new events: ClientAddServerEvent and ClientRemoveServerEvent for better server management tracking.
- Improved telemetry source management and user identification methods for both Node.js and browser contexts.
- Refactored existing methods for better clarity and maintainability, including the initialization of PostHog clients based on the runtime environment.
- Updated event capturing logic to handle both Node.js and browser clients effectively.

* chore(typescript): version packages (canary)

* Docs/agent/refactor (#658)

* chore(ci): enhance TypeScript workflow with matrix strategy for Node.js versions

- Updated the CI workflow to implement a matrix strategy for TypeScript jobs, allowing tests to run on Node.js versions 18, 20, and 22.
- Adjusted Node.js setup steps to dynamically use the specified version from the matrix.
- Renamed job names to reflect the Node.js version being used for better clarity in CI logs.

* feat(mcp-use): add CommonJS support and examples

- Updated package.json to include CommonJS exports for all modules, allowing compatibility with projects using require() syntax.
- Introduced a new CommonJS example demonstrating MCPClient usage with detailed instructions and environment requirements.
- Added a markdown file documenting CommonJS usage, highlighting key features and providing usage examples.
- Implemented a CommonJS compatibility test to ensure proper functionality when using require() syntax across various modules.
- Adjusted Node.js engine requirement in package.json to support Node.js 18.0.0 or higher.

* feat(docs): update TypeScript client documentation and structure

- Added new pages for agent and client configuration, environments, and server manager in the documentation.
- Updated existing documentation to reflect changes in the client structure and features, including the removal of deprecated sections.
- Enhanced the `docs.json` file to include new and updated pages for better navigation.
- Improved clarity in the client configuration and authentication sections, ensuring users have access to the latest information and examples.

* feat(cli): introduce mcp-use CLI client with comprehensive documentation and command support

- Added a new CLI client for interacting with MCP servers directly from the terminal, allowing users to execute commands without writing code.
- Included detailed documentation for installation, usage, troubleshooting, and examples to facilitate user onboarding.
- Implemented various commands for session management, tool interaction, and resource handling, enhancing the CLI's functionality.
- Integrated testing framework with unit and integration tests to ensure reliability and performance of the CLI commands.
- Updated package dependencies and configurations to support the new CLI features.

* feat: remove WebSocket transport support and update related components

- Eliminated WebSocket transport from the mcp-use library, including the removal of WebSocketConnector and related references in various components.
- Updated connection validation to support only HTTP and SSE protocols.
- Adjusted documentation and comments to reflect the removal of WebSocket support, ensuring clarity for users.
- Introduced a new method in MCPSession to list available tools, enhancing functionality.

* feat: enhance documentation and update CLI package for CommonJS support

- Added a CodeSandbox link to the TypeScript client documentation for interactive examples.
- Updated package.json to set the CLI as a module and changed the output file to CommonJS format.
- Modified integration tests to reflect the new CommonJS output path.
- Configured the Logger class to include console transports for improved logging visibility.

* chore: require node 20

* chore: update CLI package dependencies to latest versions

- Upgraded @vitejs/plugin-react from ^4.3.4 to ^5.1.1.
- Upgraded chokidar from ^3.6.0 to ^5.0.0.

* chore: update pnpm-lock.yaml to include React and related dependencies

- Added React, ReactDOM, and React Router DOM with specified versions to the pnpm-lock.yaml file.
- Removed duplicate entries for these packages to streamline the dependency list.

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore(typescript): version packages (canary)

* chore(typescript): version packages (canary)

* refactor(docs): update agent documentation and structure (#667)

* refactor(docs): update agent documentation and structure

- Revised the agent configuration documentation to reflect changes in LLM integration and memory management.
- Enhanced the `docs.json` file to include new and updated pages for better navigation.
- Removed the interactive chat patterns documentation as it is now integrated into the memory management section.
- Updated icons and descriptions across various documentation files for consistency and clarity.
- Introduced simplified mode support in the MCPAgent, allowing for easier configuration with string-based LLM specifications.
- Improved examples and added new sections for structured output and streaming capabilities.

* feat(api): remove Simplified MCPAgent API documentation

- Deleted the `SIMPLIFIED_AGENT_API.md` file, which contained the documentation for the simplified MCPAgent API.
- This change reflects the removal of the simplified mode documentation as part of the ongoing refactoring and consolidation of agent-related resources.

* feat(docs): update agent documentation and examples for new run options

* Fix TypeScript compilation errors

- Change MCPClient import from type-only to regular import (used as value)
- Remove async generator markers from overload signatures
- Fix boolean type assignments by adding ?? true fallback
- Fix LanguageModel import in llm_provider.ts
- Add re-exports for backward compatibility
- Remove unused eslint-disable directives

* Fix inspector build: Add node:stream stub for browser compatibility

- Add stream.js stub with PassThrough, Readable, Writable, Transform, Duplex classes
- External node:stream, node:process, child_process, fs, os in Vite build
- Prevents bundling Node.js-only modules in browser build

* chore(typescript): version packages (canary)

* feat(inspector): enhance Vite configuration and add path parsing utility (#670)

- Updated Vite configuration to include more specific aliases for Node.js modules, improving compatibility with browser builds.
- Modified widget URL construction in OpenAIComponentRenderer to remove unnecessary query parameters.
- Added a new `parse` function to the path stub, enabling path string parsing into an object with root, dir, base, ext, and name properties.
- Excluded additional Node.js-only packages from the build process to streamline dependencies.

* feat(inspector): improve favicon fetching logic in ServerIcon component (#672)

- Introduced a new utility function `getBaseDomain` to simplify domain extraction.
- Updated favicon fetching logic to handle response as JSON and cache images more effectively.
- Enhanced error handling and logging for better debugging during favicon retrieval.
- Removed commented-out code for cleaner implementation.

* feat(session): update callTool method to default args to an empty object and add requireSession method for session retrieval (#671)

* chore(typescript): version packages (canary)

* feat(cli, mcp-use): enhance Tailwind CSS configuration to include mcp-use package resources (#673)

- Updated CSS generation to dynamically calculate the relative path to the mcp-use package.
- Modified Tailwind CSS configuration to scan both the resources directory and the mcp-use package for TypeScript and JavaScript files.

* chore(typescript): version packages (canary)

* fix: drop react-router-dom in favor of react-router (#675)

* chore(typescript): version packages (canary)

* typescript release workflow pushes tags and releases (#676)

* fix release action

* Fix/server/enhance (#677)

* feat(mcp-use): add favicon support for MCP server and widgets

- Introduced a favicon configuration option in the MCPServer class to allow custom favicon paths.
- Implemented favicon route setup in the server to serve the favicon at the root URL.
- Updated documentation to include examples for configuring favicons in server setup.
- Cleaned up widget directories on file deletions to maintain a tidy development environment.

* feat(mcp-use): enhance widget data handling and metadata extraction

- Updated OpenAIComponentRenderer to improve state management for tool input and output.
- Added extraction of widget properties from metadata for better integration with the MCP framework.
- Enhanced the useWidget hook to support tool input and output, including a pending state for tool execution.
- Modified WidgetData interface to include optional toolResponseMetadata for improved data handling.
- Updated server-side utilities to ensure consistent handling of widget props and tool output across the application.

* chore(typescript): version packages (canary)

* chore(mcp-use): update package version and add client entry in package.json (#679)

* chore(mcp-use): update package version and add client entry in package.json

- Bumped version from 1.11.0-canary.7 to 1.11.0-canary.9 in package.json.
- Added client entry point in package.json for improved module exports.
- Updated tsup.config.ts to include src/client.ts in the build process.

* chore(deploy): update deno.json to include specific mcp-use client and server imports

- Added specific imports for mcp-use client and server from the PR branch.
- Included zod library version 4 in the deno.json configuration for enhanced type validation.

* Session management (#682)

* feat(mcp-use): enhance session management and transport options

- Added a new "Session Management" group in the documentation for better organization.
- Introduced automatic session recovery for HTTP/SSE transports, allowing clients to handle server restarts seamlessly.
- Updated the transport type preference to deprecate the 'sse' option in favor of 'http' and 'auto', aligning with the MCP spec 2025-11-25.
- Implemented Redis session and stream managers for improved session persistence and management.
- Added new scale testing scripts to the package.json for performance evaluation.
- Updated various types and interfaces to support new session management features and ensure backward compatibility.

* feat(mcp-use): add convenience methods for notifying clients of changes

- Introduced convenience methods: `sendToolsListChanged`, `sendResourcesListChanged`, and `sendPromptsListChanged` to simplify client notifications when tools, resources, or prompts are dynamically added or removed.
- Updated documentation to include examples for notifying clients of changes in tools, resources, and prompts, enhancing clarity and usability.

* feat(mcp-use): implement auto-detection of session mode based on Accept header

- Enhanced session management by introducing auto-detection of stateful or stateless mode based on the client's Accept header.
- Updated documentation to reflect the new behavior, ensuring compatibility with various clients like k6 and curl while maintaining SSE support for capable clients.
- Modified request handling to adapt the server's response based on client capabilities, improving overall flexibility and usability.

* feat(mcp-use): improve client notification system and session handling

- Enhanced client notification methods for dynamic updates, including `sendToolsListChanged`, `sendResourcesListChanged`, and `sendPromptsListChanged`.
- Improved session management with automatic recovery for HTTP/SSE transports and updated documentation for clarity.
- Adjusted request handling to better support client capabilities and maintain backward compatibility.

* Delete libraries/typescript/packages/mcp-use/IMPLEMENTATION_SUMMARY.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Delete libraries/typescript/packages/mcp-use/REDIS_INTEGRATION_VERIFIED.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Delete libraries/typescript/packages/mcp-use/SCALE_TESTING_IMPLEMENTATION.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Update ARCHITECTURE.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* feat(mcp-use): add Redis as an optional dependency and enhance Redis integration

- Added Redis as an optional dependency in package.json.
- Updated Redis session and stream managers to include error handling for unsupported Redis client methods.
- Introduced isRedisAvailable() function to check for Redis availability at runtime.
- Enhanced documentation to clarify Redis integration and installation instructions.

* feat(mcp-use): enhance session management with FileSystemSessionStore and auto-refresh capabilities

- Introduced FileSystemSessionStore for development environments, allowing session persistence across hot reloads.
- Added auto-refresh functionality for tools, resources, and prompts in the useMcp hook, triggered by relevant notifications.
- Updated documentation to reflect new session management architecture and usage examples.
- Improved LayoutHeader component with collapsible tabs for better UI experience.

* feat(docs): update session management documentation and add filesystem storage reference

- Added reference to new File System Storage in session management documentation, highlighting its use for development environments.
- Removed outdated comparison with other implementations from the documentation.
- Updated session management overview to include filesystem storage as a viable option for session persistence.
- Adjusted related documentation links to ensure consistency and clarity.

* refactor(docs): streamline Supabase deployment documentation and remove scale testing guide

- Updated the Supabase deployment documentation to use a local icon path for better resource management.
- Removed the scale testing guide as it was deemed unnecessary, simplifying the documentation structure.

* feat(ui): add collapsible tabs to LayoutHeader for improved navigation

- Introduced a CollapseButton component to toggle tab visibility in the LayoutHeader.
- Updated Tabs component to support collapsed state, enhancing user experience.
- Adjusted styles for smoother transitions and improved accessibility with tooltips.
- Refactored tab rendering logic to accommodate the new collapsible feature.

* refactor(tests): remove outdated Redis integration tests and related documentation

- Deleted manual integration tests for Redis session management and related README files to streamline the testing suite.
- Removed scale testing scripts and configuration files that were no longer necessary, simplifying the project structure.
- Updated the remaining test documentation to reflect the changes and ensure clarity for future testing efforts.

* feat(redis): enhance Redis client interface and session management

- Added support for Redis SET operations with sAdd, sRem, and sMembers methods in the RedisClient interface.
- Updated RedisSessionStore to utilize SET for tracking active sessions, improving performance and reducing blocking operations.
- Modified RedisStreamManager to manage active sessions using SET instead of KEYS, ensuring non-blocking behavior.
- Added warnings in documentation regarding the use of KEYS command in production environments.
- Enhanced session cleanup logic to include removal of active sessions from the SET.

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore(typescript): version packages (canary)

* Fix/server/enhance (#678)

* feat(mcp-use): add favicon support for MCP server and widgets

- Introduced a favicon configuration option in the MCPServer class to allow custom favicon paths.
- Implemented favicon route setup in the server to serve the favicon at the root URL.
- Updated documentation to include examples for configuring favicons in server setup.
- Cleaned up widget directories on file deletions to maintain a tidy development environment.

* feat(mcp-use): enhance widget data handling and metadata extraction

- Updated OpenAIComponentRenderer to improve state management for tool input and output.
- Added extraction of widget properties from metadata for better integration with the MCP framework.
- Enhanced the useWidget hook to support tool input and output, including a pending state for tool execution.
- Modified WidgetData interface to include optional toolResponseMetadata for improved data handling.
- Updated server-side utilities to ensure consistent handling of widget props and tool output across the application.

* chore(mcp-use): update package version and add client entry in package.json

- Bumped version from 1.11.0-canary.7 to 1.11.0-canary.9 in package.json.
- Added client entry point in package.json for improved module exports.
- Updated tsup.config.ts to include src/client.ts in the build process.

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Update documentation links and clean up references

- Removed duplicate links in the agent configuration documentation.
- Updated the examples link in the CLI documentation to point to the correct server examples.
- Corrected the Tools guide link in the tools documentation to ensure proper navigation.
- Adjusted the Building Agents link in the useMCP documentation to reflect the new path in the advanced section.

* Refactor RedisStreamManager to remove unnecessary whitespace and improve code readability in session cleanup logic.

* Update API key masking in whoamiCommand to show first 6 characters instead of 8, enhancing security and clarity in output.

* Refactor URL handling and UUID generation for improved readability in git and telemetry utilities. (#686)

* Refactor URL handling and UUID generation for improved readability in git and telemetry utilities.

* Enhance TypeScript library with new features and documentation updates

- Moved `@langchain/core` and `langchain` to optional peer dependencies.
- Removed WebSocket transport; recommended using streamable HTTP or SSE.
- Introduced session management architecture with Redis support.
- Added favicon configuration for widget pages and improved caching.
- Implemented dedicated CLI client support for better command-line integration.
- Enhanced session methods and fixed transport cleanup for idle sessions.
- Updated documentation with links for better navigation and learning resources.

* Enhance session management and improve documentation clarity (#687)

- Refactored session management architecture to streamline Redis integration.
- Updated documentation for better navigation and added new examples.
- Improved clarity in output by adjusting API key masking in whoamiCommand.
- Cleaned up code for better readability and maintainability.

* chore(typescript): version packages (canary)

* Enhance TypeScript release workflow by ensuring the latest commits are fetched and tags are pushed correctly.

- Added steps to fetch the latest commits and tags before tagging and publishing.
- Improved reliability of the release process by ensuring the correct branch is checked out and up-to-date.

* Refactor CI workflows for TypeScript and Deno testing

- Removed the temporary disabled `typescript-deno-test` job from the CI workflow.
- Enhanced the `typescript-pr-preview` workflow by adding a step to retrieve the PR number and create a temporary `deno.json` for testing.
- Implemented a wait mechanism to ensure the preview package is available on esm.sh before running Deno tests.
- Updated changeset versions for several packages from patch to minor.

* Remove outdated documentation files for building custom agents, logging, and multi-server setup in TypeScript. Update links in related documents to reflect the new structure and ensure consistency in navigation.

* Update streaming and code mode documentation with enhanced examples and video content. Removed outdated sections to improve clarity and user experience.

* Update TypeScript documentation to reflect changes in streaming methods and authentication. Removed outdated sections in streaming.mdx, streamlined examples in structured-output.mdx, and updated OAuth version in authentication.mdx for clarity and accuracy.

* Fix cli import (#689)

* fix: update imports to use mcp-use/client for better dependency management

* Refactor Deno tests for MCPServer to utilize Zod for input validation and streamline response handling. Updated deno.json to include new dependencies and improved import paths for better module resolution.

* Refactor Zod import in Deno tests and remove outdated dependency from deno.json for improved module resolution.

* Update Zod import syntax and upgrade Zod version in Deno test files for improved compatibility and module resolution.

* Enhance TypeScript PR preview workflow by adding Zod as a dependency for improved validation and module resolution.

* Update TypeScript PR preview workflow to include `?no-dts` in mcp-use imports and modify Deno test command to skip type checking for improved testing efficiency.

* chore(typescript): version packages (canary)

* chore(typescript): update dependencies and improve package configurations (#690)

* chore(typescript): update dependencies and improve package configurations

- Bump versions for several dependencies including ESLint, TypeScript, and various React-related packages.
- Update `vite` and `tailwindcss` to the latest versions for improved performance and features.
- Enhance `zod` version for better validation capabilities.
- Remove outdated `pnpm-lock.yaml` file from the React example client.
- Adjust package configurations across multiple packages for consistency and compatibility.

* chore(typescript): update package specifiers and versions in pnpm-lock.yaml

- Adjusted version specifiers for several dependencies, including React and Zod, to ensure compatibility and flexibility.
- Updated the version of `@langchain/core` and related packages to the latest stable release.
- Removed outdated entries and improved overall package configuration for better dependency management.

* chore(typescript): version packages (canary)

* Update TypeScript logging documentation to change "Next Steps" section to "Related" and adjust links for improved clarity and navigation.

* Remove changeset for "many-rocks-joke" from TypeScript library updates.

* Remove ServerDetail component and simplify user ID generation in telemetry

* chore: changeset

* chore(typescript): version packages (canary)

* Update deploy script to use latest MCP_USE_VERSION and switch import paths to npm for mcp-use and zod dependencies.

* Add blog link to navbar and include logo href in documentation

* Enhance logo display in documentation by adding noZoom attribute to images for better responsiveness.

* Update changelog for v1.11.0 release, introducing distributed session management, a new CLI client, and various enhancements and fixes across features, documentation, and testing.

* Update changelog for v1.10.0 release, highlighting API improvements, breaking changes, new features, and various enhancements and fixes related to session management and resource templates.

* Update pnpm-lock.yaml and package.json for dependency management; remove outdated example files and enhance CLI documentation.

* Refactor MCP agent examples to use updated import paths and LLM configurations; replace deprecated imports and streamline server management examples for better clarity and functionality.

* Update TypeScript configuration to use 'bundler' for module resolution and clarify MCPClient instantiation in shared-utils-browser.ts for better browser compatibility.

* Refactor TypeScript configuration to improve module resolution and enhance browser compatibility in shared-utils-browser.ts.

* Refactor pnpm-lock.yaml to reorganize example paths and update dependency links for improved project structure and consistency across server features.

* chore(typescript): version packages (canary)

* fix: inspector import

* chore(typescript): version packages (canary)

* improve deploy on supabase docs

* refactor(telemetry): enhance telemetry initialization and user ID management

- Updated the Telemetry class to improve initialization of Scarf telemetry, ensuring it only runs in server-side environments to avoid CORS issues.
- Enhanced user ID generation with fallback mechanisms for both session-based and persistent storage scenarios, improving reliability across different runtime environments.
- Refactored user ID retrieval from the filesystem to handle errors gracefully and ensure consistent behavior in various contexts.
- Improved telemetry event tracking by including runtime environment metadata, enhancing observability and debugging capabilities.

* changeset

* fix: inspector autoconnect

* fix: update conformance workflow paths for TypeScript examples

* format

* refactor(InspectorDashboard): remove debug logging and clean up code

- Removed console warning for logging connections on every render to reduce noise in the console.
- Updated GitHub icon component to use camelCase for SVG attributes, ensuring consistency with React conventions.

* fix(deploy.sh): update import paths to use ESM and enhance CSP URLs for Supabase deployment

* feat(ui-resource-registration): enhance tool definition handling with Zod schema support and legacy input conversion

* chore(typescript): version packages (canary)

* chore(typescript): version packages (canary)

* refactor(widget-metadata): update handling of Zod schemas to preserve full schema objects and improve backward compatibility

* chore(typescript): version packages (canary)

* fix: inspector rpc logs

* chore(typescript): version packages (canary)

* Potential fix for code scanning alert no. 53: Insecure randomness

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* refactor(widget-metadata): correct handling of props and inputs in widget metadata

* fix(telemetry): remove unnecessary whitespace in secureRandomString function

* chore(typescript): version packages (canary)

* docs

* fix(tests): update pattern replacement to handle all asterisks in session store and stream manager tests

* fix(telemetry): use secureRandomString for userId generation fallback

* chore(typescript): version packages (canary)

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
Co-authored-by: pederzh <luigipederzani@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-12-16 17:18:22 +01:00
Pietro Zullo ebef017114 python/server/middleware&tel (#650)
* chore: add example server pretty print JSON RPC for transparency

* updated telemetry module

* chore: agent side tel - langchain adapter - client tel

* server side tel:

* update API reference

* python transports and primitive reports are publishes only if not skipped

* remove wrongly generate files

* properly typed middleware

* remove examples

* feat(docs): add middleware and session management documentation

- Introduced new documentation for middleware, detailing hooks, minimal examples, and best practices for integrating middleware in MCP servers.
- Added a session management guide explaining session ID handling, usage patterns, and examples for managing per-client state in MCP servers.
- Updated  to include links to the new middleware and session management pages.

* generate docs

* remove few events

* adapter tel

* adapter tel

* api ref docs update

* google adapter fix

* fix version

* fix event naming

* server example is streamable and echo tool fix

* removed initialize middleware hook, initialize requests are not passed thorugh normal handlers

* api ref

* beta on middleware
2025-12-10 17:02:08 +01:00
Enrico Toniato 6ec11cdae2 Canary (#617)
* Fix/server/reafctor complete (#616)

* feat: add MCP Conformance Test Servers for Python and TypeScript (#605)

* chore(deps): bump express from 5.1.0 to 5.2.0 in /libraries/typescript (#602)

* chore(deps): bump express from 5.1.0 to 5.2.0 in /libraries/typescript

Bumps [express](https://github.com/expressjs/express) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v5.1.0...v5.2.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.2.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: add changeset for dependabot updates

* Delete libraries/typescript/.changeset/dependabot-e19bd45.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore: add changeset for dependabot updates

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* feat: add MCP Conformance Test Servers for Python and TypeScript

- Introduced a new GitHub Actions workflow for running conformance tests on both Python and TypeScript servers.
- Implemented a Python conformance server that supports various MCP features and tools.
- Developed a TypeScript conformance server with similar functionality, including tools and resources.
- Added necessary configuration files for TypeScript server setup, including package.json and tsconfig.json.
- Updated pnpm-lock.yaml to include dependencies for the new conformance server.

This commit enhances the testing framework by providing dedicated servers for conformance testing, ensuring better validation of MCP features.

* feat: enhance conformance workflow with conditional inputs

- Added workflow_dispatch inputs to allow running only Python or TypeScript conformance tests.
- Updated job conditions to skip unnecessary tests based on the selected input.
- Modified the conformance summary job to ensure it does not run if cancelled.

This update improves flexibility in running conformance tests, enabling targeted testing based on user input.

* feat: add PR comment with conformance results and remove ext-apps

* feat: show individual test results as columns in PR comment

* feat: simplify conformance PR comment table

* feat: add conformance comparison with main and canary branches

- Fix test name parsing to remove ': X passed, Y failed' suffix
- Fetch baseline results from main and canary branches
- Show comparison columns (vs Main, vs Canary) with color-coded indicators
- Show +1/-1 on individual tests that changed from baseline
- Use 🟢 for improvements, 🔴 for regressions, ⚪ for no change, 🆕 for new

* feat: prevent test name line breaks and add MCP icon

- Use non-breaking hyphens (&#8209;) in test headers to prevent wrapping
- Replace microscope emoji with MCP SVG icon in PR comments

* fix: use picture element for MCP icon with dark/light mode support

* feat: display MCP icon inline with heading with gap

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* Feature/mcp 924 implement tool elicitation support in typescript sdk tools (#606)

* chore(deps): bump express from 5.1.0 to 5.2.0 in /libraries/typescript (#602)

* chore(deps): bump express from 5.1.0 to 5.2.0 in /libraries/typescript

Bumps [express](https://github.com/expressjs/express) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v5.1.0...v5.2.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.2.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: add changeset for dependabot updates

* Delete libraries/typescript/.changeset/dependabot-e19bd45.md

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore: add changeset for dependabot updates

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore: enter canary prerelease mode

* feat(docs): add elicitation feature documentation and update client structure

- Introduced new documentation for the elicitation feature, detailing both form and URL modes for user input requests.
- Updated `docs.json` to include a new page for elicitation.
- Enhanced the `MCPClient` and related connectors to support elicitation callbacks, allowing servers to request additional user information.
- Implemented elicitation handling in various connectors (HTTP, Stdio) and updated the server context to support elicitation requests.
- Added examples for using elicitation in React components and TypeScript.

* feat: enhance elicitation feature documentation and server-side validation

- Updated documentation to clarify server-side validation with mcp-use when using Zod schemas.
- Added custom error types for elicitation validation in the mcp-use library.
- Improved MCPClient to support elicitation callbacks for better user interaction.
- Refactored elicitation ID generation to use UUID for uniqueness.
- Enhanced error handling in the server to throw specific validation errors.

* feat: add Zod dependency and implement elicitation tool in conformance server

- Updated .gitignore to exclude conformance test results.
- Added Zod as a dependency in the conformance package.
- Implemented a new elicitation tool in the conformance server, allowing for user input with validation using Zod schemas.
- Updated server feature list to include the new elicitation tool.

* feat: add elicitation tool with default values in conformance server

- Introduced a new elicitation tool that utilizes default values for various primitive types as per SEP-1034.
- Enhanced the server's ability to handle user input with validation using Zod schemas.
- Updated the server feature list to include the new elicitation tool.

* fix: resolve pre.json conflict with canary - accept newer versions

* chore: remove ELICITATION_IMPLEMENTATION.md and ext-apps from tracking

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore(typescript): version packages (canary)

* fix: update elicitation example server paths and enhance documentation (#608)

- Updated paths in documentation and examples to reflect the new `examples/server/elicitation/` structure, replacing the previous `examples/server/elicitation-test/`.
- Enhanced the elicitation feature documentation to clarify usage and examples.
- Removed deprecated example files related to the old elicitation test structure.

* chore(typescript): version packages (canary)

* chore(typescript): update package versions to patch for mcp-use and inspector

* Fix/server/json response (#609)

* feat: update dependencies and enhance server functionality

- Added new dependencies '@openai/apps-sdk-ui' and '@tanstack/react-query' to the starter template and test app.
- Updated the pnpm-lock.yaml to reflect the new dependencies and their versions.
- Modified mcp-server.ts to enable JSON response for SSE streaming.
- Refactored createExternalUrlResource, createRawHtmlResource, and createRemoteDomResource functions to return promises for better async handling.

* refactor: update create-mcp-use-app package to use React and Ink components

- Changed the build script to compile TypeScript files with JSX support.
- Replaced Inquirer with Ink components for interactive CLI prompts.
- Removed the old index.ts file, transitioning to a more modern React-based approach.
- Updated package dependencies to include React and Ink, ensuring compatibility with the new structure.
- Enhanced the TypeScript configuration to support JSX.

* chore(typescript): version packages (canary)

* chore(typescript): update mcp-use and inspector versions to minor for elicitation support

* refactor(typescript): clean up mcp-use package structure and enhance type exports

- Removed deprecated '@mcp-use/cli' and 'tsx' from devDependencies in package.json and pnpm-lock.yaml.
- Reorganized type exports in mcp-server.ts to improve clarity and accessibility of ToolContext-related types.
- Refactored logging.ts to utilize a centralized getEnv function for environment variable access.
- Updated imports in various files to reflect the new structure and removed unused code.
- Deleted the mcp-ui-adapter.ts file as it was no longer needed.

* feat(typescript): enhance mcp-use package with new dependencies and refactor server endpoints

- Added 'express' as a dependency in package.json and updated its version to 5.2.1.
- Introduced new dependencies for examples in the mcp-use package, including '@openai/apps-sdk-ui', '@tanstack/react-query', and others.
- Refactored server endpoint handling by consolidating request/response management and removing deprecated handlers.
- Improved logging functionality with a new truncate method for better JSON output.
- Cleaned up unused code and removed legacy endpoint files to streamline the package structure.

* feat(mcp-server): enhance session handling with context-aware tool registration

- Introduced context enhancement for tool handlers in the MCP server to support session-specific logic.
- Added utility functions for session context management and improved message creation within session scope.
- Refactored tool registration to wrap handlers with context-aware logic, enabling better handling of request metadata and notifications.

* feat(mcp-use): update @modelcontextprotocol/sdk version and refactor server handling

- Updated the @modelcontextprotocol/sdk dependency to version 1209 in package.json and pnpm-lock.yaml.
- Adjusted the server port in the elicitation example from 3002 to 3000 for consistency.
- Enhanced the MCP server's session handling to follow the official SDK pattern, ensuring each session has its own transport and server instance.
- Refactored the mountMcp function to utilize FetchStreamableHTTPServerTransport, improving bidirectional communication and simplifying request handling.
- Cleaned up deprecated Express-like request/response handling, streamlining the server's architecture.

* feat(mcp-server): integrate ResourceTemplate and refactor resource registration

- Imported ResourceTemplate from the SDK to enhance resource handling.
- Updated resource registration to use readCallback instead of cb for improved clarity.
- Created ResourceTemplate instances and associated metadata during resource registration, streamlining the process and ensuring better integration with the SDK.

* refactor(mcp-use): streamline server examples and update dependencies

- Removed deprecated '@mcp-use/cli' and 'tsx' from devDependencies in package.json and pnpm-lock.yaml.
- Refactored server examples to utilize new response helpers for consistency and clarity.
- Updated the MCP server examples to improve structure and remove unnecessary code.
- Enhanced the resource and prompt registration to support new callback patterns, ensuring better integration with the SDK.
- Cleaned up unused files related to elicitation tests, improving overall package organization.

* feat(mcp-use): enhance server tools and improve type handling

- Added new server tools with optional message parameters, providing default values for better usability.
- Refactored server example files to streamline tool definitions and improve clarity.
- Updated type exports to include new utility types for handling optional fields in Zod schemas, enhancing type safety and flexibility in callbacks.
- Improved server initialization by removing hardcoded port values, allowing for dynamic port assignment.
- Cleaned up unnecessary console logs and comments to enhance code readability.

* refactor(mcp-use): enhance context handling in server tools and resource registration

- Removed redundant tool definitions in server examples to streamline code.
- Improved type handling by introducing EnhancedPromptContext and EnhancedResourceContext for better access to request context.
- Updated callback signatures in resource and prompt definitions to support context-aware execution.
- Enhanced error handling and response management in server tools for improved reliability.

* refactor(mcp-use): improve context management and streamline server tools

- Enhanced context handling in server tools by refining callback signatures and introducing new context types.
- Streamlined server examples by removing redundant tool definitions and improving error handling.
- Updated resource and prompt registration processes for better integration and reliability.

* chore(conformance): remove branch restrictions from push and pull_request triggers

- Eliminated specific branch filters for push and pull_request events in the conformance workflow, allowing for broader execution on any branch changes.

* only those branches

* default 3000

* fix: update default port from 3001 to 3000 across various components

- Changed default URL and port settings in ConnectionSettingsForm, middleware, and example scripts to use port 3000.
- Updated related documentation and comments to reflect the new default port for consistency.

* fix(conformance): set TypeScript server port to 3000 for conformance tests

- Updated the conformance workflow to explicitly set the TypeScript server to run on port 3000, ensuring consistency with recent changes across components.

* chore: update @modelcontextprotocol/sdk version in package files

- Updated the version of @modelcontextprotocol/sdk from 1194 to 1209 in pnpm-lock.yaml, package.json, and deno.json to reflect the latest changes in the SDK.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore(typescript): version packages (canary)

* fix(docs): update sampling link in elicitation documentation (#618)

- Changed the sampling link in the elicitation documentation to point to the correct GitHub repository path for LLM completions, ensuring users have access to the latest examples and resources.

* Fix/server/increase conformance score (#619)

* feat(server): enhance conformance server with new audio and logging tools

- Added a new tool for returning silent audio content in WAV format.
- Updated the image tool to include a more descriptive name.
- Introduced a tool that simulates logging during execution, providing console output for tool processing steps.
- Enhanced the mixed content tool to support multiple content types, including text, image, and resource data.
- Updated prompt handling to accept new argument names for better clarity.

* refactor(mcp-server): enhance schema handling for prompts and server configuration

- Updated schema handling in McpServer and prompt registration to create parameter schemas when arguments are provided.
- Improved error handling by setting argsSchema to undefined when no schema or arguments are available, ensuring clearer validation logic.
- Refactored regex pattern in server helpers to correctly replace parameter placeholders, enhancing template URI parsing.

* feat(server): enhance audio handling and logging capabilities

- Introduced a new audio tool for returning audio content, supporting both base64 data and file paths.
- Updated server tools to utilize a logging mechanism that sends log notifications during execution.
- Enhanced resource handling to support new content types and improved error handling for logging levels.
- Refactored existing tools to streamline code and improve clarity in tool definitions.

* feat(server): implement resource subscription management and dynamic updates

- Added a new subscribable resource that can be updated and subscribed to by clients.
- Introduced a tool for updating the subscribable resource, notifying all subscribers of changes.
- Enhanced session management by cleaning up resource subscriptions when sessions are closed.
- Updated context storage to include optional session IDs for better tracking.
- Refactored idle cleanup to support session-specific resource subscription cleanup.

* feat: enhance conformance workflow with dynamic badge generation for Python and TypeScript

- Added new steps in the GitHub Actions workflow to calculate and create conformance badges for both Python and TypeScript based on test results.
- Updated README.md to include links and badges for Python and TypeScript conformance, providing users with immediate feedback on test status.

* fix action uses

* fix: update conformance workflow badge calculations and labels

- Changed the conformance badge calculation to use integer scaling for percentage rates.
- Adjusted the passing rate threshold from 80% to 60% for badge color determination.
- Updated badge labels for Python and TypeScript to reflect "MCP Conformance" instead of just the language.

* fix: enable conformance comments on forked PRs with two-workflow pattern

- Split conformance workflow into test execution and comment posting
- Created conformance-comment.yml with workflow_run trigger for full permissions
- Upload PR metadata and parsed results as artifacts
- Updated badge labels to 'MCP Conformance (TS)' and 'MCP Conformance (PY)'
- Fixed badge colors: green at 100%, yellow ≥60%, red <60%
- Resolves permission errors when posting comments on forked PRs

* feat(server): update serverBaseUrl to use environment variable helper (#625)

* feat(server): update serverBaseUrl to use environment variable helper

- Implemented a helper function to set serverBaseUrl based on MCP_URL environment variable, ensuring correct public URL usage for widgets/assets.

* fix(server): improve error handling and logging for resource management

- Enhanced error handling in resource subscription management to ensure clearer validation and logging.
- Updated logging mechanisms to provide better insights during execution, particularly for resource updates and session management.
- Refactored code for improved clarity and maintainability in server tools.

* chore(typescript): version packages (canary)

* fix: prevent code injection in conformance-comment workflow

Use environment variables instead of direct string interpolation to pass
PR metadata to the github-script action, preventing potential code injection
from untrusted input.

Addresses CodeQL security findings.

* chore: trigger conformance workflow

* feat: allow conformance comment workflow to run on push events

- Remove pull_request-only restriction from workflow trigger
- Make PR metadata download and comment posting conditional
- Workflow now runs for both push and pull_request events
- For push events, workflow completes without posting comment
- Badges remain branch-specific per existing logic in conformance.yml

* fix: revert comment workflow to PR-only events

- Comment workflow only runs for pull_request events (not push)
- For push events, there's no PR to comment on
- Conformance workflow already runs on all branch pushes for iteration
- Badges remain branch-specific (only updated for main/canary pushes)

* Docs/refactor (#633)

* quickstart

* chore: update documentation and assets

- Renamed "Getting Started" group to "Get Started" in docs.json.
- Added new SVG logo for MCP use and several images for TypeScript documentation.
- Created a new changelog file for tracking updates and improvements.
- Removed outdated security and logging documentation, and updated links in various guides.
- Introduced new response helpers and improved server logging documentation.
- Enhanced the UI widgets section to support OpenAI Apps SDK with zero boilerplate.

* refactor: update MCP server instantiation to use class constructor

- Replaced instances of `createMCPServer` with the new `MCPServer` class constructor across documentation and example files.
- Updated related documentation to reflect the new instantiation method, enhancing clarity and consistency.
- Ensured backward compatibility by retaining the `createMCPServer` function for legacy support.

* refactor: standardize MCPServer instantiation in documentation

- Updated examples to utilize the new `MCPServer` class constructor instead of the legacy `createMCPServer` function.
- Enhanced documentation clarity by providing consistent usage patterns and emphasizing the recommended instantiation method.
- Maintained backward compatibility by retaining the legacy function for existing users.

* refactor: update subscribable resource schema to use default value

- Changed the `newValue` property in the subscribable resource schema to have a default value of "Updated value".
- Updated the async function to utilize the default value, simplifying the parameter handling.

* refactor: enhance type inference and callback signatures for resource templates

- Updated the `registerResourceTemplate` function to support multiple callback signatures, improving type inference for developers.
- Removed the deprecated `ReadResourceTemplateCallbackBivariant` interface to streamline the codebase.
- Adjusted the handling of `uri` and `variables` in the server example to ensure non-null assertions, enhancing type safety.

* refactor: improve resource template registration and type safety

- Enhanced the `registerResourceTemplate` function to better support multiple callback signatures, improving developer experience.
- Removed the obsolete `ReadResourceTemplateCallbackBivariant` interface to clean up the codebase.
- Updated the handling of `uri` and `variables` in the server example to enforce non-null assertions, boosting type safety.

* chore(typescript): version packages (canary)

* refactor: streamline async callback syntax in server tools

- Updated async callback definitions in various server tools to improve consistency and readability.
- Removed unnecessary line breaks and streamlined the structure of callback functions across multiple files.
- Enhanced overall code clarity while maintaining existing functionality.

* refactor: enhance async callback handling in server tools

- Improved the structure and readability of async callback functions in server tools.
- Standardized callback definitions across multiple files for better consistency.
- Maintained existing functionality while enhancing code clarity.

* feat: add weather tools and manual widget registration

- Introduced two new server tools: `get-current-weather` and `get-weather-forecast`, utilizing the `weather-display` widget.
- Updated the README to include a manual tool registration pattern for widgets that do not auto-register.
- Enhanced the example structure to demonstrate custom tool usage and widget integration.
- Improved documentation clarity regarding widget registration and usage patterns.

* refactor: simplify input schema for get-current-weather tool

- Replaced the manual input definition with a Zod schema for the `get-current-weather` tool, enhancing type safety and readability.
- Streamlined the async callback function by removing explicit type annotations for inputs, improving code clarity.

* refactor: enhance type safety and structure in MCPServer resource registration

- Updated the `resource` and `resourceTemplate` methods in `MCPServer` to use generic types for improved type safety and clarity.
- Refactored the `uiResourceRegistration` function to accept a more generalized server context, enhancing compatibility with various resource definitions.
- Renamed `UIResourceServerContext` to `UIResourceServer` for better alignment with its purpose and updated its interface to reflect the new structure.
- Improved overall code readability and maintainability by streamlining method signatures and enhancing type definitions.

* Chore/typescript/any (#634)

* fix: add noZoom attribute to images in SimpleSplitCard component

- Added the `noZoom` attribute to image elements in the `SimpleSplitCard` component to prevent zooming effects on hover.
- Updated image tags for both light and dark mode images, as well as logos in the action links, ensuring consistent behavior across the component.

* refactor: enhance type safety and error handling in result displays

- Updated the `PromptResult`, `ResourceResult`, and `ToolResult` interfaces to use specific types instead of `any`, improving type safety.
- Refactored error handling in the `extractErrorMessage` functions across multiple components to handle new result structures, ensuring consistent error messaging.
- Improved the handling of result properties in the `onCopy` callbacks to align with the updated types, enhancing overall code clarity and maintainability.

* refactor: improve error handling and type definitions in result processing

- Enhanced error handling in the `extractErrorMessage` functions to accommodate updated result structures, ensuring consistent messaging.
- Updated `PromptResult`, `ResourceResult`, and `ToolResult` interfaces to utilize specific types, improving type safety.
- Refactored `onCopy` callbacks to align with new type definitions, enhancing code clarity and maintainability.

* chore(typescript): version packages (canary)

* fix typo

* Fix/mcp use/typing (#636)

* refactor: remove get-weather-forecast tool and update MCPServer class structure

- Removed the `get-weather-forecast` tool implementation from the server example, streamlining the codebase.
- Refactored the `MCPServer` class to `MCPServerClass` for improved clarity and updated type definitions for better type safety.
- Enhanced the `WidgetMetadata` interface to include new properties for input validation and annotations, aligning with tool naming conventions.

* refactor: enhance widget registration logic and metadata handling

- Updated the `uiResourceRegistration` function to conditionally register tools based on the `exposeAsTool` flag, improving flexibility in widget registration.
- Refactored the handling of tool metadata, ensuring that relevant fields from `appsSdkMetadata` are copied only when necessary.
- Enhanced the `createWidgetRegistration` function to extract and utilize the `exposeAsTool` flag from metadata, defaulting to true if not specified, for consistent behavior across widgets.

* feat: add tool annotations and exposeAsTool flag to resource definition

- Introduced `exposeAsTool` and `toolAnnotations` properties to the `BaseUIResourceDefinition` interface, allowing for more flexible tool registration.
- Updated the `uiResourceRegistration` function to utilize the new `exposeAsTool` property directly from the resource definition, enhancing the registration logic.

* feat: enhance widget integration and tool metadata handling

- Added support for returning interactive UI widgets from tools using the `widget()` helper and `returnsWidget` option, improving user experience in the Inspector and ChatGPT.
- Updated documentation to clarify the usage of the `widget` configuration in tool definitions, including examples for better understanding.
- Enhanced the `MCPServer` class to manage widget definitions and inject metadata into tool responses, streamlining the integration of custom tools with widgets.
- Improved type definitions for tools and widgets, ensuring better type safety and clarity in the codebase.

* Fix/server/oauth (#637)

* refactor: enhance MCPServerClass with generic OAuth support

- Updated the `MCPServerClass` to support generics for OAuth, improving type safety and flexibility in tool and resource registration methods.
- Refactored method signatures for `tool`, `prompt`, `resource`, and `resourceTemplate` to utilize the new `HasOAuth` type parameter, ensuring consistent behavior based on OAuth configuration.
- Adjusted the `McpServerInstance` and `MCPServer` types to reflect the new generic structure, enhancing clarity in type annotations for server instances.

* refactor: simplify OAuth handling in MCPServerClass

- Removed the unused `oauthConfig` property and streamlined the OAuth setup logic by directly using `oauthProvider`.
- Updated conditional checks for OAuth setup to enhance clarity and reduce redundancy in the codebase.

* chore(ci): add --dev flag to create-mcp-use-app commands in CI workflow

- Updated the CI workflow to include the `--dev` flag in both npm and yarn commands for creating test applications, ensuring development dependencies are installed correctly.

* chore(ci): update CI workflow to build and pack all packages

- Modified the CI workflow to build all packages in the TypeScript library and pack individual packages, including `create-mcp-use-app`, `mcp-use`, `@mcp-use/cli`, and `@mcp-use/inspector`.
- Updated artifact upload and download steps to handle multiple package artifacts, ensuring all necessary packages are available for testing.
- Added a step to replace workspace dependencies with file references in `package.json` for both npm and yarn test applications, improving dependency management.

* chore(ci): improve PACKAGE_PATH resolution in CI workflow

- Updated the CI workflow to enhance the resolution of the PACKAGE_PATH variable for the create-mcp-use-app package.
- Modified the logic to handle cases where multiple package files exist, ensuring the first available package is used, improving reliability in the build process.

* chore(ci): refine PACKAGE_PATH resolution in CI workflow

- Enhanced the logic for determining the PACKAGE_PATH variable in the CI workflow to ensure it correctly identifies the first available create-mcp-use-app package file, regardless of the operating system.
- Updated commands to use more reliable methods for file searching, improving consistency and robustness in the build process.

* chore(ci): update PACKAGE_PATH resolution to use realpath in CI workflow

- Modified the CI workflow to utilize `realpath` for resolving the PACKAGE_PATH variable, ensuring accurate file paths for the create-mcp-use-app package across different operating systems.
- This change enhances the reliability of package path resolution in both npm and yarn commands, improving the overall consistency of the build process.

* chore(ci): refine tarball path resolution in CI workflow

- Updated the CI workflow to improve the resolution of tarball paths for `mcp-use`, `mcp-use-cli`, and `mcp-use-inspector` packages by using `find` to ensure the first available package is correctly identified.
- This change enhances the reliability of package path resolution, ensuring accurate file paths are used during the build process.

* chore(ci): add .actrc configuration for local development

- Introduced a new `.actrc` file to configure the local development environment for CI workflows, specifying the use of a custom Ubuntu image and container architecture.
- Updated the CI workflow to replace workspace dependencies with file references in `package.json`, enhancing consistency across different environments.
- Adjusted links in documentation to ensure accurate navigation, including updates to security guides and logging resources.

* fix(docs): clean up formatting and update redirects in documentation

- Removed unnecessary blank lines in the documentation JSON file for improved readability.
- Updated the redirects section to ensure proper formatting and consistency in the structure.

* refactor(ci): enhance CI workflow for package management and path resolution (#638)

- Improved the CI workflow to ensure accurate resolution of package paths for `create-mcp-use-app`, `mcp-use`, and related packages, enhancing reliability during builds.
- Updated commands to utilize more robust methods for identifying package files, ensuring consistency across different environments.
- Streamlined the process for building and packing all necessary packages, improving overall dependency management and artifact handling.

* chore(typescript): version packages (canary)

* Chore/deps/fork (#640)

* chore(deps): update @modelcontextprotocol/sdk dependency and add new packages

- Removed the MCP SDK update workflow as it is no longer needed.
- Updated the @modelcontextprotocol/sdk dependency in multiple package.json files to point to the new GitHub repository.
- Added new dependencies: glob and js-yaml, with specified version ranges.
- Updated peer dependencies for express to support version 5.0.0.
- Cleaned up package-lock files to reflect the new dependency structure.

* chore(ci): optimize CI workflow for package path resolution and build process

- Enhanced the CI workflow to improve package path resolution, ensuring accurate identification of package files across different environments.
- Streamlined the build process for all necessary packages, improving reliability and consistency during builds.
- Updated commands to utilize more robust methods for file searching, enhancing overall dependency management.

* chore(typescript): version packages (canary)

* chore(typescript): update package references to mcp-use/modelcontextprotocol-sdk (#641)

- Changed all instances of @modelcontextprotocol/sdk to @mcp-use/modelcontextprotocol-sdk across various files.
- Updated package.json files to reflect the new package versioning and structure.
- Enhanced import paths in multiple components and utilities to ensure compatibility with the new SDK structure.
- Added new dependencies and updated existing ones in the pnpm-lock.yaml file for consistency.

* chore(typescript): version packages (canary)

* feat: Improve typescript tel (#642)

* feat: add telemetry event classes and interfaces for server and client interactions

- Introduced new telemetry event classes: `ServerRunEvent`, `ServerInitializeEvent`, `ServerToolCallEvent`, `ServerResourceCallEvent`, `ServerPromptCallEvent`, `ServerContextEvent`, `MCPClientInitEvent`, and `ConnectorInitEvent`.
- Added corresponding data interfaces for each event to enhance type safety and structure.
- Updated the `Telemetry` class to include methods for tracking these new events, improving the telemetry system's capabilities.
- Enhanced the `index.ts` file to export the new event classes and types for easier access throughout the library.

* feat(telemetry): add isEnabled check to telemetry methods

* fix: snake case properties

* feat(telemetry): add MCPServer telemetry interface and data extraction method

- Introduced the `MCPServerTelemetryInfo` interface to encapsulate necessary data for telemetry tracking from an MCPServer instance.
- Added the `createServerRunEventData` function to centralize data extraction from MCPServer-like objects, enhancing the telemetry layer's functionality.
- Updated the `Telemetry` class with a new method, `trackServerRunFromServer`, to track server run events directly using the new interface and extraction method.

* feat(telemetry): enhance telemetry tracking for MCPClient and connectors

- Integrated telemetry tracking for MCPClient initialization, connector initialization, and server events.
- Added methods to track server runs, tool calls, prompt calls, and resource calls, improving observability of client-server interactions.
- Updated the HttpConnector, StdioConnector, and BaseConnector classes to utilize the new tracking methods.
- Enhanced MCPServer to log server initialization and execution metrics, providing better insights into server performance.

* feat(telemetry): enhance resource tracking in server run events

- Updated the `ServerRunEventData` interface to include new properties for tracking resources: `appsSdkResources`, `mcpUiResources`, and `mcpAppsResources`, along with their respective counts.
- Refactored the `createServerRunEventData` function to map and filter resources based on MIME types, improving the granularity of telemetry data.
- Adjusted the `ServerRunEvent` class to serialize the new resource properties, enhancing the telemetry output for better observability.

* feat(versioning): automate version generation for telemetry

- Added a new script `generate-version.mjs` to automatically generate `src/telemetry/version.ts` with the current package version during the build process.
- Updated the `build` script in `package.json` to include the version generation step.
- Refactored `getPackageVersion` function to return the embedded version from the generated file, improving version management.

* tests for telemetry

* add changeset

* feat(telemetry): enhance runtime environment detection and user ID management

- Introduced a comprehensive runtime environment detection system, supporting Node.js, Bun, Deno, Cloudflare Workers, Edge, and browser environments.
- Added methods to determine storage capabilities for user ID persistence, including filesystem and localStorage options.
- Refactored user ID retrieval to accommodate different environments, ensuring session-based IDs are generated when persistent storage is unavailable.
- Enhanced telemetry event tracking by including runtime environment metadata in captured events, improving observability and debugging capabilities.

* feat(telemetry): add browser stubs for Node.js-only packages

- Introduced a Vite plugin to provide browser-compatible stubs for the `posthog-node` package, allowing it to be used in browser environments.
- Updated the Vite server configuration to exclude `posthog-node` from dependency optimization and mark it as external in SSR mode, ensuring proper handling in both development and production builds.
- Enhanced the overall compatibility of the telemetry system with browser environments by stubbing server-side functionality.

* refactor: standardize code formatting and improve readability

- Updated import statements to use consistent double quotes.
- Reformatted function parameters and object properties for better readability across multiple files.
- Enhanced the structure of telemetry-related code to improve maintainability and clarity.
- Removed unnecessary blank lines to streamline the codebase.

* feat(versioning): update version management and export functionality

- Added version information export to the mcp-use package, allowing access to the package version across various modules.
- Refactored the version generation script to output to a new location, ensuring consistency in version tracking.
- Updated multiple files to import and utilize the new versioning functions, enhancing the overall version management system.

* refactor(telemetry): remove unused ServerRunEventData import

- Eliminated the import of ServerRunEventData from telemetry.ts to clean up the code and remove unnecessary dependencies.

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* chore(typescript): version packages (canary)

* feat(ci): update CI workflow to use local tar files for dependencies

- Modified the CI workflow to create projects using local tar files instead of workspace dependencies.
- Removed the previous steps for replacing workspace dependencies in `package.json`, simplifying the process.
- Added a new helper function to validate and find required tar files in a specified directory, ensuring all necessary packages are present.
- Enhanced the project creation logic to support a new `--tar` option for specifying the directory containing tar files.

* feat: add recursive tar file search functionality

- Introduced a new helper function to recursively find `.tgz` files in a specified directory, enhancing the ability to locate required tar files.
- Updated the existing `findTarFiles` function to utilize the new recursive search, improving the validation and retrieval of tar files for project creation.
- Enhanced error messages to provide clearer feedback on found tar files during the process.

* refactor: clean up index.tsx and update CI workflow

- Removed unused functions for tar file handling from `index.tsx`, simplifying the codebase.
- Updated the CI workflow to ensure consistent packaging of the `mcp-use` package, enhancing the build process.
- Adjusted the project creation logic to streamline dependency management and improve clarity in the workflow.

* chore(ci): update E2E canary workflow permissions

- Added permissions for actions and contents in the E2E canary workflow to enhance security and control over workflow execution.

* refactor: enhance error handling display in OAuth callback (#644)

- Refactored the error display logic in the OAuth callback to use DOM manipulation for improved safety and clarity.
- Updated regex patterns in the OAuthHelper class to be more specific, enhancing the accuracy of authentication checks for various APIs.

* chore(typescript): version packages (canary)

* feat(chat): enhance tool integration in chat components (#643)

- Added `tools` prop to `ChatTab` for better tool management.
- Updated `MessageList` to accept `tools` and implemented a helper function to retrieve tool metadata.
- Enhanced `ToolResultRenderer` to utilize tool metadata for improved rendering and error handling, including debug logging for better traceability.

* chore(typescript): version packages (canary)

* refactor: update regex patterns in OAuthHelper for improved DNS safety

- Enhanced regex patterns in the OAuthHelper class to ensure DNS-safe domain matching, accommodating maximum label length restrictions for Google APIs, Atlassian, and Slack.
- Improved clarity in comments to reflect the changes made to the regex patterns.

* Fix/inspector/build (#645)

* chore(inspector): update prepublishOnly script for improved build process

- Modified the `prepublishOnly` script in the inspector package to first build the `mcp-use` package before executing the standard build, ensuring all dependencies are correctly prepared prior to publishing.

* chore: changeset

* chore(typescript): version packages (canary)

* chore(ci): add workflow_dispatch trigger to E2E canary workflow

- Introduced a manual trigger for the E2E canary workflow, allowing for on-demand execution alongside the existing workflow_run trigger.

* Update conformance workflows to use published action (#647)

* Update conformance workflows to use published action

- Replace inline conformance testing with mcp-use/mcp-conformance-action@v1
- Simplify conformance-comment workflow to use action's comment mode
- Maintains fork PR support via workflow_run pattern

* Trigger conformance tests with fixed action

* Trigger conformance with v1.0.2 (aggressive cleanup)

* Trigger conformance with v1.0.3 (simplified cleanup)

* Trigger conformance with v1.0.4 (detached spawn)

* Trigger conformance after updating comment workflow on main

* Trigger conformance with v1.0.5 (baseline comparison)

* Trigger conformance with v1.0.6 (old artifact format support)

* Potential fix for code scanning alert no. 45: Workflow does not contain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* feat: Add browser tel to typescript  (#651)

* add posthog-js

* refactor(telemetry): enhance telemetry functionality and browser support

- Added support for browser environments in the Telemetry class, including dynamic imports of posthog-js for event tracking.
- Introduced new events: ClientAddServerEvent and ClientRemoveServerEvent for better server management tracking.
- Improved telemetry source management and user identification methods for both Node.js and browser contexts.
- Refactored existing methods for better clarity and maintainability, including the initialization of PostHog clients based on the runtime environment.
- Updated event capturing logic to handle both Node.js and browser clients effectively.

* feat(telemetry): add ClientAddServerEvent and ClientRemoveServerEvent for server management

- Introduced ClientAddServerEvent and ClientRemoveServerEvent classes to track server addition and removal.
- Enhanced MCPClientInitEvent to include isBrowser property for better environment differentiation.
- Improved properties extraction for new event classes to facilitate server management tracking.

* feat(telemetry): unify telemetry exports and enhance backward compatibility

- Added unified telemetry exports for browser and Node.js environments, including Tel and setTelemetrySource.
- Introduced backward compatibility aliases for existing telemetry functionalities to ensure seamless integration for users transitioning to the new structure.

* feat(telemetry): integrate telemetry tracking in MCPClient methods

- Added telemetry tracking for server addition and removal in BaseMCPClient.
- Implemented client initialization tracking in BrowserMCPClient to capture configuration details and environment context.
- Enhanced error handling for telemetry tracking failures during client initialization.

* feat(telemetry): enhance MCP telemetry tracking in useMcp hook

- Integrated telemetry tracking for connection attempts, tool calls, and resource reads within the useMcp hook.
- Added success and failure tracking for connections, tool executions, and resource accesses to improve monitoring and diagnostics.

* chore(typescript): version packages (canary)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Luigi Pederzani <luigipederzani@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-12-08 19:35:44 +01:00
Pietro Zullo be9942a4d4 feat/python/server (#559)
* feat: server first implementation

* docs: docs for server and images

* chore: locked langchain dependencies in pyproject.toml (#321)

* python/release/1.3.13

* catch uvicorn logs && log session id

* fix debug logic

* docs: logging update

* fix: icon of elicitation

* fix installation paths for local clones

* docs: minor restructuring

* docs: reorganization, killed non existing pages

* docs: beta tag on server

* chore: example servers

* feat: inspector autopopulated and client only

* feat: enhance MCP logging system with customizable formats and improved middleware

* feat: implement weather alert and forecast tools in FastMCP example server

* mcp path configurable

* fix inspector

* export as FastMCP too

* chore: update fastmcp migration example

* lock inspector version

* type runner

* unhide docs and remove dangers

* migration diff

* docs and context example

* export context

* logging improvement

* pretty JSON RPC

* autoConnect url param in inspecotr

* move logging

* type check

* Server Router

* show response logs

* fallback tool name to function name in router registration

* compatibility export

* Introduced ty and prek as type checker and precommit engine respectively - moved ruff config in pyproject toml

* add ty check

* ty runs only on staged files

* ty configuration fix

* move startup info in logging

* remove bug from action

* update claude rules

* fix resource serialization

* comments on inspector errors

* abstracted runner transports

* remove redunant call for network

* fix ip getter

* add inspector mcp path

* response limit logging

* disable ty check in action

* moved transport type to types

* support sse

* show transport type in logs

* change default transport

* refactored tests to use mcp server

* removed fastmcp

* file restructuring

* test table

* sampling, elicitation, tool disabling enabling

* deprecte sse server side

* simplified report

* fix action

* remove sse deprecated test

* move tests files to allow for server integration tests

* docs

* reorg integration test files

* api-reference-doxs

* fix broken links

* telemetry

* remove feature useage from scarf
2025-12-01 14:12:16 +01:00
Enrico Toniato a4341d5d81 Canary (#586)
* chore(typescript): update dependencies and improve package configurat… (#580)

* chore: enter canary prerelease mode

* chore(typescript): update dependencies and improve package configurations

- Upgraded various dependencies across multiple package.json files, including TypeScript, ESLint, and React-related packages.
- Adjusted TypeScript configuration to use ES2022 module syntax and bundler resolution.
- Enhanced package configurations for mcp-use and create-mcp-use-app, ensuring compatibility with the latest versions of libraries.
- Cleaned up and standardized import statements for better readability and maintainability.
- Updated pnpm-lock.yaml to reflect the changes in dependencies and ensure consistent installations.

* chore(ci): enhance Deno testing workflow and pre-commit checks

- Updated the CI workflow to include a pnpm override for @modelcontextprotocol/sdk, ensuring compatibility with Deno.
- Revamped the pre-commit hook to include formatting and linting checks, along with a validation step for changesets when TypeScript files are modified, improving code quality and consistency.

* fix(ci): update Deno testing workflow to patch package.json for security compliance

- Removed pnpm overrides for @modelcontextprotocol/sdk and added a sed command to patch the installed package.json, ensuring Deno compatibility by replacing external URLs with npm version references.

* fix(ci): update Deno compatibility patching in CI workflow

- Added a step to patch package.json for Deno compatibility by replacing the external URL with the npm version directly in the CI workflow, ensuring smoother integration and compliance with Deno's security requirements.

* refactor(ci): streamline Deno testing workflow and remove deprecated files

- Updated the CI workflow to run Deno tests from the correct working directory.
- Removed the obsolete deno.json file and added a new one for improved configuration.
- Enhanced the test script for clarity and efficiency, including better output messages and cleanup processes.
- Adjusted import statements in the test files for consistency with the new package structure.

* fix(ci): improve Deno testing script with package.json patching

- Added a step to patch package.json for Deno compatibility, replacing the external URL with the npm version.
- Included a restoration step for the original package.json after testing.
- Enhanced output messages for clarity during the testing process.

* fix(ci): add verification step for tarball contents in Deno testing script

- Implemented a check to ensure the tarball does not contain the deprecated pkg.pr.new URL in package.json.
- Enhanced error handling and output messages for better clarity during the verification process.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore(typescript): version packages (canary)

* Disable typescript-deno-test in CI

Temporarily disable typescript-deno-test job in CI workflow.

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Delete libraries/typescript/packages/mcp-use/.deno-test-temp/package.json

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Delete libraries/typescript/packages/mcp-use/test-deno.sh

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-01 11:10:38 +01:00
Enrico Toniato 2730902bd8 Canary (#565)
* Fix/inspector/scroll (#563)

* refactor: enhance layout structure in PromptsTab, ResourcesTab, and ToolsTab components

- Wrapped header and content sections in a flex container to improve layout consistency and overflow handling.
- Ensured that the UI remains responsive and visually organized across different tabs.

* chore: changeset

* feat: add enum input display in ToolInputForm component

- Introduced a new Select dropdown for enum fields, allowing users to select from predefined options.
- Implemented helper functions to resolve JSON schema references and normalize union types for better handling of input schemas.

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* Feat/server/oauth (#564)

* feat: Add OAuth examples and enhance authentication flow

- Introduced new examples for OAuth integration using Auth0, Supabase, and WorkOS in the mcp-use package.
- Added an OAuthCallback component to handle redirects after user authentication.
- Enhanced the App component to include routing for OAuth callbacks.
- Updated pnpm-lock.yaml and package.json to include the jose library for JWT handling.
- Improved context management for HTTP requests to support OAuth flows.
- Removed outdated notification example files to streamline the examples directory.

* feat: Enhance MCP connection management and add notification examples

- Added a `disconnect` method to the MCPConnection interface for better session management.
- Updated McpConnectionWrapper to include new connection options for improved user experience.
- Implemented connection cleanup logic in McpProvider to handle disconnections properly.
- Introduced a new example demonstrating customized notifications for connected clients using the MCP server.
- Added a WorkOS AuthKit OAuth example to showcase bearer token authentication and dynamic client registration.

* feat: Enhance authentication documentation and add notifications section

- Updated the TypeScript client authentication documentation to include new OAuth flow modes (Popup and Redirect).
- Added examples for manual authentication triggers and OAuth callback handling.
- Introduced a new notifications section in the server documentation with tips and examples for bidirectional notifications.
- Included additional tips for complete implementation examples in both notifications and tools documentation.

* lint & format

* fix: Address linting issues and format code for consistency

* chore(typescript): version packages (canary)

* Fix/canary/deps (#566)

* chore: clean up pnpm workspace and lock file by removing unused packages and examples

* chore: update dependencies and improve example scripts

- Updated zod and related dependencies to version 4.1.13 in pnpm-lock.yaml and package.json.
- Enhanced example scripts by adding notes for required environment variables and removing dotenv imports for clarity.
- Refactored code to use local utility functions for JSON schema conversion and UUID generation.
- Cleaned up unused dependencies in package.json for the mcp-use package.

* chore: update dependencies and improve package configurations

- Added `zod` version 4.1.13 to package.json and pnpm-lock.yaml.
- Removed unused dependencies from various package.json files in the create-mcp-use-app templates.
- Simplified install arguments in the getInstallArgs function for package managers.
- Enhanced error handling for optional dependencies in the McpUseProvider and connect-adapter files.
- Refactored display functions to dynamically import optional dependencies for improved performance and user experience.

* format & lint

* chore: changeset

* chore(typescript): version packages (canary)

* Fix/canary/deps (#567)

* chore: clean up pnpm workspace and lock file by removing unused packages and examples

* chore: update dependencies and improve example scripts

- Updated zod and related dependencies to version 4.1.13 in pnpm-lock.yaml and package.json.
- Enhanced example scripts by adding notes for required environment variables and removing dotenv imports for clarity.
- Refactored code to use local utility functions for JSON schema conversion and UUID generation.
- Cleaned up unused dependencies in package.json for the mcp-use package.

* chore: update dependencies and improve package configurations

- Added `zod` version 4.1.13 to package.json and pnpm-lock.yaml.
- Removed unused dependencies from various package.json files in the create-mcp-use-app templates.
- Simplified install arguments in the getInstallArgs function for package managers.
- Enhanced error handling for optional dependencies in the McpUseProvider and connect-adapter files.
- Refactored display functions to dynamically import optional dependencies for improved performance and user experience.

* format & lint

* chore: changeset

* chore: update TypeScript configuration and clean up project files

- Removed `.vercel/` from `.prettierignore` and `eslint.config.js` for consistency.
- Deleted unused `.trigger` file to streamline project structure.
- Adjusted `tsconfig.json` to maintain only necessary package paths.

* chore: update pnpm workspace and package configurations

- Added new example packages for mcp-use in the pnpm workspace, including client and server examples.
- Updated package.json for mcp-use to reflect the new version of @modelcontextprotocol/sdk.
- Enhanced McpUseProvider to dynamically load react-router-dom, improving error handling and user experience.
- Refactored connect-adapter and mcp-server to utilize createRequire for dynamic imports, ensuring compatibility with user project directories.
- Cleaned up pnpm-lock.yaml to include updated dependencies and improve overall project structure.

* refactor: clean up whitespace and formatting in McpUseProvider, connect-adapter, and mcp-server files

- Removed unnecessary blank lines to improve code readability.
- Standardized formatting for better consistency across the codebase.

* chore(typescript): version packages (canary)

* lint & format

* feat: add URL validation in connection components (#568)

- Implemented URL format validation in InspectorDashboard and ServerConnectionModal to ensure only valid protocols (http, https, ws, wss) are accepted.
- Added error handling with user feedback using toast notifications for invalid URL formats.
- Adjusted collapsedSize property in PromptsTab, ResourcesTab, and ToolsTab components for consistent UI behavior.

* chore(typescript): version packages (canary)

* fix(inspector): use terser for smaller build (#569)

* Enhance create-mcp-use-app e2e tests (#561)

* Add E2E tests for create-mcp-use-app with npm and yarn

Co-authored-by: tonxipad <tonxipad@gmail.com>

* feat: Add E2E tests for multiple create-mcp-use-app templates

Co-authored-by: tonxipad <tonxipad@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>

* fix docs images

* fix(inspector): enable minification for smaller build

Use esbuild's built-in minifier (minify: true) instead of adding terser.
Results in same compression (8.7MB -> 4.9MB, 44% reduction) with faster builds.

* chore: changeset

* remove test_app

---------

Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>

* chore(typescript): version packages (canary)

* Feat/inspecto/combobox models (#570)

* feat(inspector): enhance ConfigurationDialog with model selection and password visibility toggle

- Added a combobox for model selection using a Popover and Command components for improved user experience.
- Implemented a button to toggle password visibility for the API key input field.
- Updated imports to include necessary UI components for the new features.

* fix(inspector): correct models and API keys display in inspector chat

* feat(inspector): add checkbox support and enhance Markdown rendering

- Introduced a new ListItem component to handle task list items with checkboxes in Markdown.
- Updated the MarkdownRenderer to support custom table components and improved code block handling.
- Added dependencies for @radix-ui/react-checkbox and updated package.json and pnpm-lock.yaml accordingly.
- Refined styles in ChatHeader and ChatInputArea for better layout consistency.

* chore(typescript): version packages (canary)

* refactor(create-mcp-use-app): remove --no-install flag from commands and update README for automatic dependency installation (#571)

* Potential fix for code scanning alert no. 32: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Potential fix for code scanning alert no. 18: Workflow does not contain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>

* Feat/mcp use/update ai sdk (#573)

* chore(dependencies): update ai package version and add overrides for sugarss

- Updated ai package from version 4.3.19 to 5.0.104 in multiple package.json files.
- Added sugarss override to package.json files in apps-sdk, mcp-ui, and starter templates for compatibility.

* feat(ci): add typescript-deno-test workflow for Deno compatibility testing

- Introduced a new CI job to test Deno compatibility for the mcp-use package.
- Updated pnpm-lock.yaml and package.json files to reference the latest version of @modelcontextprotocol/sdk from a new URL.
- Ensured dependencies are installed and built correctly before running Deno tests.

* deno test

* fix(ci): update package command from npm to pnpm for Deno testing

* refactor(mcp-use): replace LangChainAdapter with createTextStreamResponse for AI SDK compatibility

- Updated multiple files to use createTextStreamResponse instead of LangChainAdapter for creating data stream responses.
- Enhanced README and example files to reflect the new usage pattern.
- Adjusted tests to verify compatibility with the new response handling method.

* tests: added deno tests

* fix(create-mcp-use-app): parse PORT environment variable to number

* tests: exclude deno from vitest

* chore(typescript): version packages (canary)

* feat(ci): add deployment markers for canary and main branches (#574)

- Introduced steps to create and upload deployment markers for both canary and main branches in the TypeScript release workflow.
- The markers indicate successful package publication and are retained for one day.

* refactor(mcp-use): update AI SDK integration and enhance Deno testing

- Replaced LangChainAdapter with createTextStreamResponse for improved AI SDK compatibility.
- Updated README and example files to reflect new usage patterns.
- Added Deno compatibility tests and adjusted CI workflow for dependency management.
- Fixed PORT environment variable parsing in create-mcp-use-app.

* feat(ci): enhance workflow security by validating source of automatic triggers

- Added a validation step to ensure that workflow runs triggered automatically are from the same repository, preventing potential security risks from forked repositories.
- Updated conditions for deployment markers to incorporate the new validation step, ensuring only valid runs proceed to deployment.

* Fix/cli/readme (#575)

* chore(cli): update package description for clarity and feature enhancement

* fix(ci): update Deno testing workflow to ensure proper dependency installation and execution

- Adjusted the CI workflow for Deno compatibility testing to ensure all dependencies are correctly installed before running tests.
- Updated commands to use pnpm for consistency across the workflow.

* chore(typescript): version packages (canary)

---------

Signed-off-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Daniel Starns <danielstarns@hotmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-11-30 21:26:37 +01:00
Enrico Toniato 7edd67a022 Enhance create-mcp-use-app e2e tests (#561)
* Add E2E tests for create-mcp-use-app with npm and yarn

Co-authored-by: tonxipad <tonxipad@gmail.com>

* feat: Add E2E tests for multiple create-mcp-use-app templates

Co-authored-by: tonxipad <tonxipad@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: tonxipad <tonxipad@gmail.com>
2025-11-28 17:26:56 +01:00
Pietro Zullo 9e592b4071 chore(python): dependencies (#531)
* removed useless anyio and aiohttp dependency

* version matrix in unit tests

* change test names

* fix weird import from langchain

* new deps

* bump fastembed minimal

* bump uvicorn, remove unused config for pytest

* add pre commit to dev deps

* remove transitive deps starlette and uvicorn

* test fix
2025-11-25 19:19:14 +01:00
Enrico Toniato 835d367b8f Squash all commits: Add CLI deploy functionality, server tool inspector, and various improvements (#467) 2025-11-17 11:45:14 +01:00
Salvatore Gabriele Karra bd247d5a87 CI: approve fork PRs by promotion + call reusable CI (#442)
* ci: add approval workflow to promote fork PRs and call reusable CI; make CI callable via workflow_call

* ci(approve-fork-pr): fix slash normalization regex

* Update ci.yml

Signed-off-by: Salvatore Gabriele Karra <86735558+gabrielekarra@users.noreply.github.com>

---------

Signed-off-by: Salvatore Gabriele Karra <86735558+gabrielekarra@users.noreply.github.com>
Co-authored-by: Gabriele Karra <gabrielekarra@MacBook-Air-di-Gabriele.local>
2025-11-15 15:01:02 +01:00
Luigi Pederzani ceed51b3c3 chore(release): @mcp-use/inspector@0.4.11 + mcp-use@1.2.2 (#425)
* feat/use mcp uses mcp use (#411)

* feat(connectors): add OAuth provider support and capability-aware methods

- Add authProvider option to ConnectorInitOptions
- Thread authProvider through BrowserMCPClient → HttpConnector → SDK transport
- Add capabilitiesCache to BaseConnector for checking server capabilities
- Make listAllResources() and listPrompts() capability-aware
- Return empty arrays for unsupported features instead of throwing
- Preserve 401 errors in HttpConnector (don't wrap in generic message)
- Skip SSE fallback on 401 errors (both transports will fail)

This enables automatic OAuth with token refresh and Dynamic Client
Registration (DCR) when servers support it, while gracefully handling
servers that don't implement resources or prompts.

* feat(react): refactor useMcp to use BrowserMCPClient and accept LLM instances

BREAKING CHANGE: sendChatMessage now accepts LangChain model instance
instead of config object. Callers must create LLM instance themselves.

Before:
  mcp.sendChatMessage('hello', { provider: 'openai', model: 'gpt-4', apiKey: '...' })

After:
  const llm = new ChatOpenAI({ model: 'gpt-4', apiKey: '...' })
  mcp.sendChatMessage('hello', llm)

Changes:
- Replace official SDK Client with BrowserMCPClient for multi-server foundation
- Add sendChatMessage() method that creates MCPAgent with existing client
- Add clearChatHistory() method for conversation management
- Thread authProvider through to SDK transport for automatic OAuth
- Simplify 401 error handling (OAuth delegated to SDK)
- Add comprehensive JSDoc documentation to all methods
- Document all useEffect blocks with explanations
- Remove unused AUTH_QUICK_TIMEOUT constant
- Add missing listResources to return statement
- Change sendChatMessage parameter from config to BaseLanguageModelInterface

Benefits:
- Smaller bundle (~2KB reduction, LLM creation moved to caller)
- More flexible (supports any LangChain-compatible model)
- Shared connection across tools/resources/chat (87% faster)
- Conversation memory works (agent persists across messages)
- Better separation of concerns

* feat(inspector): integrate shared connection and LLM instance chat

- Update MCPConnection to use BaseLanguageModelInterface for sendChatMessage
- Move LLM creation from useMcp to useChatMessagesClientSide
- Support OpenAI, Anthropic, and Google models via dynamic imports
- Remove debug console.log statements
- Skip auto-switch for authentication errors (instant feedback)
- Chat now reuses existing MCP connection (no reconnection overhead)

Chat performance improvements:
- First message: ~900ms (down from 3.3s, 73% faster)
- Subsequent messages: <100ms (down from 3.3s, 97% faster)
- Conversation history preserved across messages

* docs: add technical blog posts on client architecture

- Add client-vs-sdk.mdx explaining multi-server value proposition
- Add client_side.mdx on client-side inspector architecture

Topics covered:
- Why mcp-use has its own client (multi-server orchestration)
- Session management and config file support
- OAuth integration and browser security model
- Client-side architecture benefits (privacy, performance, simplicity)
- AsyncLocalStorage for request context
- Real-world performance metrics

* fix(inspector): improve error messages in server-side chat

- Add detailed HTTP status codes to error messages
- Detect 401 errors and suggest checking Authorization header
- Better error context for debugging connection issues

* docs: add useMcp hook and blog posts to navigation

- Add typescript/client/usemcp to client documentation
- Add client_side and client-vs-sdk blog posts to navigation

* removed unused var

* nullable chat interface

* Update libraries/typescript/packages/mcp-use/src/react/useMcp.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>

* refactor(react): extract maxSteps to constant and improve LLM comparison

- Extract DEFAULT_MAX_STEPS constant (10) to avoid magic number
- Add comment explaining LLM reference equality comparison
- Callers should use useMemo() to keep same LLM instance

* fix(agents): update langchain imports to use modular packages

- Change 'langchain' imports to '@langchain/core/messages' for message types
- Add @ts-ignore for legacy langchain imports pending full migration
- Fixes TypeScript compilation errors with langchain package

* fix(inspector): clean up placeholder methods and remove unused ref

- Use empty generator (yield* []) for disconnected sendChatMessage placeholder
- Remove unused toolsMetadataRef from useChatMessagesClientSide
- Keep sendChatMessage required (consistent with other methods)

* chore: update pnpm lockfile with test_app workspace

* revert: a9b697b HEAD@{3}: rebase (pick): fix(agents): update langchain imports to use modular packages

* posthog on docs

* updated action

* fix test scirpt

* agent tests moved into normal mcp-use test

* stub to make langchain1.0 compatible with the browser env

* fixed lockfile

* updated models to existing ones

* removed streamMessage from useMCP, moved it back to useClientSideMessage. Unfortunately langchain does not support browser environments anymore (not cleanly) so we cannot make the agent part of the browser side bundle, i.e. useMcp

* refactor: simplify readResource return values in BaseConnector and WebSocketConnector

Updated the readResource method in both BaseConnector and WebSocketConnector to return the full response object instead of a subset. Adjusted the useMcp hook to directly return the result from readResource, streamlining the data handling process.

* fix: when swtiching server the chat is refreshed

* fix app sdk ui rendering

* removed unused imports

* fix: improve server already running at port error message

---------

Signed-off-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Luigi Pederzani <luigipederzani@gmail.com>

* chore: enter canary prerelease mode

* feat: use mcp uses mcp use (#423)

* feat(connectors): add OAuth provider support and capability-aware methods

- Add authProvider option to ConnectorInitOptions
- Thread authProvider through BrowserMCPClient → HttpConnector → SDK transport
- Add capabilitiesCache to BaseConnector for checking server capabilities
- Make listAllResources() and listPrompts() capability-aware
- Return empty arrays for unsupported features instead of throwing
- Preserve 401 errors in HttpConnector (don't wrap in generic message)
- Skip SSE fallback on 401 errors (both transports will fail)

This enables automatic OAuth with token refresh and Dynamic Client
Registration (DCR) when servers support it, while gracefully handling
servers that don't implement resources or prompts.

* feat(react): refactor useMcp to use BrowserMCPClient and accept LLM instances

BREAKING CHANGE: sendChatMessage now accepts LangChain model instance
instead of config object. Callers must create LLM instance themselves.

Before:
  mcp.sendChatMessage('hello', { provider: 'openai', model: 'gpt-4', apiKey: '...' })

After:
  const llm = new ChatOpenAI({ model: 'gpt-4', apiKey: '...' })
  mcp.sendChatMessage('hello', llm)

Changes:
- Replace official SDK Client with BrowserMCPClient for multi-server foundation
- Add sendChatMessage() method that creates MCPAgent with existing client
- Add clearChatHistory() method for conversation management
- Thread authProvider through to SDK transport for automatic OAuth
- Simplify 401 error handling (OAuth delegated to SDK)
- Add comprehensive JSDoc documentation to all methods
- Document all useEffect blocks with explanations
- Remove unused AUTH_QUICK_TIMEOUT constant
- Add missing listResources to return statement
- Change sendChatMessage parameter from config to BaseLanguageModelInterface

Benefits:
- Smaller bundle (~2KB reduction, LLM creation moved to caller)
- More flexible (supports any LangChain-compatible model)
- Shared connection across tools/resources/chat (87% faster)
- Conversation memory works (agent persists across messages)
- Better separation of concerns

* feat(inspector): integrate shared connection and LLM instance chat

- Update MCPConnection to use BaseLanguageModelInterface for sendChatMessage
- Move LLM creation from useMcp to useChatMessagesClientSide
- Support OpenAI, Anthropic, and Google models via dynamic imports
- Remove debug console.log statements
- Skip auto-switch for authentication errors (instant feedback)
- Chat now reuses existing MCP connection (no reconnection overhead)

Chat performance improvements:
- First message: ~900ms (down from 3.3s, 73% faster)
- Subsequent messages: <100ms (down from 3.3s, 97% faster)
- Conversation history preserved across messages

* docs: add technical blog posts on client architecture

- Add client-vs-sdk.mdx explaining multi-server value proposition
- Add client_side.mdx on client-side inspector architecture

Topics covered:
- Why mcp-use has its own client (multi-server orchestration)
- Session management and config file support
- OAuth integration and browser security model
- Client-side architecture benefits (privacy, performance, simplicity)
- AsyncLocalStorage for request context
- Real-world performance metrics

* fix(inspector): improve error messages in server-side chat

- Add detailed HTTP status codes to error messages
- Detect 401 errors and suggest checking Authorization header
- Better error context for debugging connection issues

* docs: add useMcp hook and blog posts to navigation

- Add typescript/client/usemcp to client documentation
- Add client_side and client-vs-sdk blog posts to navigation

* removed unused var

* nullable chat interface

* Update libraries/typescript/packages/mcp-use/src/react/useMcp.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>

* refactor(react): extract maxSteps to constant and improve LLM comparison

- Extract DEFAULT_MAX_STEPS constant (10) to avoid magic number
- Add comment explaining LLM reference equality comparison
- Callers should use useMemo() to keep same LLM instance

* fix(agents): update langchain imports to use modular packages

- Change 'langchain' imports to '@langchain/core/messages' for message types
- Add @ts-ignore for legacy langchain imports pending full migration
- Fixes TypeScript compilation errors with langchain package

* fix(inspector): clean up placeholder methods and remove unused ref

- Use empty generator (yield* []) for disconnected sendChatMessage placeholder
- Remove unused toolsMetadataRef from useChatMessagesClientSide
- Keep sendChatMessage required (consistent with other methods)

* chore: update pnpm lockfile with test_app workspace

* revert: a9b697b HEAD@{3}: rebase (pick): fix(agents): update langchain imports to use modular packages

* posthog on docs

* updated action

* fix test scirpt

* agent tests moved into normal mcp-use test

* stub to make langchain1.0 compatible with the browser env

* fixed lockfile

* updated models to existing ones

* removed streamMessage from useMCP, moved it back to useClientSideMessage. Unfortunately langchain does not support browser environments anymore (not cleanly) so we cannot make the agent part of the browser side bundle, i.e. useMcp

* refactor: simplify readResource return values in BaseConnector and WebSocketConnector

Updated the readResource method in both BaseConnector and WebSocketConnector to return the full response object instead of a subset. Adjusted the useMcp hook to directly return the result from readResource, streamlining the data handling process.

* fix: when swtiching server the chat is refreshed

* fix app sdk ui rendering

* removed unused imports

* fix: improve server already running at port error message

* changeset

---------

Signed-off-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
Co-authored-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore(typescript): version packages (canary)

* chore: Prettier format + lint (#424)

* chore: enhance CI workflow with formatting check and update Prettier configuration

- Added a formatting check step to the CI workflow using `pnpm format:check`.
- Updated `.prettierignore` to include additional build output directories and markdown files.
- Modified `.prettierrc.json` to enforce semicolons.
- Integrated `eslint-config-prettier` into ESLint configuration to prevent conflicts with Prettier.
- Added `prettier` as a dependency in `package.json` and updated the lockfile.
- Removed obsolete ESLint configuration file for the inspector package.

* chore: run format

* changeset

* minor

* chore: configure prettier to exclude JSON files

* fix: "typescript/create-app-tests"
- Specified the shell type for the Test CLI Creation step to ensure consistent execution environment.

* chore(typescript): version packages (canary)

---------

Signed-off-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: Pietro Zullo <62951181+pietrozullo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
2025-11-04 12:53:40 +01:00
Luigi Pederzani 708cc5bc25 release(typescript): mcp-use 1.2.0 + @mcp-use/inspector 0.4.9 (#399)
* feat: Add support for Langchain 1.0.0 (#396)

* feat(tests): add integration tests for MCPAgent functionality

* chore: update dependencies and improve observability integration

- Updated `@langfuse/langchain` to version 4.3.0 in package.json and README.
- Changed import statements from `langfuse-langchain` to `@langfuse/langchain` for consistency.
- Added new integration test commands in package.json for better test organization.
- Increased test and hook timeout in vitest configuration for improved stability.
- Updated observability README to reflect new package structure.

* refactor(mcp_agent): WIP update agent implementation and improve streaming functionality

* feat(mcp_agent): enhance agent execution with structured output and dynamic tool management

- Introduced new interfaces `AgentStep` and `AgentFinish` to represent execution steps and final outputs.
- Implemented `_normalizeOutput` method for consistent output formatting.
- Enhanced streaming execution to handle dynamic tool updates during agent operation.
- Improved logging for tool calls and results, providing better observability during execution.
- Updated conversation history management to include final outputs and structured results.

* minor

* fix

* refactor(mcp_agent): streamline tool management and enhance agent state tracking

- Removed the `AgentFinish` interface and associated unused imports for cleaner code.
- Introduced `toolsUsedNames` property to track tools utilized during agent execution.

* refactor(tests): simplify agent test logging and enhance tool usage validation

* simplify input

* refactor(mcp_agent): enhance stream configuration and observability integration

- Introduced `StreamConfiguration` type for better stream management.
- Updated stream options to use a configurable object for callbacks, metadata, and tags.
- Made `observabilityManager` public for improved access.
- Streamlined input handling for event streaming with observability support.

* feat(observability): add integration tests for observability with Langfuse

- Introduced a new integration test `test_agent_observability.test.ts` to verify observability features.
- Updated `package.json` to include a new test command for observability integration.
- Enhanced `ObservabilityManager` with a `getStatus` method to retrieve current observability status, metadata, and tags.

* fix(mcp_agent): make callbacks work in stream

* fix: use old langfuse packages

* feat(tests): enhance agent observability integration tests

- Updated `getRecentTraces` function to query traces using session tags instead of session IDs.
- Added a new manual test for verifying Langfuse connection and trace submission.
- Improved logging for trace verification and added checks for trace metadata and tags.
- Adjusted existing tests to ensure proper observability validation and logging.

* feat(observability): enhance Langfuse integration with trace name and metadata

- Added `runName` to `MCPAgent` for trace identification in LangChain/Langfuse.
- Improved `initializeLangfuse` to set trace name and handle initial metadata and tags.
- Updated observability test logging to include trace name and manual verification details.

* chore(types): update .npmrc suppress warning for old version of langfuse (the one working)

* refactor(tests): improve observability test logging and trace querying

- Updated `getRecentTraces` function to simplify query parameters and enhance logging.
- Improved trace verification logic to provide clearer output on found traces and their metadata.
- Adjusted logging to reflect the use of tags in trace queries and added checks for session-specific traces.

* docs(observability): update Langfuse integration details and package requirements

- Clarified version compatibility for Langfuse, specifying required versions (3.38.x+).
- Added notes on correct package names to avoid common installation mistakes.
- Included installation commands for npm, pnpm, and yarn with version specifications.
- Highlighted expected peer dependency warnings and their safe disregard during installation.

* changeset

* fix lint

* chore: update TypeScript configuration to enable incremental builds and improve library checks

* fix: solve circular import, implement IServerManager interface for ServerManager and update related tools

* fix: improve build configuration

- Added Langchain packages as dependencies in package.json for better integration.
- Enhanced tsup configuration to keep Langchain packages external, optimizing memory usage during builds.

* chore: edit package.json to include Langchain dependencies since lanchain and lanchain/core are now set as external in tsup.config.ts which means that won't be bundled at build time but installed when installing mcp-use

* chore: update TypeScript configuration to refine excluded test directories

* fix: tests

* chore: enhance CI configuration and add agent integration tests

- Added a new output for typescript-agent in CI workflow to detect changes.
- Introduced a dedicated job for running agent integration tests, triggered only when agent-related files change.

* chore: update CI workflow and package.json for unit and integration tests

- Modified CI workflow to use new test commands for unit and agent integration tests.
- Added a new script for running unit tests in package.json, excluding integration tests.

* chore: enter canary prerelease mode

* chore(typescript): version packages (canary)

* fix: Inspector CSP for Apps SDK (#398)

* feat(inspector): enhance widget CSP handling and security headers

- Added support for extracting and passing widget-specific Content Security Policy (CSP) metadata in the OpenAIComponentRenderer.
- Updated the storeWidgetData function to include widgetCSP in the stored data.
- Modified getWidgetSecurityHeaders to accept widgetCSP, allowing for dynamic security header generation based on widget-specific domains.
- Improved header handling in registerInspectorRoutes to utilize widget-specific CSP for enhanced security.

* changeset

* chore(typescript): version packages (canary)

* fix structured output and streamEvents

* Better structured output example

* fix: model type (#400)

* refactor(mcp_agent): update agent type definitions and improve structured output handling

- Replaced `BaseLanguageModelInterface` with a more flexible `LanguageModel` type to accommodate various LangChain models.
- Consolidated the `AgentStep` interface definition for clarity and consistency.
- Enhanced logging for raw results during structured output attempts to improve observability.
- Removed unused `StreamConfiguration` type to streamline the codebase.

* changeset

* chore(typescript): version packages (canary)

* remove useless log

* canary2: removed useless logs

* chore(typescript): version packages (canary)

* chore: create-mcp-use-app update package.json

* chore(typescript): version packages (canary)

* chore: set again cli and inspector as dependencies

* changeset

* chore(typescript): version packages (canary)

* changeset

* chore(typescript): version packages (canary)

* chore: inspector update langchain dependencies

* chore(typescript): version packages (canary)

* refactor(mcp_agent): improve imports and update tool type to DynamicTool

* feat(types): add BaseMessage type and update remote agent imports

* fix(types): update imports to use type-only imports for clarity

* chore(typescript): version packages (canary)

* fix: Apps sdk metadata handling improvements (#407)

* feat(mcp-server): add server base URL to widget connect domains

* fix(templates): add baseUrl to createMCPServer important for apps-sdk CSP

* correctly build all the widgetMetadata

* feat(templates): update project structure for different templates in create-mcp-use-app

* feat(types): add WidgetMetadata interface for widget configuration

* refactor(mcp-server): fix apps-sdk metadata build

* changeset

* fix lint

* chore(typescript): version packages (canary)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
2025-10-31 18:35:46 +01:00
Luigi Pederzani f08e870e09 feat: Upgrade to Langchain 1.0.0 (#393)
* chore: update imports

* refactor(mcpagent): update agent creation logic and imports

- Replaced `create_tool_calling_agent` with `create_agent` for improved agent instantiation.
- Simplified the `_create_agent` method by removing the `AgentExecutor` and directly returning the created agent.
- Adjusted type annotations for `_agent_executor` to initialize as `None` instead of using a union type.

* feat(mcpagent): migrate to LangChain 1.0.0 and simplify agent methods

- Updated MCPAgent to utilize LangChain 1.0.0's `create_agent()` for improved agent instantiation.
- Introduced new methods `astream_simplified()` and `run_v2()` that leverage the built-in `astream()` for internal agent loop handling.
- Retained legacy methods `stream()` and `run()` for backward compatibility with manual execution.
- Enhanced documentation to reflect changes and provide clearer usage examples.

* feat(mcpagent): implement dynamic tool updates during agent execution

- Enhanced the MCPAgent to support dynamic tool updates when using server_manager mode.
- Implemented logic to check for tool changes before and during execution, allowing for immediate updates and safe restarts.
- Introduced a maximum restart limit to prevent infinite loops during tool updates.
- Updated documentation to reflect the new behavior and usage of dynamic tool management.

* refactor(mcpagent): clean up imports and streamline logging

- Removed unused imports and organized existing ones for better clarity in `mcpagent.py`.
- Simplified logging statements for consistency and improved readability.
- Enhanced the overall structure of the code by eliminating unnecessary whitespace.
- Updated unit tests to reflect changes in imports and ensure compatibility with the refactored code.

* feat(mcpagent): enhance agent execution with step tracking and middleware

- Introduced `ModelCallLimitMiddleware` to enforce a maximum number of model calls during agent execution.
- Updated the `_consume_and_return` method to return a tuple of the final result and the number of steps taken.
- Enhanced telemetry tracking to include steps taken and execution time for better performance insights.
- Simplified agent creation logic by integrating middleware directly into the `create_agent` function.
- Improved logging for agent execution details, including steps and tool usage.

* fix(mcpagent): add null check for node output messages extraction

- Updated the MCPAgent to include a null check for `node_output` before attempting to access the "messages" key, preventing potential errors during message extraction.

* minor

* feat(mcpagent): filter out ToolMessage from history

- Updated the MCPAgent to exclude ToolMessage instances from being added to the message history, ensuring that only relevant messages are recorded.
- This change helps maintain a cleaner history by avoiding intermediate tool execution details.

* fix(mcpagent): set max_steps assignment

* ruff

* docs

* e2e tests for agent

* key in tests

* fix manager test and split ci tests

* telemetry off for tests

* fix server manager test

* feat(mcpagent): delegate query streaming to remote agent in remote mode

- recreated functionality to the MCPAgent to yield results from a remote agent when operating in remote mode, enhancing the agent's capability to handle queries efficiently.

* fix: agent unit tests

* Print inputs

* rollback, wrong repo

* fix streaming output

* stricter streaming test

* pass observability callbacks

* fix tests mock

---------

Co-authored-by: pietrozullo <pietro.zullo@gmail.com>
2025-10-27 14:26:01 +01:00
Enrico Toniato a76041c1b8 fix: ci 2025-10-20 18:14:06 +02:00
Luigi Pederzani 3670ed05cc chore(release/typescript): mcp-use v1.1.1 + inspector v0.4.1 + others (#330)
* chore: Test canary (#329)
2025-10-19 19:02:16 +02:00
Luigi Pederzani dbf9516281 chore(release/typescript): mcp-use v1.1.0 + inspector v0.4.0 (#326)
* feat: Add OpenAI Apps SDK integration (#322)

* feat: enhance MCP server and UI resource handling with Apps SDK support

* feat: add Apps SDK tests for various UI resource types

* feat: implement support for OpenAI Apps SDK in MCP server

- Added new UI resource type for Apps SDK, allowing integration with OpenAI's platform.
- Enhanced existing methods to handle Apps SDK metadata and structured content.
- Updated documentation and type definitions to reflect the new resource capabilities.
- Included examples for creating Apps SDK resources and utilizing them within the MCP server.

* test: add tests for Apps SDK resource creation in MCP-UI Adapter

* feat: add Pizzaz MCP server implementation with OpenAI Apps SDK integration

* fix: update resource URI format

* feat: enhance Apps SDK resource

* feat: enhance tool definition + make _meta is at top level (

* feat: add new test_app scripts for each create-mcp-use-app template

* fix: update test_app scripts to include --dev flag for template generation

* chore(changeset): apps sdk

* fix: changeset cwd (#323)

* refactor: Improve compatibility  (#324)

* fix: use registerResource and registerPrompt

* refactor: update callback function names in MCP server and types

- Renamed `fn` to `cb` in tool and prompt definitions for consistency.
- Updated resource definitions to use `readCallback` instead of `fn`.
- Adjusted related documentation and type definitions to reflect these changes.
- Enhanced clarity in the MCP server's API by standardizing callback naming conventions.

* refactor: templates

* Fix inspector version (#316)

* refactor: update inspector CLI to use ESM format and remove deprecated files

- Changed the build command for the CLI to output in ESM format.
- Removed obsolete TypeScript declaration and map files for the CLI.
- Updated usage examples in the CLI to reflect the new package name.

* chore: update documentation for improved clarity and structure

- Revised sections in the documentation to enhance clarity and organization.
- Added new examples and improved existing ones for better understanding.
- Ensured consistency in terminology and formatting across all documents.

* fix: address code review feedback for inspector CLI

- Add input validation for port (1-65535) and URL format
- Add error logging to all API catch blocks
- Fix critical async/await bugs in static file serving
- Add 'open' package for better cross-platform browser launching
- Remove unused CLIArgs interface
- Update changeset description with complete fix details

* fix: update inspector CLI for improved functionality and error handling

- Changed CLI build format from CommonJS to ESM for better compatibility.
- Added prepublishOnly hook to ensure build before publishing.
- Enhanced input validation for port and URL arguments.
- Improved error logging in API catch blocks for better debugging.
- Updated documentation references to reflect package name changes.
- Removed compiled artifacts from the source directory.

* fix: use absolute path for changesets cwd parameter

* refactor: reorganize imports and enhance InspectorDashboard component

- Rearranged import statements for better readability and consistency.
- Improved formatting of console warnings for better debugging.
- Updated connection handling logic and UI elements for clarity and maintainability.
- Enhanced user feedback for connection actions and clipboard operations.

* feat: migrate changes from mcp-use-ts repository

- Update InspectorDashboard.tsx with auto-connect functionality and connection tester
- Update create-mcp-use-app with improved CLI experience and template selection
- Add version injection plugin to vite.config.ts
- Improve error handling and user experience

* fix: add missing dependencies for create-mcp-use-app

- Add inquirer@9.3.8 and ora@8.2.0 dependencies
- Add @types/inquirer@9.0.9 for TypeScript support
- Resolves module resolution errors

* feat: add missing inspector components and files

- Add chat components (AssistantMessage, UserMessage, ToolCallDisplay, MCPUIResource)
- Add missing UI components (aurora-background, text-shimmer, sheet, switch)
- Add ConnectionSettingsForm component
- Add mcpResourceUtils utility
- Add favicon files (favicon-black.svg, favicon-white.svg)
- Update index.html with proper favicon links and title
- Update ChatTab with latest improvements and chat functionality

* fix: update dependencies and improve inspector functionality

- Update @types/node to version 20.19.21 across multiple packages.
- Upgrade @typescript-eslint packages to version 8.46.1 for better linting support.
- Add new dependencies in create-mcp-use-app for improved CLI experience (inquirer@9.3.8, ora@8.2.0).
- Adjust inspector package version to 0.3.9 and clean up CHANGELOG.
- Enhance error handling and connection management in inspector components.
- Refactor inspector CLI for better usability and auto-connect features.

* refactor: reorganize and clean up inspector components

- Update import paths in App.tsx for consistency and clarity.
- Remove unused components: AnimatedThemeToggler, ChatTab, CommandPalette, ConnectionSettingsForm, CustomHeadersEditor, EnvVariablesEditor, InspectorDashboard, Layout, McpUIRenderer, PromptsTab, ResourcesTab, ServerDetail, ServerIcon, ServerList, ToolsTab, and chat components.
- Streamline the component structure for improved maintainability and readability.

* fix oauth flow

* refactor: simplify InspectorDashboard and enhance ServerIcon component

- Streamlined the SelectItem in InspectorDashboard for clarity.
- Improved formatting and readability in ServerIcon, including better handling of server URL parsing and favicon loading logic.
- Added loading state for favicon images to enhance user experience.

* style: enhance CommandPalette and ServerIcon components

- Added a command palette button in the layout for improved accessibility.
- Updated CommandPalette to include a scrollable list and improved item selection handling.
- Enhanced ServerIcon with caching for favicons to optimize loading times and reduce network requests.
- Introduced loading states for favicons to improve user experience.

* refactor: enhance Inspector components and improve routing

- Updated App.tsx to include InspectorProvider for better context management.
- Simplified routing logic in InspectorDashboard and ServerList components to use query parameters for server navigation.
- Enhanced CommandPalette with improved item selection and logging for better debugging.
- Refactored ConnectionSettingsForm to support additional UI options and callbacks.
- Improved layout and styling across various components for a more cohesive user experience.

* chore: remove SSE_DISCONNECT_FIX documentation

* refactor: enhance create-mcp-use-app CLI and inspector components

- Replaced exec with spawn in create-mcp-use-app for improved security and performance.
- Added validation for project and template names to prevent path traversal and ensure safe input.
- Enhanced error handling in inspector server responses with detailed context and stack traces.
- Removed proxy token handling from inspector components to streamline configuration.
- Updated various inspector components for better state management and user experience.

* fix: remove garbage text

* feat: enhance UI components and improve layout

- Added a header to the ConnectionSettingsForm for better user guidance.
- Updated InspectorDashboard to remove redundant header and streamline layout.
- Modified ToolsTab to change the direction of the ResizablePanelGroup for improved usability.
- Enhanced ToolExecutionPanel with execute and save buttons for better interaction.
- Refactored ToolResultDisplay to improve result presentation and user feedback.
- Updated ToolsList to use a consistent icon for better visual clarity.

* refactor: update linting and enhance ESLint configuration

- Changed pre-commit hook to use `pnpm exec lint-staged` for better compatibility.
- Updated ESLint configuration to disable specific formatters and rules that conflict with React 19 syntax.
- Improved README formatting for better readability and consistency.
- Refactored various components for cleaner code and improved performance, including adjustments to imports and formatting.
- Enhanced utility functions and context management for better maintainability.

* refactor: update inspector components and improve TypeScript configuration

- Removed the LogoAnimated and McpUseLogo components to streamline the codebase.
- Updated imports in App.tsx for better organization and clarity.
- Enhanced TypeScript configuration by adding "composite" to tsconfig.json for improved project structure.
- Refactored usePrismTheme hook to provide better type definitions.
- Improved error logging in mcpResourceUtils for clearer debugging.
- Removed unused components and optimized the overall structure of the inspector package.

* feat: implement streaming chat API and enhance ChatTab component

- Added a new streaming chat API endpoint to handle real-time message updates.
- Refactored ChatTab component to support streaming responses, improving user experience during chat interactions.
- Introduced MessageList component for better message rendering and management.
- Updated server middleware and shared utilities to accommodate streaming functionality.
- Enhanced error handling and response management for the chat API.

* feat: enhance ChatTab and MessageList components for improved message handling

- Added support for message parts in ChatTab and MessageList components to better manage streaming content and tool invocations.
- Updated the server middleware to use 'text/event-stream' for the chat API, enabling real-time updates.
- Refactored message rendering logic to accommodate new message structure, enhancing user experience during chat interactions.
- Introduced new dependencies in package.json for better integration with AI SDK components.

* refactor: streamline ChatTab component and enhance chat functionality

- Refactored ChatTab component to utilize custom hooks for better state management and separation of concerns.
- Removed unused imports and interfaces to simplify the codebase.
- Introduced new components for chat header, input area, and landing form to improve modularity and readability.
- Enhanced keyboard shortcut handling for improved user experience during chat interactions.
- Updated message handling logic to support new chat features and improve performance.

* refactor: reorganize CommandPalette and ServerDropdown components for improved clarity

- Moved the MCP Official Documentation command item within the CommandPalette for better structure.
- Updated ServerDropdown to enhance error handling and user feedback with improved tooltip functionality.
- Removed the AddServerDialog and ServerSelectionModal components to streamline the UI and reduce complexity.
- Adjusted imports and component logic for better maintainability and readability.

* feat: add 'Connect Server' command to CommandPalette and enhance UI elements

- Introduced a new global command item 'Connect Server' in the CommandPalette for easier navigation.
- Updated the ChatHeader component's styling for improved visual consistency.
- Enhanced ToolCallDisplay component to use background colors instead of borders for better status indication.

* add changest

* add chanset

* Remove outdated changesets for Apps SDK and Inspector integration, consolidating features and fixes into respective changelogs and package versions.

* fix: change cwd for changeset

* chore: trigger beta workflows

* chore: trigger typescript beta workflow

* fix: resolve changeset directory detection in TypeScript release workflows

* Revert "Remove outdated changesets for Apps SDK and Inspector integration, consolidating features and fixes into respective changelogs and package versions."

This reverts commit 4099bfd096.

* move changelog

* chore(typescript): version packages (beta)

* fix npm auth

* Revert "chore(typescript): version packages (beta)"

This reverts commit a452e1bf69.

* chore(typescript): version packages (beta)

* Revert "fix npm auth"

This reverts commit 03834bca26.

* Revert "chore(typescript): version packages (beta)"

This reverts commit f1e9ee65e0.

* chore(typescript): version packages (beta)

* chore(typescript): enhance release workflows for beta versioning

- Added steps to enter prerelease mode and publish beta packages in typescript-release-beta.yml.
- Implemented a step to exit prerelease mode if necessary in typescript-release.yml.
- Updated package.json to include a new script for releasing beta packages.

* chore(typescript): improve beta release workflow with prerelease state management

- Added conditional step to enter prerelease mode only if not already in it in typescript-release-beta.yml.
- Separated the commit of prerelease state into its own step for clarity.
- Enhanced the restoration of changesets and package files after beta publishing to ensure main branch integrity.

* fix: run CI on beta

* refactor: clean up code formatting and improve readability across multiple components (#327)

* refactor: clean up code formatting and improve readability across multiple components

* chore(typescript): add changeset for patch updates

* chore: enter beta prerelease mode

* chore(typescript): update beta release process to use changeset publish

* fix/templates-version

* changeset

* fix: beta release workflow - commit version changes instead of restoring

* chore: version packages for beta release [skip ci]

* fix: remove --tag beta flag (handled automatically in prerelease mode)

---------

Co-authored-by: Enrico Toniato <2827496+tonxxd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-19 17:07:43 +02:00