mcp-use 1.2.7__tar.gz → 1.2.9__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.

Potentially problematic release.


This version of mcp-use might be problematic. Click here for more details.

Files changed (84) hide show
  1. {mcp_use-1.2.7 → mcp_use-1.2.9}/.github/workflows/tests.yml +1 -1
  2. {mcp_use-1.2.7 → mcp_use-1.2.9}/.pre-commit-config.yaml +2 -2
  3. mcp_use-1.2.9/CONTRIBUTING.md +146 -0
  4. {mcp_use-1.2.7 → mcp_use-1.2.9}/PKG-INFO +51 -10
  5. {mcp_use-1.2.7 → mcp_use-1.2.9}/README.md +48 -9
  6. mcp_use-1.2.9/docs/api-reference/mcpagent.mdx +21 -0
  7. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/development.mdx +1 -22
  8. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/docs.json +1 -0
  9. mcp_use-1.2.9/docs/essentials/server-manager.mdx +342 -0
  10. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/favicon.svg +1 -1
  11. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/introduction.mdx +17 -0
  12. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/quickstart.mdx +11 -0
  13. mcp_use-1.2.9/examples/mcp_everything.py +41 -0
  14. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/adapters/langchain_adapter.py +3 -0
  15. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/agents/__init__.py +0 -2
  16. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/agents/mcpagent.py +85 -7
  17. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/connectors/base.py +20 -0
  18. mcp_use-1.2.9/mcp_use/managers/__init__.py +21 -0
  19. mcp_use-1.2.9/mcp_use/managers/server_manager.py +101 -0
  20. mcp_use-1.2.9/mcp_use/managers/tools/__init__.py +17 -0
  21. mcp_use-1.2.9/mcp_use/managers/tools/base_tool.py +19 -0
  22. mcp_use-1.2.9/mcp_use/managers/tools/connect_server.py +69 -0
  23. mcp_use-1.2.9/mcp_use/managers/tools/disconnect_server.py +45 -0
  24. mcp_use-1.2.9/mcp_use/managers/tools/get_active_server.py +32 -0
  25. mcp_use-1.2.9/mcp_use/managers/tools/list_servers_tool.py +52 -0
  26. mcp_use-1.2.9/mcp_use/managers/tools/search_tools.py +303 -0
  27. mcp_use-1.2.9/mcp_use/managers/tools/use_tool.py +167 -0
  28. {mcp_use-1.2.7 → mcp_use-1.2.9}/pyproject.toml +4 -28
  29. mcp_use-1.2.9/ruff.toml +25 -0
  30. mcp_use-1.2.7/mcp_use/agents/server_manager.py +0 -282
  31. {mcp_use-1.2.7 → mcp_use-1.2.9}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  32. {mcp_use-1.2.7 → mcp_use-1.2.9}/.github/pull_request_template.md +0 -0
  33. {mcp_use-1.2.7 → mcp_use-1.2.9}/.github/workflows/publish.yml +0 -0
  34. {mcp_use-1.2.7 → mcp_use-1.2.9}/.gitignore +0 -0
  35. {mcp_use-1.2.7 → mcp_use-1.2.9}/LICENSE +0 -0
  36. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/README.md +0 -0
  37. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/api-reference/introduction.mdx +0 -0
  38. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/building-custom-agents.mdx +0 -0
  39. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/essentials/configuration.mdx +0 -0
  40. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/essentials/connection-types.mdx +0 -0
  41. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/essentials/debugging.mdx +0 -0
  42. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/essentials/llm-integration.mdx +0 -0
  43. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/images/hero-dark.png +0 -0
  44. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/images/hero-light.png +0 -0
  45. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/logo/dark.svg +0 -0
  46. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/logo/light.svg +0 -0
  47. {mcp_use-1.2.7 → mcp_use-1.2.9}/docs/snippets/snippet-intro.mdx +0 -0
  48. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/airbnb_mcp.json +0 -0
  49. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/airbnb_use.py +0 -0
  50. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/blender_use.py +0 -0
  51. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/browser_mcp.json +0 -0
  52. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/browser_use.py +0 -0
  53. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/chat_example.py +0 -0
  54. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/filesystem_use.py +0 -0
  55. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/http_example.py +0 -0
  56. {mcp_use-1.2.7 → mcp_use-1.2.9}/examples/multi_server_example.py +0 -0
  57. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/__init__.py +0 -0
  58. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/adapters/__init__.py +0 -0
  59. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/adapters/base.py +0 -0
  60. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/agents/base.py +0 -0
  61. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/agents/prompts/system_prompt_builder.py +0 -0
  62. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/agents/prompts/templates.py +0 -0
  63. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/client.py +0 -0
  64. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/config.py +0 -0
  65. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/connectors/__init__.py +0 -0
  66. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/connectors/http.py +0 -0
  67. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/connectors/stdio.py +0 -0
  68. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/connectors/websocket.py +0 -0
  69. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/logging.py +0 -0
  70. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/session.py +0 -0
  71. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/task_managers/__init__.py +0 -0
  72. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/task_managers/base.py +0 -0
  73. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/task_managers/sse.py +0 -0
  74. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/task_managers/stdio.py +0 -0
  75. {mcp_use-1.2.7 → mcp_use-1.2.9}/mcp_use/task_managers/websocket.py +0 -0
  76. {mcp_use-1.2.7 → mcp_use-1.2.9}/pytest.ini +0 -0
  77. {mcp_use-1.2.7 → mcp_use-1.2.9}/static/image.jpg +0 -0
  78. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/conftest.py +0 -0
  79. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_client.py +0 -0
  80. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_config.py +0 -0
  81. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_http_connector.py +0 -0
  82. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_logging.py +0 -0
  83. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_session.py +0 -0
  84. {mcp_use-1.2.7 → mcp_use-1.2.9}/tests/unit/test_stdio_connector.py +0 -0
