mirror of
https://github.com/mcp-use/mcp-use.git
synced 2026-09-14 18:06:01 +08:00
8a2e84e1ca
* 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>