mcp-use 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_use-1.6.0/.env.example +61 -0
- mcp_use-1.6.0/.gitignore +128 -0
- mcp_use-1.6.0/.pre-commit-config.yaml +28 -0
- mcp_use-1.6.0/CLAUDE.md +254 -0
- mcp_use-1.6.0/PKG-INFO +928 -0
- mcp_use-1.6.0/README.md +881 -0
- mcp_use-1.6.0/examples/airbnb_mcp.json +8 -0
- mcp_use-1.6.0/examples/airbnb_use.py +46 -0
- mcp_use-1.6.0/examples/anthropic_integration_example.py +114 -0
- mcp_use-1.6.0/examples/blender_use.py +53 -0
- mcp_use-1.6.0/examples/browser_use.py +48 -0
- mcp_use-1.6.0/examples/chat_example.py +79 -0
- mcp_use-1.6.0/examples/client/oauth_dynamic_client_registration.py +46 -0
- mcp_use-1.6.0/examples/client/oauth_preregistered.py +71 -0
- mcp_use-1.6.0/examples/code_mode_example.py +55 -0
- mcp_use-1.6.0/examples/direct_tool_call.py +59 -0
- mcp_use-1.6.0/examples/example_middleware.py +102 -0
- mcp_use-1.6.0/examples/filesystem_use.py +58 -0
- mcp_use-1.6.0/examples/google_integration_example.py +138 -0
- mcp_use-1.6.0/examples/http_example.py +53 -0
- mcp_use-1.6.0/examples/langchain_integration_example.py +78 -0
- mcp_use-1.6.0/examples/limited_memory_chat.py +89 -0
- mcp_use-1.6.0/examples/mcp_everything.py +39 -0
- mcp_use-1.6.0/examples/multi_server_example.py +66 -0
- mcp_use-1.6.0/examples/multimodal_input_example.py +35 -0
- mcp_use-1.6.0/examples/openai_integration_example.py +92 -0
- mcp_use-1.6.0/examples/sandbox_everything.py +66 -0
- mcp_use-1.6.0/examples/server/context_example.py +301 -0
- mcp_use-1.6.0/examples/server/middleware_example.py +267 -0
- mcp_use-1.6.0/examples/server/server_example.py +84 -0
- mcp_use-1.6.0/examples/simple_oauth_example.py +40 -0
- mcp_use-1.6.0/examples/simple_server_manager_use.py +113 -0
- mcp_use-1.6.0/examples/stream_example.py +60 -0
- mcp_use-1.6.0/examples/structured_output.py +78 -0
- mcp_use-1.6.0/mcp_use/__init__.py +52 -0
- mcp_use-1.6.0/mcp_use/adapters/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/adapters/__init__.py +21 -0
- mcp_use-1.6.0/mcp_use/adapters/base.py +17 -0
- mcp_use-1.6.0/mcp_use/adapters/langchain_adapter.py +18 -0
- mcp_use-1.6.0/mcp_use/agents/__init__.py +14 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/__init__.py +17 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/anthropic.py +95 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/base.py +343 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/google.py +105 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/langchain_adapter.py +215 -0
- mcp_use-1.6.0/mcp_use/agents/adapters/openai.py +113 -0
- mcp_use-1.6.0/mcp_use/agents/base.py +61 -0
- mcp_use-1.6.0/mcp_use/agents/display.py +562 -0
- mcp_use-1.6.0/mcp_use/agents/managers/__init__.py +19 -0
- mcp_use-1.6.0/mcp_use/agents/managers/base.py +36 -0
- mcp_use-1.6.0/mcp_use/agents/managers/server_manager.py +137 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/__init__.py +15 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/base_tool.py +19 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/connect_server.py +77 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/disconnect_server.py +43 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/get_active_server.py +29 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/list_servers_tool.py +53 -0
- mcp_use-1.6.0/mcp_use/agents/managers/tools/search_tools.py +328 -0
- mcp_use-1.6.0/mcp_use/agents/mcpagent.py +1112 -0
- mcp_use-1.6.0/mcp_use/agents/middleware/__init__.py +5 -0
- mcp_use-1.6.0/mcp_use/agents/middleware/tool_error_middleware.py +71 -0
- mcp_use-1.6.0/mcp_use/agents/observability/__init__.py +9 -0
- mcp_use-1.6.0/mcp_use/agents/observability/callbacks_manager.py +162 -0
- mcp_use-1.6.0/mcp_use/agents/observability/laminar.py +42 -0
- mcp_use-1.6.0/mcp_use/agents/observability/langfuse.py +59 -0
- mcp_use-1.6.0/mcp_use/agents/prompts/system_prompt_builder.py +103 -0
- mcp_use-1.6.0/mcp_use/agents/prompts/templates.py +32 -0
- mcp_use-1.6.0/mcp_use/agents/remote.py +366 -0
- mcp_use-1.6.0/mcp_use/auth/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/auth/__init__.py +21 -0
- mcp_use-1.6.0/mcp_use/auth/bearer.py +16 -0
- mcp_use-1.6.0/mcp_use/auth/oauth.py +16 -0
- mcp_use-1.6.0/mcp_use/auth/oauth_callback.py +23 -0
- mcp_use-1.6.0/mcp_use/client/__init__.py +1 -0
- mcp_use-1.6.0/mcp_use/client/auth/__init__.py +6 -0
- mcp_use-1.6.0/mcp_use/client/auth/bearer.py +23 -0
- mcp_use-1.6.0/mcp_use/client/auth/oauth.py +805 -0
- mcp_use-1.6.0/mcp_use/client/auth/oauth_callback.py +212 -0
- mcp_use-1.6.0/mcp_use/client/client.py +604 -0
- mcp_use-1.6.0/mcp_use/client/code_executor.py +352 -0
- mcp_use-1.6.0/mcp_use/client/config.py +142 -0
- mcp_use-1.6.0/mcp_use/client/connectors/__init__.py +25 -0
- mcp_use-1.6.0/mcp_use/client/connectors/base.py +555 -0
- mcp_use-1.6.0/mcp_use/client/connectors/code_mode.py +176 -0
- mcp_use-1.6.0/mcp_use/client/connectors/http.py +349 -0
- mcp_use-1.6.0/mcp_use/client/connectors/sandbox.py +343 -0
- mcp_use-1.6.0/mcp_use/client/connectors/stdio.py +182 -0
- mcp_use-1.6.0/mcp_use/client/connectors/utils.py +13 -0
- mcp_use-1.6.0/mcp_use/client/connectors/websocket.py +257 -0
- mcp_use-1.6.0/mcp_use/client/exceptions.py +31 -0
- mcp_use-1.6.0/mcp_use/client/middleware/__init__.py +50 -0
- mcp_use-1.6.0/mcp_use/client/middleware/logging.py +31 -0
- mcp_use-1.6.0/mcp_use/client/middleware/metrics.py +314 -0
- mcp_use-1.6.0/mcp_use/client/middleware/middleware.py +276 -0
- mcp_use-1.6.0/mcp_use/client/prompts.py +130 -0
- mcp_use-1.6.0/mcp_use/client/session.py +164 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/__init__.py +20 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/base.py +213 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/sse.py +89 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/stdio.py +69 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/streamable_http.py +91 -0
- mcp_use-1.6.0/mcp_use/client/task_managers/websocket.py +68 -0
- mcp_use-1.6.0/mcp_use/client.py +18 -0
- mcp_use-1.6.0/mcp_use/config.py +27 -0
- mcp_use-1.6.0/mcp_use/connectors/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/connectors/__init__.py +46 -0
- mcp_use-1.6.0/mcp_use/connectors/base.py +18 -0
- mcp_use-1.6.0/mcp_use/connectors/http.py +18 -0
- mcp_use-1.6.0/mcp_use/connectors/sandbox.py +18 -0
- mcp_use-1.6.0/mcp_use/connectors/stdio.py +18 -0
- mcp_use-1.6.0/mcp_use/connectors/utils.py +20 -0
- mcp_use-1.6.0/mcp_use/connectors/websocket.py +18 -0
- mcp_use-1.6.0/mcp_use/errors/__init__.py +1 -0
- mcp_use-1.6.0/mcp_use/errors/error_formatting.py +26 -0
- mcp_use-1.6.0/mcp_use/exceptions.py +46 -0
- mcp_use-1.6.0/mcp_use/logging.py +158 -0
- mcp_use-1.6.0/mcp_use/managers/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/managers/__init__.py +58 -0
- mcp_use-1.6.0/mcp_use/managers/base.py +18 -0
- mcp_use-1.6.0/mcp_use/managers/server_manager.py +18 -0
- mcp_use-1.6.0/mcp_use/managers/tools/__init__.py +45 -0
- mcp_use-1.6.0/mcp_use/managers/tools/base_tool.py +8 -0
- mcp_use-1.6.0/mcp_use/managers/tools/connect_server.py +8 -0
- mcp_use-1.6.0/mcp_use/managers/tools/disconnect_server.py +8 -0
- mcp_use-1.6.0/mcp_use/managers/tools/get_active_server.py +8 -0
- mcp_use-1.6.0/mcp_use/managers/tools/list_servers_tool.py +8 -0
- mcp_use-1.6.0/mcp_use/managers/tools/search_tools.py +24 -0
- mcp_use-1.6.0/mcp_use/middleware/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/middleware/__init__.py +89 -0
- mcp_use-1.6.0/mcp_use/middleware/logging.py +19 -0
- mcp_use-1.6.0/mcp_use/middleware/metrics.py +41 -0
- mcp_use-1.6.0/mcp_use/middleware/middleware.py +55 -0
- mcp_use-1.6.0/mcp_use/server/__fastmcp.py +5 -0
- mcp_use-1.6.0/mcp_use/server/__init__.py +16 -0
- mcp_use-1.6.0/mcp_use/server/auth/__init__.py +40 -0
- mcp_use-1.6.0/mcp_use/server/auth/bearer.py +47 -0
- mcp_use-1.6.0/mcp_use/server/auth/dependencies.py +59 -0
- mcp_use-1.6.0/mcp_use/server/auth/middleware.py +137 -0
- mcp_use-1.6.0/mcp_use/server/auth/models.py +39 -0
- mcp_use-1.6.0/mcp_use/server/context.py +156 -0
- mcp_use-1.6.0/mcp_use/server/logging/__init__.py +40 -0
- mcp_use-1.6.0/mcp_use/server/logging/config.py +118 -0
- mcp_use-1.6.0/mcp_use/server/logging/formatters.py +148 -0
- mcp_use-1.6.0/mcp_use/server/logging/middleware.py +206 -0
- mcp_use-1.6.0/mcp_use/server/logging/startup.py +53 -0
- mcp_use-1.6.0/mcp_use/server/logging/state.py +16 -0
- mcp_use-1.6.0/mcp_use/server/middleware/__init__.py +17 -0
- mcp_use-1.6.0/mcp_use/server/middleware/middleware.py +148 -0
- mcp_use-1.6.0/mcp_use/server/middleware/server_session.py +58 -0
- mcp_use-1.6.0/mcp_use/server/middleware/telemetry.py +72 -0
- mcp_use-1.6.0/mcp_use/server/router.py +260 -0
- mcp_use-1.6.0/mcp_use/server/runner.py +99 -0
- mcp_use-1.6.0/mcp_use/server/server.py +441 -0
- mcp_use-1.6.0/mcp_use/server/types.py +9 -0
- mcp_use-1.6.0/mcp_use/server/utils/__init__.py +0 -0
- mcp_use-1.6.0/mcp_use/server/utils/inspector.py +75 -0
- mcp_use-1.6.0/mcp_use/server/utils/openmcp.py +173 -0
- mcp_use-1.6.0/mcp_use/server/utils/routes.py +20 -0
- mcp_use-1.6.0/mcp_use/server/utils/templates/docs.html +222 -0
- mcp_use-1.6.0/mcp_use/server/utils/utils.py +54 -0
- mcp_use-1.6.0/mcp_use/session.py +18 -0
- mcp_use-1.6.0/mcp_use/task_managers/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/task_managers/__init__.py +48 -0
- mcp_use-1.6.0/mcp_use/task_managers/base.py +18 -0
- mcp_use-1.6.0/mcp_use/task_managers/sse.py +18 -0
- mcp_use-1.6.0/mcp_use/task_managers/stdio.py +18 -0
- mcp_use-1.6.0/mcp_use/task_managers/streamable_http.py +20 -0
- mcp_use-1.6.0/mcp_use/task_managers/websocket.py +18 -0
- mcp_use-1.6.0/mcp_use/telemetry/__init__.py +11 -0
- mcp_use-1.6.0/mcp_use/telemetry/events.py +275 -0
- mcp_use-1.6.0/mcp_use/telemetry/telemetry.py +557 -0
- mcp_use-1.6.0/mcp_use/telemetry/utils.py +308 -0
- mcp_use-1.6.0/mcp_use/types/.deprecated +0 -0
- mcp_use-1.6.0/mcp_use/types/sandbox.py +18 -0
- mcp_use-1.6.0/mcp_use/utils.py +27 -0
- mcp_use-1.6.0/pyproject.toml +100 -0
- mcp_use-1.6.0/pytest.ini +6 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_adapters_base.mdx +49 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_adapters_langchain_adapter.mdx +49 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_adapters_anthropic.mdx +49 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_adapters_base.mdx +240 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_adapters_langchain_adapter.mdx +55 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_adapters_openai.mdx +49 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_base.mdx +109 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_display.mdx +57 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_base.mdx +81 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_server_manager.mdx +82 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_base_tool.mdx +62 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_connect_server.mdx +95 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_disconnect_server.mdx +88 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_get_active_server.mdx +88 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_list_servers_tool.mdx +88 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_managers_tools_search_tools.mdx +203 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_mcpagent.mdx +352 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_middleware_tool_error_middleware.mdx +17 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_observability_callbacks_manager.mdx +180 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_observability_laminar.mdx +16 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_observability_langfuse.mdx +12 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_prompts_system_prompt_builder.mdx +115 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_prompts_templates.mdx +12 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_agents_remote.mdx +118 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_auth_bearer.mdx +46 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_auth_oauth.mdx +48 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_auth_oauth_callback.mdx +73 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client.mdx +12 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_auth_bearer.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_auth_oauth.mdx +432 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_auth_oauth_callback.mdx +138 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_client.mdx +332 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_code_executor.mdx +74 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_config.mdx +86 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_base.mdx +325 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_code_mode.mdx +52 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_http.mdx +62 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_sandbox.mdx +127 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_stdio.mdx +61 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_utils.mdx +37 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_connectors_websocket.mdx +74 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_exceptions.mdx +174 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_middleware_logging.mdx +33 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_middleware_metrics.mdx +185 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_middleware_middleware.mdx +595 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_prompts.mdx +17 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_session.mdx +232 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_task_managers_base.mdx +95 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_task_managers_sse.mdx +58 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_task_managers_stdio.mdx +54 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_task_managers_streamable_http.mdx +58 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_client_task_managers_websocket.mdx +52 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_config.mdx +52 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_base.mdx +45 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_http.mdx +52 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_sandbox.mdx +52 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_stdio.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_utils.mdx +34 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_connectors_websocket.mdx +44 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_errors_error_formatting.mdx +38 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_exceptions.mdx +162 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_logging.mdx +37 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_base.mdx +27 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_server_manager.mdx +43 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_base_tool.mdx +49 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_connect_server.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_disconnect_server.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_get_active_server.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_list_servers_tool.mdx +50 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_managers_tools_search_tools.mdx +123 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_middleware_logging.mdx +32 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_middleware_metrics.mdx +108 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_middleware_middleware.mdx +172 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_context.mdx +135 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_logging_config.mdx +76 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_logging_formatters.mdx +205 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_logging_middleware.mdx +62 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_logging_startup.mdx +43 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_logging_state.mdx +56 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_middleware_middleware.mdx +407 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_router.mdx +365 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_runner.mdx +130 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_server.mdx +105 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_types.mdx +14 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_utils_inspector.mdx +12 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_utils_openmcp.mdx +118 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_utils_routes.mdx +60 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_utils_signals.mdx +32 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_server_utils_utils.mdx +81 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_session.mdx +43 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_task_managers_base.mdx +38 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_task_managers_sse.mdx +47 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_task_managers_stdio.mdx +43 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_task_managers_streamable_http.mdx +47 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_task_managers_websocket.mdx +43 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_types_sandbox.mdx +51 -0
- mcp_use-1.6.0/python/api-reference/mcp_use_utils.mdx +44 -0
- mcp_use-1.6.0/static/logo-gh.jpg +0 -0
- mcp_use-1.6.0/static/logo_black.svg +8 -0
- mcp_use-1.6.0/static/logo_white.svg +8 -0
- mcp_use-1.6.0/tests/conftest.py +37 -0
- mcp_use-1.6.0/tests/integration/__init__.py +1 -0
- mcp_use-1.6.0/tests/integration/agent/test_agent_run.py +47 -0
- mcp_use-1.6.0/tests/integration/agent/test_agent_stream.py +84 -0
- mcp_use-1.6.0/tests/integration/agent/test_agent_structured_output.py +63 -0
- mcp_use-1.6.0/tests/integration/agent/test_server_manager.py +118 -0
- mcp_use-1.6.0/tests/integration/agent/test_stream_events_memory.py +143 -0
- mcp_use-1.6.0/tests/integration/client/auth/__init__.py +0 -0
- mcp_use-1.6.0/tests/integration/client/auth/test_bearer_auth.py +216 -0
- mcp_use-1.6.0/tests/integration/client/others/test_code_mode.py +218 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_auth.py +201 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_discovery.py +70 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_elicitation.py +26 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_logging.py +22 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_notifications.py +22 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_prompts.py +20 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_resources.py +42 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_roots.py +161 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_sampling.py +48 -0
- mcp_use-1.6.0/tests/integration/client/primitives/test_tools.py +23 -0
- mcp_use-1.6.0/tests/integration/client/transports/test_stdio.py +53 -0
- mcp_use-1.6.0/tests/integration/client/transports/test_streamable_http.py +73 -0
- mcp_use-1.6.0/tests/integration/conftest.py +76 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/__init__.py +1 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/auth_server.py +158 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/bearer_auth_server.py +95 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/conformance_server.py +318 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/primitive_server.py +165 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/simple_server.py +34 -0
- mcp_use-1.6.0/tests/integration/servers_for_testing/timeout_test_server.py +151 -0
- mcp_use-1.6.0/tests/unit/backward_compatibility.py +104 -0
- mcp_use-1.6.0/tests/unit/server/auth/__init__.py +0 -0
- mcp_use-1.6.0/tests/unit/server/auth/test_auth_middleware.py +346 -0
- mcp_use-1.6.0/tests/unit/server/auth/test_bearer_auth.py +177 -0
- mcp_use-1.6.0/tests/unit/server/middleware/test_initialize_middleware.py +440 -0
- mcp_use-1.6.0/tests/unit/server/test_server_config.py +108 -0
- mcp_use-1.6.0/tests/unit/test_agent.py +279 -0
- mcp_use-1.6.0/tests/unit/test_client.py +577 -0
- mcp_use-1.6.0/tests/unit/test_client_capabilities.py +296 -0
- mcp_use-1.6.0/tests/unit/test_code_executor.py +426 -0
- mcp_use-1.6.0/tests/unit/test_config.py +225 -0
- mcp_use-1.6.0/tests/unit/test_connection_manager_timeout.py +240 -0
- mcp_use-1.6.0/tests/unit/test_enum_handling.py +109 -0
- mcp_use-1.6.0/tests/unit/test_http_connector.py +456 -0
- mcp_use-1.6.0/tests/unit/test_sandbox_connector.py +311 -0
- mcp_use-1.6.0/tests/unit/test_search_tools_issue_138.py +185 -0
- mcp_use-1.6.0/tests/unit/test_session.py +114 -0
- mcp_use-1.6.0/tests/unit/test_stdio_connector.py +389 -0
- mcp_use-1.6.0/tests/unit/test_websocket_connection_manager.py +81 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# MCP-Use Environment Configuration
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Copy this file to .env and fill in your actual values
|
|
5
|
+
# The .env file is already in .gitignore and won't be committed
|
|
6
|
+
|
|
7
|
+
# =============================================================================
|
|
8
|
+
# Observability - Optional but recommended for debugging and monitoring
|
|
9
|
+
# =============================================================================
|
|
10
|
+
|
|
11
|
+
# Langfuse Configuration (https://langfuse.com)
|
|
12
|
+
# Sign up at https://cloud.langfuse.com or self-host
|
|
13
|
+
LANGFUSE_PUBLIC_KEY=pk-lf-your-public-key-here
|
|
14
|
+
LANGFUSE_SECRET_KEY=sk-lf-your-secret-key-here
|
|
15
|
+
# LANGFUSE_HOST=https://cloud.langfuse.com # Default, uncomment for self-hosted
|
|
16
|
+
|
|
17
|
+
# Laminar Configuration (https://www.lmnr.ai)
|
|
18
|
+
# Sign up at https://www.lmnr.ai and get your project API key
|
|
19
|
+
LAMINAR_PROJECT_API_KEY=your-laminar-project-api-key-here
|
|
20
|
+
|
|
21
|
+
# =============================================================================
|
|
22
|
+
# LLM Provider API Keys
|
|
23
|
+
# =============================================================================
|
|
24
|
+
|
|
25
|
+
# OpenAI
|
|
26
|
+
OPENAI_API_KEY=sk-your-openai-api-key-here
|
|
27
|
+
|
|
28
|
+
# Anthropic
|
|
29
|
+
ANTHROPIC_API_KEY=sk-ant-your-anthropic-api-key-here
|
|
30
|
+
|
|
31
|
+
# Google (for Gemini)
|
|
32
|
+
GOOGLE_API_KEY=your-google-api-key-here
|
|
33
|
+
|
|
34
|
+
# Azure OpenAI
|
|
35
|
+
AZURE_OPENAI_API_KEY=your-azure-openai-key-here
|
|
36
|
+
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
|
|
37
|
+
|
|
38
|
+
# =============================================================================
|
|
39
|
+
# Debug and Development
|
|
40
|
+
# =============================================================================
|
|
41
|
+
|
|
42
|
+
# MCP-Use Debug Level (1=INFO, 2=DEBUG)
|
|
43
|
+
DEBUG=1
|
|
44
|
+
# Alternative debug variable
|
|
45
|
+
MCP_USE_DEBUG=1
|
|
46
|
+
|
|
47
|
+
# Disable specific features (set to 'false' to disable)
|
|
48
|
+
# MCP_USE_LANGFUSE=false
|
|
49
|
+
# MCP_USE_LAMINAR=false
|
|
50
|
+
# MCP_USE_TELEMETRY=false
|
|
51
|
+
|
|
52
|
+
# =============================================================================
|
|
53
|
+
# MCP Server Specific Configuration
|
|
54
|
+
# =============================================================================
|
|
55
|
+
|
|
56
|
+
# E2B Sandbox (for sandboxed execution)
|
|
57
|
+
E2B_API_KEY=your-e2b-api-key-here
|
|
58
|
+
|
|
59
|
+
# Custom MCP server endpoints (if using HTTP/WebSocket servers)
|
|
60
|
+
# MCP_SERVER_URL=http://localhost:8080
|
|
61
|
+
# MCP_WEBSOCKET_URL=ws://localhost:8081
|
mcp_use-1.6.0/.gitignore
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
|
|
36
|
+
# Unit test / coverage reports
|
|
37
|
+
htmlcov/
|
|
38
|
+
.tox/
|
|
39
|
+
.nox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
db.sqlite3
|
|
57
|
+
db.sqlite3-journal
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation
|
|
67
|
+
docs/_build/
|
|
68
|
+
|
|
69
|
+
# PyBuilder
|
|
70
|
+
target/
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# IPython
|
|
76
|
+
profile_default/
|
|
77
|
+
ipython_config.py
|
|
78
|
+
|
|
79
|
+
# pyenv
|
|
80
|
+
.python-version
|
|
81
|
+
|
|
82
|
+
# pipenv
|
|
83
|
+
Pipfile.lock
|
|
84
|
+
|
|
85
|
+
# poetry
|
|
86
|
+
poetry.lock
|
|
87
|
+
|
|
88
|
+
# Environment variables
|
|
89
|
+
.env
|
|
90
|
+
.venv
|
|
91
|
+
env/
|
|
92
|
+
venv/
|
|
93
|
+
ENV/
|
|
94
|
+
env.bak/
|
|
95
|
+
venv.bak/
|
|
96
|
+
|
|
97
|
+
# Spyder project settings
|
|
98
|
+
.spyderproject
|
|
99
|
+
.spyproject
|
|
100
|
+
|
|
101
|
+
# Rope project settings
|
|
102
|
+
.ropeproject
|
|
103
|
+
|
|
104
|
+
# mkdocs documentation
|
|
105
|
+
/site
|
|
106
|
+
|
|
107
|
+
# mypy
|
|
108
|
+
.mypy_cache/
|
|
109
|
+
.dmypy.json
|
|
110
|
+
dmypy.json
|
|
111
|
+
|
|
112
|
+
# Pyre type checker
|
|
113
|
+
.pyre/
|
|
114
|
+
|
|
115
|
+
# VS Code
|
|
116
|
+
.vscode/
|
|
117
|
+
*.code-workspace
|
|
118
|
+
|
|
119
|
+
# PyCharm
|
|
120
|
+
.idea/
|
|
121
|
+
*.iml
|
|
122
|
+
|
|
123
|
+
# macOS
|
|
124
|
+
.DS_Store
|
|
125
|
+
|
|
126
|
+
# AI
|
|
127
|
+
.cursor
|
|
128
|
+
.claude
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.11.12
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: local
|
|
10
|
+
hooks:
|
|
11
|
+
- id: ty
|
|
12
|
+
name: ty check
|
|
13
|
+
entry: ty check
|
|
14
|
+
language: system
|
|
15
|
+
types: [python]
|
|
16
|
+
exclude: ^tests/
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
19
|
+
rev: v5.0.0
|
|
20
|
+
hooks:
|
|
21
|
+
- id: trailing-whitespace
|
|
22
|
+
- id: end-of-file-fixer
|
|
23
|
+
- id: check-yaml
|
|
24
|
+
- id: check-added-large-files
|
|
25
|
+
- id: debug-statements
|
|
26
|
+
|
|
27
|
+
default_language_version:
|
|
28
|
+
python: python3.11
|
mcp_use-1.6.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# CLAUDE.md - Python Library
|
|
2
|
+
|
|
3
|
+
This file provides guidance for working with the Python implementation of mcp-use.
|
|
4
|
+
|
|
5
|
+
**IMPORTANT:** Read the root `/CLAUDE.md` first for critical workflow requirements around planning, breaking changes, and testing standards.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Project Overview
|
|
10
|
+
|
|
11
|
+
**mcp-use** is a unified MCP (Model Context Protocol) client library that enables any LLM to connect to MCP servers and build custom agents with tool access. The library provides a high-level Python interface for connecting LangChain-compatible LLMs to MCP tools like web browsing, file operations, and more.
|
|
12
|
+
|
|
13
|
+
## Development Commands
|
|
14
|
+
|
|
15
|
+
### Setup
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Activate virtual environment (if it exists)
|
|
19
|
+
source env/bin/activate
|
|
20
|
+
|
|
21
|
+
# Create virtual environment if it doesn't exist
|
|
22
|
+
# python -m venv env && source env/bin/activate
|
|
23
|
+
|
|
24
|
+
# Install for development
|
|
25
|
+
pip install -e ".[dev,search]"
|
|
26
|
+
|
|
27
|
+
# Install with optional dependencies
|
|
28
|
+
pip install -e ".[dev,anthropic,openai,e2b,search]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Code Quality
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Run linting and formatting
|
|
35
|
+
ruff check --fix
|
|
36
|
+
ruff format
|
|
37
|
+
|
|
38
|
+
# Run type checking
|
|
39
|
+
ty check
|
|
40
|
+
|
|
41
|
+
# Run pre-commit hooks
|
|
42
|
+
prek run --all-files
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Testing
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Run all tests
|
|
49
|
+
pytest
|
|
50
|
+
|
|
51
|
+
# Run specific test types
|
|
52
|
+
pytest tests/unit/ # Unit tests only
|
|
53
|
+
pytest tests/integration/ # Integration tests only
|
|
54
|
+
|
|
55
|
+
# Run with coverage
|
|
56
|
+
pytest --cov=mcp_use --cov-report=html
|
|
57
|
+
|
|
58
|
+
# Run specific test file
|
|
59
|
+
pytest tests/unit/test_client.py
|
|
60
|
+
|
|
61
|
+
# Run with debug output
|
|
62
|
+
DEBUG=2 pytest tests/unit/test_client.py -v -s
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Local Development
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Debug mode environment variable
|
|
69
|
+
export DEBUG=1 # INFO level
|
|
70
|
+
export DEBUG=2 # DEBUG level (full verbose)
|
|
71
|
+
|
|
72
|
+
# Or set MCP_USE_DEBUG
|
|
73
|
+
export MCP_USE_DEBUG=2
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Architecture Overview
|
|
77
|
+
|
|
78
|
+
### Core Components
|
|
79
|
+
|
|
80
|
+
**MCPClient** (`mcp_use/client.py`)
|
|
81
|
+
|
|
82
|
+
- Main entry point for MCP server management
|
|
83
|
+
- Handles configuration loading from files or dictionaries
|
|
84
|
+
- Manages multiple MCP server sessions
|
|
85
|
+
- Supports sandboxed execution via E2B
|
|
86
|
+
|
|
87
|
+
**MCPAgent** (`mcp_use/agents/mcpagent.py`)
|
|
88
|
+
|
|
89
|
+
- High-level agent interface using LangChain's agent framework
|
|
90
|
+
- Integrates LLMs with MCP tools
|
|
91
|
+
- Supports streaming responses and conversation memory
|
|
92
|
+
- Can use ServerManager for dynamic server selection
|
|
93
|
+
|
|
94
|
+
**MCPSession** (`mcp_use/session.py`)
|
|
95
|
+
|
|
96
|
+
- Manages individual MCP server connections
|
|
97
|
+
- Handles tool discovery and resource management
|
|
98
|
+
- Maintains connection state and lifecycle
|
|
99
|
+
|
|
100
|
+
**Connectors** (`mcp_use/connectors/`)
|
|
101
|
+
|
|
102
|
+
- Abstraction layer for different MCP transport protocols
|
|
103
|
+
- `StdioConnector`: Process-based MCP servers
|
|
104
|
+
- `HttpConnector`: HTTP-based MCP servers
|
|
105
|
+
- `WebSocketConnector`: WebSocket-based MCP servers
|
|
106
|
+
- `SandboxConnector`: E2B sandboxed execution
|
|
107
|
+
|
|
108
|
+
**ServerManager** (`mcp_use/managers/server_manager.py`)
|
|
109
|
+
|
|
110
|
+
- Provides dynamic server selection capabilities
|
|
111
|
+
- Allows agents to choose appropriate servers for tasks
|
|
112
|
+
- Manages server tool discovery and activation
|
|
113
|
+
|
|
114
|
+
### Key Patterns
|
|
115
|
+
|
|
116
|
+
**Configuration-Driven Design**: Servers are configured via JSON files or dictionaries with `mcpServers` key containing server definitions.
|
|
117
|
+
|
|
118
|
+
**Async/Await**: All I/O operations are asynchronous using asyncio patterns.
|
|
119
|
+
|
|
120
|
+
**LangChain Integration**: Tools are converted to LangChain format via adapters, enabling use with any LangChain-compatible LLM.
|
|
121
|
+
|
|
122
|
+
**Multi-Transport Support**: Supports stdio, HTTP, WebSocket, and sandboxed connections to MCP servers.
|
|
123
|
+
|
|
124
|
+
**Telemetry**: Built-in telemetry using PostHog and Scarf.sh for usage analytics (can be disabled).
|
|
125
|
+
|
|
126
|
+
## Configuration Examples
|
|
127
|
+
|
|
128
|
+
### Basic Server Configuration
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"mcpServers": {
|
|
133
|
+
"playwright": {
|
|
134
|
+
"command": "npx",
|
|
135
|
+
"args": ["@playwright/mcp@latest"],
|
|
136
|
+
"env": { "DISPLAY": ":1" }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### HTTP Server Configuration
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"http_server": {
|
|
148
|
+
"url": "http://localhost:8931/sse"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Multi-Server Configuration
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"mcpServers": {
|
|
159
|
+
"playwright": {
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["@playwright/mcp@latest"]
|
|
162
|
+
},
|
|
163
|
+
"airbnb": {
|
|
164
|
+
"command": "npx",
|
|
165
|
+
"args": ["-y", "@openbnb/mcp-server-airbnb"]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Code Style and Standards
|
|
172
|
+
|
|
173
|
+
- **Line Length**: 200 characters (configured in ruff.toml)
|
|
174
|
+
- **Python Version**: 3.11+ required
|
|
175
|
+
- **Formatting**: Use Ruff for formatting and linting
|
|
176
|
+
- **Type Hints**: All public APIs should have type hints
|
|
177
|
+
- **Async Patterns**: Use async/await consistently for I/O operations
|
|
178
|
+
- **Error Handling**: Proper exception handling with logging
|
|
179
|
+
- **Documentation**: Docstrings follow Google style
|
|
180
|
+
|
|
181
|
+
## Testing Strategy
|
|
182
|
+
|
|
183
|
+
**Tests are MANDATORY for new functionality. See root CLAUDE.md for standards.**
|
|
184
|
+
|
|
185
|
+
### Unit Tests (`tests/unit/`)
|
|
186
|
+
|
|
187
|
+
- Test individual components in isolation
|
|
188
|
+
- Mock only external dependencies (network, file I/O), NOT internal logic
|
|
189
|
+
- Focus on business logic and edge cases
|
|
190
|
+
- **DO NOT** create tests that only verify mocks were called
|
|
191
|
+
|
|
192
|
+
### Integration Tests (`tests/integration/`)
|
|
193
|
+
|
|
194
|
+
- Test component interactions with real MCP servers
|
|
195
|
+
- Organized by category:
|
|
196
|
+
- `client/transports/` - stdio, sse, streamable_http
|
|
197
|
+
- `client/primitives/` - tools, resources, prompts
|
|
198
|
+
- `agent/` - Full agent workflows (require API keys)
|
|
199
|
+
- Custom test servers in `tests/integration/servers_for_testing/`
|
|
200
|
+
|
|
201
|
+
### Test Requirements
|
|
202
|
+
|
|
203
|
+
- Every new public method/function needs tests
|
|
204
|
+
- Test both success cases AND error handling
|
|
205
|
+
- Integration tests preferred over heavily mocked unit tests
|
|
206
|
+
- If you mock everything, you're testing nothing
|
|
207
|
+
|
|
208
|
+
### Test Configuration
|
|
209
|
+
|
|
210
|
+
- Uses pytest with asyncio mode
|
|
211
|
+
- Fixtures defined in `conftest.py`
|
|
212
|
+
- Test servers provide controlled MCP environments
|
|
213
|
+
|
|
214
|
+
## Important Development Notes
|
|
215
|
+
|
|
216
|
+
- **Environment Setup**: Requires Python 3.11+ and appropriate LangChain provider packages
|
|
217
|
+
- **MCP Protocol**: Built on Model Context Protocol specification
|
|
218
|
+
- **LangChain Compatibility**: Only models with tool calling capabilities are supported
|
|
219
|
+
- **Resource Management**: Always properly close sessions to avoid resource leaks
|
|
220
|
+
- **Debugging**: Use DEBUG environment variable or `mcp_use.set_debug()` for verbose logging
|
|
221
|
+
- **Memory Management**: MCPAgent supports conversation memory for context retention
|
|
222
|
+
- **Security**: Tool access can be restricted via `disallowed_tools` parameter
|
|
223
|
+
|
|
224
|
+
## Common Development Tasks
|
|
225
|
+
|
|
226
|
+
### Adding a New Connector
|
|
227
|
+
|
|
228
|
+
1. Extend `BaseConnector` in `mcp_use/connectors/`
|
|
229
|
+
2. Implement required async methods
|
|
230
|
+
3. Add connector to factory in `config.py`
|
|
231
|
+
4. Write integration tests
|
|
232
|
+
|
|
233
|
+
### Adding New Agent Features
|
|
234
|
+
|
|
235
|
+
1. Modify `MCPAgent` class in `mcp_use/agents/mcpagent.py`
|
|
236
|
+
2. Update system prompt templates if needed
|
|
237
|
+
3. Add comprehensive tests
|
|
238
|
+
4. Update documentation
|
|
239
|
+
|
|
240
|
+
### Testing with Custom MCP Servers
|
|
241
|
+
|
|
242
|
+
1. Create test server in `tests/integration/servers_for_testing/`
|
|
243
|
+
2. Add integration test in appropriate transport directory
|
|
244
|
+
3. Use custom servers for controlled testing scenarios
|
|
245
|
+
|
|
246
|
+
## Post-Implementation Checklist
|
|
247
|
+
|
|
248
|
+
After completing any feature or fix:
|
|
249
|
+
|
|
250
|
+
1. **Tests pass**: `pytest tests/unit` (and integration if applicable)
|
|
251
|
+
2. **Linting passes**: `ruff check && ruff format --check`
|
|
252
|
+
3. **Documentation updated**: Check `docs/`, README, docstrings
|
|
253
|
+
4. **Examples updated**: Check `examples/` directory if API changed
|
|
254
|
+
5. **PR description ready**: Follow `.github/pull_request_template.md`
|