@@ -22,7 +22,7 @@ jobs:
22
22
  - name: Install dependencies
23
23
  run: |
24
24
  python -m pip install --upgrade pip
25
- pip install .[dev,anthropic,openai]
25
+ pip install .[dev,anthropic,openai,search]
26
26
  - name: Lint with ruff
27
27
  run: |
28
28
  ruff check .
@@ -4,10 +4,10 @@ repos:
4
4
  rev: v0.3.2
5
5
  hooks:
6
6
  - id: ruff
7
- args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml]
7
+ args: [--fix, --exit-non-zero-on-fix, --config=ruff.toml]
8
8
  types: [python]
9
9
  - id: ruff-format
10
- args: [--config=pyproject.toml]
10
+ args: [--config=ruff.toml]
11
11
  types: [python]
12
12
 
13
13
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -0,0 +1,146 @@
1
+ # Contributing to MCP-Use
2
+
3
+ Thank you for your interest in contributing to MCP-Use! This document provides guidelines and instructions for contributing to this project.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Getting Started](#getting-started)
8
+ - [Development Environment](#development-environment)
9
+ - [Installation from Source](#installation-from-source)
10
+ - [Development Workflow](#development-workflow)
11
+ - [Branching Strategy](#branching-strategy)
12
+ - [Commit Messages](#commit-messages)
13
+ - [Code Style](#code-style)
14
+ - [Pre-commit Hooks](#pre-commit-hooks)
15
+ - [Testing](#testing)
16
+ - [Running Tests](#running-tests)
17
+ - [Adding Tests](#adding-tests)
18
+ - [Pull Requests](#pull-requests)
19
+ - [Creating a Pull Request](#creating-a-pull-request)
20
+ - [Pull Request Template](#pull-request-template)
21
+ - [Documentation](#documentation)
22
+ - [Release Process](#release-process)
23
+ - [Getting Help](#getting-help)
24
+
25
+ ## Getting Started
26
+
27
+ ### Development Environment
28
+
29
+ MCP-Use requires:
30
+ - Python 3.11 or later
31
+
32
+ ### Installation from Source
33
+
34
+ 1. Fork the repository on GitHub.
35
+ 2. Clone your fork locally:
36
+ ```bash
37
+ git clone https://github.com/YOUR_USERNAME/mcp-use.git
38
+ cd mcp-use
39
+ ```
40
+ 3. Install the package in development mode:
41
+ ```bash
42
+ pip install -e ".[dev,search]"
43
+ ```
44
+ 4. Set up pre-commit hooks:
45
+ ```bash
46
+ pip install pre-commit
47
+ pre-commit install
48
+ ```
49
+
50
+ ## Development Workflow
51
+
52
+ ### Branching Strategy
53
+
54
+ - `main` branch contains the latest stable code
55
+ - Create feature branches from `main` named according to the feature you're implementing: `feature/your-feature-name`
56
+ - For bug fixes, use: `fix/bug-description`
57
+
58
+ ### Commit Messages
59
+
60
+ For now no commit style is enforced, try to keep your commit messages informational.
61
+ ### Code Style
62
+
63
+ We use [Ruff](https://github.com/astral-sh/ruff) for code formatting and linting. The configuration is in `ruff.toml`.
64
+
65
+ Key style guidelines:
66
+ - Line length: 100 characters
67
+ - Use double quotes for strings
68
+ - Follow PEP 8 naming conventions
69
+ - Add type hints to function signatures
70
+
71
+ ### Pre-commit Hooks
72
+
73
+ We use pre-commit hooks to ensure code quality before committing. The configuration is in `.pre-commit-config.yaml`.
74
+
75
+ The hooks will:
76
+ - Format code using Ruff
77
+ - Run linting checks
78
+ - Check for trailing whitespace and fix it
79
+ - Ensure files end with a newline
80
+ - Validate YAML files
81
+ - Check for large files
82
+ - Remove debug statements
83
+
84
+ ## Testing
85
+
86
+ ### Running Tests
87
+
88
+ Run the test suite with pytest:
89
+
90
+ ```bash
91
+ pytest
92
+ ```
93
+
94
+ To run specific test categories:
95
+
96
+ ```bash
97
+ pytest tests/
98
+ ```
99
+
100
+ ### Adding Tests
101
+
102
+ - Add unit tests for new functionality in `tests/unit/`
103
+ - For slow or network-dependent tests, mark them with `@pytest.mark.slow` or `@pytest.mark.integration`
104
+ - Aim for high test coverage of new code
105
+
106
+ ## Pull Requests
107
+
108
+ ### Creating a Pull Request
109
+
110
+ 1. Ensure your code passes all tests and pre-commit hooks
111
+ 2. Push your changes to your fork
112
+ 3. Submit a pull request to the main repository
113
+ 4. Follow the pull request template
114
+
115
+ ## Documentation
116
+
117
+ - Update docstrings for new or modified functions, classes, and methods
118
+ - Use Google-style docstrings:
119
+ ```python
120
+ def function_name(param1: type, param2: type) -> return_type:
121
+ """Short description.
122
+
123
+ Longer description if needed.
124
+
125
+ Args:
126
+ param1: Description of param1
127
+ param2: Description of param2
128
+
129
+ Returns:
130
+ Description of return value
131
+
132
+ Raises:
133
+ ExceptionType: When and why this exception is raised
134
+ """
135
+ ```
136
+ - Update README.md for user-facing changes
137
+
138
+ ## Getting Help
139
+
140
+ If you need help with your contribution:
141
+
142
+ - Open an issue for discussion
143
+ - Reach out to the maintainers
144
+ - Check existing code for examples
145
+
146
+ Thank you for contributing to MCP-Use!
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-use
3
- Version: 1.2.7
3
+ Version: 1.2.9
4
4
  Summary: MCP Library for LLMs
5
5
  Author-email: Pietro Zullo <pietro.zullo@gmail.com>
6
6
  License: MIT
@@ -35,6 +35,8 @@ Requires-Dist: pytest>=7.4.0; extra == 'dev'
35
35
  Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
36
  Provides-Extra: openai
37
37
  Requires-Dist: openai>=1.10.0; extra == 'openai'
38
+ Provides-Extra: search
39
+ Requires-Dist: fastembed>=0.0.1; extra == 'search'
38
40
  Description-Content-Type: text/markdown
39
41
 
40
42
  <picture>
@@ -48,6 +50,7 @@ Description-Content-Type: text/markdown
48
50
  [![PyPI Version](https://img.shields.io/pypi/v/mcp_use.svg)](https://pypi.org/project/mcp_use/)
49
51
  [![Python Versions](https://img.shields.io/pypi/pyversions/mcp_use.svg)](https://pypi.org/project/mcp_use/)
50
52
  [![Documentation](https://img.shields.io/badge/docs-mcp--use.io-blue)](https://docs.mcp-use.io)
53
+ [![Website](https://img.shields.io/badge/website-mcp--use.io-blue)](https://mcp-use.io)
51
54
  [![License](https://img.shields.io/github/license/pietrozullo/mcp-use)](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
52
55
  [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
53
56
  [![GitHub stars](https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social)](https://github.com/pietrozullo/mcp-use/stargazers)
@@ -63,13 +66,14 @@ Description-Content-Type: text/markdown
63
66
 
64
67
  | Feature | Description |
65
68
  |---------|-------------|
66
- | 🔄 **Ease of use** | Create your first MCP capable agent you need only 6 lines of code |
67
- | 🤖 **LLM Flexibility** | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
68
- | 🌐 **HTTP Support** | Direct connection to MCP servers running on specific HTTP ports |
69
- | ⚙️ **Dynamic Server Selection** | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
70
- | 🧩 **Multi-Server Support** | Use multiple MCP servers simultaneously in a single agent |
71
- | 🛡️ **Tool Restrictions** | Restrict potentially dangerous tools like file system or network access |
72
- | 🔧 **Custom Agents** | Build your own agents with any framework using the LangChain adapter or create new adapters |
69
+ | 🔄 [**Ease of use**](#quick-start) | Create your first MCP capable agent you need only 6 lines of code |
70
+ | 🤖 [**LLM Flexibility**](#installing-langchain-providers) | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
71
+ | 🌐 [**Code Builder**](https://mcp-use.io/builder) | Explore MCP capabilities and generate starter code with the interactive [code builder](https://mcp-use.io/builder). |
72
+ | 🔗 [**HTTP Support**](#http-connection-example) | Direct connection to MCP servers running on specific HTTP ports |
73
+ | ⚙️ [**Dynamic Server Selection**](#dynamic-server-selection-server-manager) | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
74
+ | 🧩 [**Multi-Server Support**](#multi-server-support) | Use multiple MCP servers simultaneously in a single agent |
75
+ | 🛡️ [**Tool Restrictions**](#tool-access-control) | Restrict potentially dangerous tools like file system or network access |
76
+ | 🔧 [**Custom Agents**](#build-a-custom-agent) | Build your own agents with any framework using the LangChain adapter or create new adapters |
73
77
 
74
78
 
75
79
  # Quick start
@@ -182,6 +186,43 @@ Example configuration file (`browser_mcp.json`):
182
186
 
183
187
  For other settings, models, and more, check out the documentation.
184
188
 
189
+ ## Streaming Agent Output
190
+
191
+ MCP-Use supports asynchronous streaming of agent output using the `astream` method on `MCPAgent`. This allows you to receive incremental results, tool actions, and intermediate steps as they are generated by the agent, enabling real-time feedback and progress reporting.
192
+
193
+ ### How to use
194
+
195
+ Call `agent.astream(query)` and iterate over the results asynchronously:
196
+
197
+ ```python
198
+ async for chunk in agent.astream("Find the best restaurant in San Francisco"):
199
+ print(chunk["messages"], end="", flush=True)
200
+ ```
201
+
202
+ Each chunk is a dictionary containing keys such as `actions`, `steps`, `messages`, and (on the last chunk) `output`. This enables you to build responsive UIs or log agent progress in real time.
203
+
204
+ #### Example: Streaming in Practice
205
+
206
+ ```python
207
+ import asyncio
208
+ import os
209
+ from dotenv import load_dotenv
210
+ from langchain_openai import ChatOpenAI
211
+ from mcp_use import MCPAgent, MCPClient
212
+
213
+ async def main():
214
+ load_dotenv()
215
+ client = MCPClient.from_config_file("browser_mcp.json")
216
+ llm = ChatOpenAI(model="gpt-4o")
217
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
218
+ async for chunk in agent.astream("Look for job at nvidia for machine learning engineer."):
219
+ print(chunk["messages"], end="", flush=True)
220
+
221
+ if __name__ == "__main__":
222
+ asyncio.run(main())
223
+ ```
224
+
225
+ This streaming interface is ideal for applications that require real-time updates, such as chatbots, dashboards, or interactive notebooks.
185
226
 
186
227
  # Example Use Cases
187
228
 
@@ -342,7 +383,7 @@ if __name__ == "__main__":
342
383
 
343
384
  ## HTTP Connection Example
344
385
 
345
- MCP-Use now supports HTTP connections, allowing you to connect to MCP servers running on specific HTTP ports. This feature is particularly useful for integrating with web-based MCP servers.
386
+ MCP-Use supports HTTP connections, allowing you to connect to MCP servers running on specific HTTP ports. This feature is particularly useful for integrating with web-based MCP servers.
346
387
 
347
388
  Here's an example of how to use the HTTP connection feature:
348
389
 
@@ -610,7 +651,7 @@ This is useful when you only need to see the agent's steps and decision-making p
610
651
 
611
652
  # Contributing
612
653
 
613
- We love contributions! Feel free to open issues for bugs or feature requests.
654
+ We love contributions! Feel free to open issues for bugs or feature requests. Look at [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
614
655
 
615
656
  # Requirements
616
657
 
@@ -9,6 +9,7 @@
9
9
  [![PyPI Version](https://img.shields.io/pypi/v/mcp_use.svg)](https://pypi.org/project/mcp_use/)
10
10
  [![Python Versions](https://img.shields.io/pypi/pyversions/mcp_use.svg)](https://pypi.org/project/mcp_use/)
11
11
  [![Documentation](https://img.shields.io/badge/docs-mcp--use.io-blue)](https://docs.mcp-use.io)
12
+ [![Website](https://img.shields.io/badge/website-mcp--use.io-blue)](https://mcp-use.io)
12
13
  [![License](https://img.shields.io/github/license/pietrozullo/mcp-use)](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
13
14
  [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
14
15
  [![GitHub stars](https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social)](https://github.com/pietrozullo/mcp-use/stargazers)
@@ -24,13 +25,14 @@
24
25
 
25
26
  | Feature | Description |
26
27
  |---------|-------------|
27
- | 🔄 **Ease of use** | Create your first MCP capable agent you need only 6 lines of code |
28
- | 🤖 **LLM Flexibility** | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
29
- | 🌐 **HTTP Support** | Direct connection to MCP servers running on specific HTTP ports |
30
- | ⚙️ **Dynamic Server Selection** | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
31
- | 🧩 **Multi-Server Support** | Use multiple MCP servers simultaneously in a single agent |
32
- | 🛡️ **Tool Restrictions** | Restrict potentially dangerous tools like file system or network access |
33
- | 🔧 **Custom Agents** | Build your own agents with any framework using the LangChain adapter or create new adapters |
28
+ | 🔄 [**Ease of use**](#quick-start) | Create your first MCP capable agent you need only 6 lines of code |
29
+ | 🤖 [**LLM Flexibility**](#installing-langchain-providers) | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
30
+ | 🌐 [**Code Builder**](https://mcp-use.io/builder) | Explore MCP capabilities and generate starter code with the interactive [code builder](https://mcp-use.io/builder). |
31
+ | 🔗 [**HTTP Support**](#http-connection-example) | Direct connection to MCP servers running on specific HTTP ports |
32
+ | ⚙️ [**Dynamic Server Selection**](#dynamic-server-selection-server-manager) | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
33
+ | 🧩 [**Multi-Server Support**](#multi-server-support) | Use multiple MCP servers simultaneously in a single agent |
34
+ | 🛡️ [**Tool Restrictions**](#tool-access-control) | Restrict potentially dangerous tools like file system or network access |
35
+ | 🔧 [**Custom Agents**](#build-a-custom-agent) | Build your own agents with any framework using the LangChain adapter or create new adapters |
34
36
 
35
37
 
36
38
  # Quick start
@@ -143,6 +145,43 @@ Example configuration file (`browser_mcp.json`):
143
145
 
144
146
  For other settings, models, and more, check out the documentation.
145
147
 
148
+ ## Streaming Agent Output
149
+
150
+ MCP-Use supports asynchronous streaming of agent output using the `astream` method on `MCPAgent`. This allows you to receive incremental results, tool actions, and intermediate steps as they are generated by the agent, enabling real-time feedback and progress reporting.
151
+
152
+ ### How to use
153
+
154
+ Call `agent.astream(query)` and iterate over the results asynchronously:
155
+
156
+ ```python
157
+ async for chunk in agent.astream("Find the best restaurant in San Francisco"):
158
+ print(chunk["messages"], end="", flush=True)
159
+ ```
160
+
161
+ Each chunk is a dictionary containing keys such as `actions`, `steps`, `messages`, and (on the last chunk) `output`. This enables you to build responsive UIs or log agent progress in real time.
162
+
163
+ #### Example: Streaming in Practice
164
+
165
+ ```python
166
+ import asyncio
167
+ import os
168
+ from dotenv import load_dotenv
169
+ from langchain_openai import ChatOpenAI
170
+ from mcp_use import MCPAgent, MCPClient
171
+
172
+ async def main():
173
+ load_dotenv()
174
+ client = MCPClient.from_config_file("browser_mcp.json")
175
+ llm = ChatOpenAI(model="gpt-4o")
176
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
177
+ async for chunk in agent.astream("Look for job at nvidia for machine learning engineer."):
178
+ print(chunk["messages"], end="", flush=True)
179
+
180
+ if __name__ == "__main__":
181
+ asyncio.run(main())
182
+ ```
183
+
184
+ This streaming interface is ideal for applications that require real-time updates, such as chatbots, dashboards, or interactive notebooks.
146
185
 
147
186
  # Example Use Cases
148
187
 
@@ -303,7 +342,7 @@ if __name__ == "__main__":
303
342
 
304
343
  ## HTTP Connection Example
305
344
 
306
- MCP-Use now supports HTTP connections, allowing you to connect to MCP servers running on specific HTTP ports. This feature is particularly useful for integrating with web-based MCP servers.
345
+ MCP-Use supports HTTP connections, allowing you to connect to MCP servers running on specific HTTP ports. This feature is particularly useful for integrating with web-based MCP servers.
307
346
 
308
347
  Here's an example of how to use the HTTP connection feature:
309
348
 
@@ -571,7 +610,7 @@ This is useful when you only need to see the agent's steps and decision-making p
571
610
 
572
611
  # Contributing
573
612
 
574
- We love contributions! Feel free to open issues for bugs or feature requests.
613
+ We love contributions! Feel free to open issues for bugs or feature requests. Look at [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
575
614
 
576
615
  # Requirements
577
616
 
@@ -0,0 +1,21 @@
1
+ ## astream
2
+
3
+ ```python
4
+ def astream(
5
+ query: str,
6
+ max_steps: int | None = None,
7
+ manage_connector: bool = True,
8
+ external_history: list[BaseMessage] | None = None,
9
+ ) -> AsyncIterator[dict]:
10
+ ```
11
+
12
+ Asynchronous streaming interface for agent output. Yields incremental results, tool actions, and intermediate steps as they are generated by the agent.
13
+
14
+ **Example:**
15
+
16
+ ```python
17
+ async for chunk in agent.astream("hello"):
18
+ print(chunk["messages"], end="|", flush=True)
19
+ ```
20
+
21
+ Each chunk is a dictionary containing keys such as `actions`, `steps`, `messages`, and (on the last chunk) `output`.
@@ -9,7 +9,7 @@ This guide will help you set up your development environment and contribute to m
9
9
 
10
10
  ## Prerequisites
11
11
 
12
- - Python 3.8 or higher
12
+ - Python 3.11 or higher
13
13
  - Git
14
14
  - Node.js and npm (for MCP server dependencies)
15
15
 
@@ -112,24 +112,3 @@ mcp-use/
112
112
  ├── static/ # Static assets
113
113
  └── pyproject.toml # Project configuration
114
114
  ```
115
-
116
- ## Adding New MCP Servers
117
-
118
- To add support for a new MCP server:
119
-
120
- 1. Create a new configuration template in the examples directory
121
- 2. Add necessary server-specific code in the `mcp_use` package
122
- 3. Update documentation with new server information
123
- 4. Add tests for the new server functionality
124
-
125
- ## Release Process
126
-
127
- 1. Update version in `pyproject.toml`
128
- 2. Update CHANGELOG.md
129
- 3. Create a new release tag
130
- 4. Build and publish to PyPI:
131
-
132
- ```bash
133
- python -m build
134
- python -m twine upload dist/*
135
- ```
@@ -27,6 +27,7 @@
27
27
  "essentials/llm-integration",
28
28
  "essentials/debugging",
29
29
  "essentials/connection-types",
30
+ "essentials/server-manager",
30
31
  "building-custom-agents"
31
32
  ]
32
33
  },