mcp-use 0.0.4__tar.gz → 0.0.5__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.
- mcp_use-0.0.5/.github/workflows/publish.yml +78 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/PKG-INFO +14 -10
- {mcp_use-0.0.4 → mcp_use-0.0.5}/README.md +12 -8
- {mcp_use-0.0.4 → mcp_use-0.0.5}/examples/airbnb_mcp.json +1 -1
- {mcp_use-0.0.4 → mcp_use-0.0.5}/examples/airbnb_use.py +2 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/examples/blender_use.py +3 -1
- {mcp_use-0.0.4 → mcp_use-0.0.5}/examples/browser_use.py +2 -0
- mcp_use-0.0.4/examples/chat_examle.py → mcp_use-0.0.5/examples/chat_example.py +2 -0
- mcp_use-0.0.5/examples/filesystem_use.py +58 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/__init__.py +4 -1
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/agents/mcpagent.py +3 -1
- {mcp_use-0.0.4 → mcp_use-0.0.5}/pyproject.toml +2 -2
- mcp_use-0.0.5/static/ghibli.png +0 -0
- mcp_use-0.0.4/.github/workflows/publish.yml +0 -31
- {mcp_use-0.0.4 → mcp_use-0.0.5}/.github/workflows/tests.yml +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/.gitignore +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/.pre-commit-config.yaml +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/LICENSE +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/examples/browser_mcp.json +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/agents/__init__.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/agents/base.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/agents/langchain_agent.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/agents/prompts/default.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/client.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/config.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/connectors/__init__.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/connectors/base.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/connectors/http.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/connectors/stdio.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/connectors/websocket.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/logging.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/session.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/task_managers/__init__.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/task_managers/base.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/task_managers/http.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/task_managers/stdio.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/mcp_use/task_managers/websocket.py +0 -0
- {mcp_use-0.0.4 → mcp_use-0.0.5}/tests/unit/test_placeholder.py +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: Check Version Bump and Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'pyproject.toml'
|
|
9
|
+
|
|
10
|
+
# Required for PyPI trusted publishing
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: write # Required for creating tags and releases
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check-version-and-publish:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0 # This fetches all history for comparing versions
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v4
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.11"
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install build twine wheel tomli
|
|
32
|
+
|
|
33
|
+
- name: Check for version bump
|
|
34
|
+
id: check-version
|
|
35
|
+
run: |
|
|
36
|
+
# Extract current version directly from pyproject.toml
|
|
37
|
+
# This is more reliable than using importlib.metadata
|
|
38
|
+
CURRENT_VERSION=$(python -c "
|
|
39
|
+
import tomli
|
|
40
|
+
with open('pyproject.toml', 'rb') as f:
|
|
41
|
+
data = tomli.load(f)
|
|
42
|
+
print(data['project']['version'])
|
|
43
|
+
")
|
|
44
|
+
|
|
45
|
+
echo "Current version: $CURRENT_VERSION"
|
|
46
|
+
|
|
47
|
+
# Check if this version already has a tag
|
|
48
|
+
if git rev-parse "v$CURRENT_VERSION" >/dev/null 2>&1; then
|
|
49
|
+
echo "Version $CURRENT_VERSION already has a tag. Skipping release."
|
|
50
|
+
echo "is_new_version=false" >> $GITHUB_OUTPUT
|
|
51
|
+
else
|
|
52
|
+
echo "New version detected: $CURRENT_VERSION"
|
|
53
|
+
echo "is_new_version=true" >> $GITHUB_OUTPUT
|
|
54
|
+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
- name: Build package
|
|
58
|
+
if: steps.check-version.outputs.is_new_version == 'true'
|
|
59
|
+
run: |
|
|
60
|
+
python -m build
|
|
61
|
+
|
|
62
|
+
- name: Create Release
|
|
63
|
+
if: steps.check-version.outputs.is_new_version == 'true'
|
|
64
|
+
id: create_release
|
|
65
|
+
uses: actions/create-release@v1
|
|
66
|
+
env:
|
|
67
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
68
|
+
with:
|
|
69
|
+
tag_name: v${{ steps.check-version.outputs.new_version }}
|
|
70
|
+
release_name: Release v${{ steps.check-version.outputs.new_version }}
|
|
71
|
+
draft: false
|
|
72
|
+
prerelease: false
|
|
73
|
+
|
|
74
|
+
- name: Publish to PyPI
|
|
75
|
+
if: steps.check-version.outputs.is_new_version == 'true'
|
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
77
|
+
with:
|
|
78
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.0.
|
|
2
|
+
Name: mcp-use
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: MCP Library for LLMs
|
|
5
5
|
Author-email: Pietro Zullo <pietro.zullo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -38,16 +38,20 @@ Requires-Dist: openai>=1.10.0; extra == 'openai'
|
|
|
38
38
|
Description-Content-Type: text/markdown
|
|
39
39
|
|
|
40
40
|
<picture>
|
|
41
|
-
<
|
|
42
|
-
<source media="(prefers-color-scheme: light)" srcset="./static/mcp-use.png">
|
|
43
|
-
<img alt="Shows a black MCP-Use Logo in light color mode and a white one in dark color mode." src="./static/mcp-use.png" width="full">
|
|
41
|
+
<img alt="" src="./static/ghibli.png" width="full">
|
|
44
42
|
</picture>
|
|
45
43
|
|
|
46
|
-
<h1 align="center">
|
|
44
|
+
<h1 align="center">Open Source MCP CLient Library </h1>
|
|
47
45
|
|
|
46
|
+
[](https://pypi.org/project/mcp_use/)
|
|
47
|
+
[](https://pypi.org/project/mcp_use/)
|
|
48
|
+
[](https://pypi.org/project/mcp_use/)
|
|
49
|
+
[](https://pypi.org/project/mcp_use/)
|
|
50
|
+
[](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
|
|
51
|
+
[](https://github.com/astral-sh/ruff)
|
|
48
52
|
[](https://github.com/pietrozullo/mcp-use/stargazers)
|
|
49
53
|
|
|
50
|
-
🌐 MCP-Use is the
|
|
54
|
+
🌐 MCP-Use is the open source way to connect any LLM to MCP tools and build custom agents that have tool access, without using closed source or application clients.
|
|
51
55
|
|
|
52
56
|
💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
|
|
53
57
|
|
|
@@ -56,14 +60,14 @@ Description-Content-Type: text/markdown
|
|
|
56
60
|
With pip:
|
|
57
61
|
|
|
58
62
|
```bash
|
|
59
|
-
pip install
|
|
63
|
+
pip install mcp-use
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
Or install from source:
|
|
63
67
|
|
|
64
68
|
```bash
|
|
65
|
-
git clone https://github.com/pietrozullo/
|
|
66
|
-
cd
|
|
69
|
+
git clone https://github.com/pietrozullo/mcp-use.git
|
|
70
|
+
cd mcp-use
|
|
67
71
|
pip install -e .
|
|
68
72
|
```
|
|
69
73
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<picture>
|
|
2
|
-
<
|
|
3
|
-
<source media="(prefers-color-scheme: light)" srcset="./static/mcp-use.png">
|
|
4
|
-
<img alt="Shows a black MCP-Use Logo in light color mode and a white one in dark color mode." src="./static/mcp-use.png" width="full">
|
|
2
|
+
<img alt="" src="./static/ghibli.png" width="full">
|
|
5
3
|
</picture>
|
|
6
4
|
|
|
7
|
-
<h1 align="center">
|
|
5
|
+
<h1 align="center">Open Source MCP CLient Library </h1>
|
|
8
6
|
|
|
7
|
+
[](https://pypi.org/project/mcp_use/)
|
|
8
|
+
[](https://pypi.org/project/mcp_use/)
|
|
9
|
+
[](https://pypi.org/project/mcp_use/)
|
|
10
|
+
[](https://pypi.org/project/mcp_use/)
|
|
11
|
+
[](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
|
|
12
|
+
[](https://github.com/astral-sh/ruff)
|
|
9
13
|
[](https://github.com/pietrozullo/mcp-use/stargazers)
|
|
10
14
|
|
|
11
|
-
🌐 MCP-Use is the
|
|
15
|
+
🌐 MCP-Use is the open source way to connect any LLM to MCP tools and build custom agents that have tool access, without using closed source or application clients.
|
|
12
16
|
|
|
13
17
|
💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
|
|
14
18
|
|
|
@@ -17,14 +21,14 @@
|
|
|
17
21
|
With pip:
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
|
-
pip install
|
|
24
|
+
pip install mcp-use
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
Or install from source:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
git clone https://github.com/pietrozullo/
|
|
27
|
-
cd
|
|
30
|
+
git clone https://github.com/pietrozullo/mcp-use.git
|
|
31
|
+
cd mcp-use
|
|
28
32
|
pip install -e .
|
|
29
33
|
```
|
|
30
34
|
|
|
@@ -3,6 +3,8 @@ Example demonstrating how to use mcp_use with Airbnb.
|
|
|
3
3
|
|
|
4
4
|
This example shows how to connect an LLM to Airbnb through MCP tools
|
|
5
5
|
to perform tasks like searching for accommodations.
|
|
6
|
+
|
|
7
|
+
Special Thanks to https://github.com/openbnb-org/mcp-server-airbnb for the server.
|
|
6
8
|
"""
|
|
7
9
|
|
|
8
10
|
import asyncio
|
|
@@ -4,10 +4,12 @@ Blender MCP example for mcp_use.
|
|
|
4
4
|
This example demonstrates how to use the mcp_use library with MCPClient
|
|
5
5
|
to connect an LLM to Blender through MCP tools via WebSocket.
|
|
6
6
|
The example assumes you have installed the Blender MCP addon from:
|
|
7
|
-
https://github.com/
|
|
7
|
+
https://github.com/ahujasid/blender-mcp
|
|
8
8
|
|
|
9
9
|
Make sure the addon is enabled in Blender preferences and the WebSocket
|
|
10
10
|
server is running before executing this script.
|
|
11
|
+
|
|
12
|
+
Special thanks to https://github.com/ahujasid/blender-mcp for the server.
|
|
11
13
|
"""
|
|
12
14
|
|
|
13
15
|
import asyncio
|
|
@@ -3,6 +3,8 @@ Basic usage example for mcp_use.
|
|
|
3
3
|
|
|
4
4
|
This example demonstrates how to use the mcp_use library with MCPClient
|
|
5
5
|
to connect any LLM to MCP tools through a unified interface.
|
|
6
|
+
|
|
7
|
+
Special thanks to https://github.com/microsoft/playwright-mcp for the server.
|
|
6
8
|
"""
|
|
7
9
|
|
|
8
10
|
import asyncio
|
|
@@ -3,6 +3,8 @@ Simple chat example using MCPAgent with built-in conversation memory.
|
|
|
3
3
|
|
|
4
4
|
This example demonstrates how to use the MCPAgent with its built-in
|
|
5
5
|
conversation history capabilities for better contextual interactions.
|
|
6
|
+
|
|
7
|
+
Special thanks to https://github.com/microsoft/playwright-mcp for the server.
|
|
6
8
|
"""
|
|
7
9
|
|
|
8
10
|
import asyncio
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Basic usage example for mcp_use.
|
|
3
|
+
|
|
4
|
+
This example demonstrates how to use the mcp_use library with MCPClient
|
|
5
|
+
to connect any LLM to MCP tools through a unified interface.
|
|
6
|
+
|
|
7
|
+
Special Thanks to https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem
|
|
8
|
+
for the server.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import asyncio
|
|
12
|
+
|
|
13
|
+
from dotenv import load_dotenv
|
|
14
|
+
from langchain_openai import ChatOpenAI
|
|
15
|
+
|
|
16
|
+
from mcp_use import MCPAgent, MCPClient
|
|
17
|
+
|
|
18
|
+
config = {
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"filesystem": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": [
|
|
23
|
+
"-y",
|
|
24
|
+
"@modelcontextprotocol/server-filesystem",
|
|
25
|
+
"/home/pietro/projects/mcp-use/",
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def main():
|
|
33
|
+
"""Run the example using a configuration file."""
|
|
34
|
+
# Load environment variables
|
|
35
|
+
load_dotenv()
|
|
36
|
+
|
|
37
|
+
# Create MCPClient from config file
|
|
38
|
+
client = MCPClient.from_dict(config)
|
|
39
|
+
# Create LLM
|
|
40
|
+
llm = ChatOpenAI(model="gpt-4o")
|
|
41
|
+
# llm = init_chat_model(model="llama-3.1-8b-instant", model_provider="groq")
|
|
42
|
+
# llm = ChatAnthropic(model="claude-3-")
|
|
43
|
+
# llm = ChatGroq(model="llama3-8b-8192")
|
|
44
|
+
|
|
45
|
+
# Create agent with the client
|
|
46
|
+
agent = MCPAgent(llm=llm, client=client, max_steps=30)
|
|
47
|
+
|
|
48
|
+
# Run the query
|
|
49
|
+
result = await agent.run(
|
|
50
|
+
"Hello can you give me a list of files and directories in the current directory",
|
|
51
|
+
max_steps=30,
|
|
52
|
+
)
|
|
53
|
+
print(f"\nResult: {result}")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
# Run the appropriate example
|
|
58
|
+
asyncio.run(main())
|
|
@@ -5,6 +5,8 @@ This library provides a unified interface for connecting different LLMs
|
|
|
5
5
|
to MCP tools through existing LangChain adapters.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
from importlib.metadata import version
|
|
9
|
+
|
|
8
10
|
from .agents.mcpagent import MCPAgent
|
|
9
11
|
from .client import MCPClient
|
|
10
12
|
from .config import create_session_from_config, load_config_file
|
|
@@ -12,7 +14,8 @@ from .connectors import BaseConnector, HttpConnector, StdioConnector, WebSocketC
|
|
|
12
14
|
from .logging import logger
|
|
13
15
|
from .session import MCPSession
|
|
14
16
|
|
|
15
|
-
__version__ = "
|
|
17
|
+
__version__ = version("mcp-use")
|
|
18
|
+
|
|
16
19
|
__all__ = [
|
|
17
20
|
"MCPAgent",
|
|
18
21
|
"MCPClient",
|
|
@@ -124,7 +124,9 @@ class MCPAgent:
|
|
|
124
124
|
# Generate tool descriptions
|
|
125
125
|
tool_descriptions = []
|
|
126
126
|
for tool in tools:
|
|
127
|
-
|
|
127
|
+
# Escape curly braces in the description by doubling them
|
|
128
|
+
# (sometimes e.g. blender mcp they are used in the description)
|
|
129
|
+
description = f"- {tool.name}: {tool.description.replace('{', '{{').replace('}', '}}')}"
|
|
128
130
|
tool_descriptions.append(description)
|
|
129
131
|
|
|
130
132
|
# Format the system prompt template with tool descriptions
|
|
Binary file
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: Publish to PyPI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [created]
|
|
6
|
-
|
|
7
|
-
# Required for PyPI trusted publishing
|
|
8
|
-
permissions:
|
|
9
|
-
id-token: write
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
deploy:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v3
|
|
17
|
-
- name: Set up Python
|
|
18
|
-
uses: actions/setup-python@v4
|
|
19
|
-
with:
|
|
20
|
-
python-version: "3.11"
|
|
21
|
-
- name: Install dependencies
|
|
22
|
-
run: |
|
|
23
|
-
python -m pip install --upgrade pip
|
|
24
|
-
pip install build twine wheel
|
|
25
|
-
- name: Build package
|
|
26
|
-
run: |
|
|
27
|
-
python -m build
|
|
28
|
-
- name: Publish to PyPI
|
|
29
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
30
|
-
with:
|
|
31
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|