Teamwork Model Context Protocol
不能远程调用的MCP 和 不能支撑团队协作的MCP,都是不完整的。
本项目封装极简MCP的SSE远程调用接口,并集成多个团队的工具集合以供参考。Features:
- 本项目用于快速迭代内部工具和训练内部算法模型。
- 适合快速技术验证。
- 项目中所有工具单元都添加了测试,可一键运行。
- 作为MCP工具推理模型训练基础库开发。
I. 安装
- 使用uv或者直接使用pip都可以
uv venv uv pip install -e .
II. 如何测试
1【本地】简单测试一个回声 server-client
- 服务端
# server from teamwork_mcp import FastMCP, launch_mcp_server_forever fastmcp = FastMCP("echo") @fastmcp.tool() async def echo(state: str) -> str: return state launch_mcp_server_forever(fastmcp=fastmcp, host="0.0.0.0", port=8080)
- 客户端
# client from teamwork_mcp import SyncedMcpClient client = SyncedMcpClient(server_url="http://0.0.0.0:8080/sse") result = client.list_tools(); print(result) result = client.call_tool("echo", {"state": "ABC"}); print(result)
2【本地】为当前库中所有工具建立mcp server
- 服务端
# server from teamwork_mcp import launch_manifest_mcp_server_forever launch_manifest_mcp_server_forever()
3【多机 IP + 端口】远程一个阿里云上的 mcp server
-
云服务端
# server: 47.243.19.78 记得设置安全组 from teamwork_mcp import launch_manifest_mcp_server_forever launch_manifest_mcp_server_forever(port=33333)
-
客户端
# 客户端 from teamwork_mcp import SyncedMcpClient client = SyncedMcpClient(server_url="http://xxxxxx:33333/sse") result = client.list_tools(); print(result) result = client.call_tool("echo", {"state": "ABC"}); print(result)
III. 如何添加工具
目前有两种工具封装格式: 一种是pydantic封装,再由qingxu的接口自动转化为mcp的工具,例如
teamwork_mcp/rfft_tools/firecraw_search.py(推荐)。 另外一种是原生的mcp封装,见teamwork_mcp/dummy_tools/echo.py。 任选一种采纳。
- 把工具放在
${project_dir}/teamwork_mcp/${contributor}_tools下。 - 请写单元测试,命名为 工具名 + _test.py,例如:
提交前请对测试文件进行调试,请确保teamwork_mcp/rfft_tools/code_execution_test.py teamwork_mcp/rfft_tools/code_execution.py teamwork_mcp/rfft_tools/firecraw_search_test.py teamwork_mcp/rfft_tools/firecraw_search.py teamwork_mcp/rfft_tools/search_api_qwen_test.py teamwork_mcp/rfft_tools/search_api_qwen.py teamwork_mcp/rfft_tools/web_scrape_test.py teamwork_mcp/rfft_tools/web_scrape.pyxxxx_test.py测试文件能够一键运行,环境变量建议内嵌到_test.py测试代码中。 - 修改
${project_dir}/teamwork_mcp/manifest_tool.py的raw_mcp_tool_manifest_collection数组。 - 运行
launch_server_all_tool_test.py和launch_client_test.py测试。
Todo
- [] 实现同时接入多个server的高层client
Metadata
Release files for teamwork-mcp 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| teamwork_mcp-0.3.3.tar.gz | 32.7 kB | Without provenance | Details for teamwork_mcp-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| teamwork_mcp-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for teamwork_mcp-0.3.3-py3-none-any.whl |
Total release size: 77.4 kB
Release files / teamwork_mcp-0.3.3.tar.gz
| Download URL | teamwork_mcp-0.3.3.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
340ccc26442f270c8ce3e48da5ebd58224e8cf3be60fa04b2f61075d3bdad8f0
|
|
BLAKE2b-256 checksum How to use checksums |
3fec1e15f21c7e5fb3ae40f27f8eaee52314d3618851a196e4099c584b8da0ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / teamwork_mcp-0.3.3-py3-none-any.whl
| Download URL | teamwork_mcp-0.3.3-py3-none-any.whl |
|---|---|
| Size | 44.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c55235197b2f68fa35e1bc3d2b56cdf08be7071d52571b6adb34cdb7868be70
|
|
BLAKE2b-256 checksum How to use checksums |
417ec19033e45ace12cf17c5e42b8864c059eea0cc29decacc0405a1d4b89c0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for teamwork-mcp 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.