Skip to main content

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。 任选一种采纳。

  1. 把工具放在 ${project_dir}/teamwork_mcp/${contributor}_tools 下。
  2. 请写单元测试,命名为 工具名 + _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.py
    
    提交前请对测试文件进行调试,请确保 xxxx_test.py 测试文件能够一键运行,环境变量建议内嵌到_test.py测试代码中。
  3. 修改 ${project_dir}/teamwork_mcp/manifest_tool.pyraw_mcp_tool_manifest_collection 数组。
  4. 运行launch_server_all_tool_test.pylaunch_client_test.py测试。

Todo

  • [] 实现同时接入多个server的高层client

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teamwork_mcp-0.3.3.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teamwork_mcp-0.3.3-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file teamwork_mcp-0.3.3.tar.gz.

File metadata

  • Download URL: teamwork_mcp-0.3.3.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for teamwork_mcp-0.3.3.tar.gz
Algorithm Hash digest
SHA256 340ccc26442f270c8ce3e48da5ebd58224e8cf3be60fa04b2f61075d3bdad8f0
MD5 76914be5b0b92cec7146fb619f5de1a5
BLAKE2b-256 3fec1e15f21c7e5fb3ae40f27f8eaee52314d3618851a196e4099c584b8da0ff

See more details on using hashes here.

File details

Details for the file teamwork_mcp-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: teamwork_mcp-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for teamwork_mcp-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9c55235197b2f68fa35e1bc3d2b56cdf08be7071d52571b6adb34cdb7868be70
MD5 5199a4e588f4f49920606128d56da8c0
BLAKE2b-256 417ec19033e45ace12cf17c5e42b8864c059eea0cc29decacc0405a1d4b89c0b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 files

0.3.2

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page