多客户端通信测试工具

一个用于测试LiteLLM MCP实现的多客户端通信工具,支持Go和Python客户端与服务器的交互。

  • by wagnerjt
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 wagnerjt/go-mcp

使用说明

入门指南

该项目测试了初始 LiteLLM MCP 与其他一些MCP服务器和客户端一起实现。特别是基于go的mcp服务器和客户端 mark3labs

需求

您需要安装以下内容

  • 转到1.24.1
  • 紫外线

设置deps

uv venv --python 3.13
source .venv/bin/activate # windows -- source .venv/Scripts/active
uv pip install -r requirements.txt

# cd into each and install dependencies
cd client;go mod download; cd ..
cd server; go mod download; cd ..

设置litellm代理

或者通过docker

docker compose up

正在运行MCP Go服务器

cd server
go mod download
go run main.go -t sse -p 8080 # transport over http network with port 8080

正在运行MCP Go客户端

# run go mcp server first on sse transport
cd client
go run main.go -t sse -mcpUri 'http://localhost:8080/sse' # connect to mcp server on uri
go run main.go -t http -mcpUri 'http://localhost:3000/mcp' # connect to http mcp server on uri

测试Litellm sdk MCP客户端

# run go mcp server first on sse transport

# run client
cd bridge
python litellm_client.py

在LiteLLM代理MCP上测试python sdk

# run go litellm proxy
docker compose up

# run client
cd bridge
python mcp_client.py
# Initializing session...
# Session initialized
# Loading tools...
# Loaded 1 tools
# meta=None content=[TextContent(type='text', text='13:04', annotations=None)] isError=Fals

在LiteLLM代理MCP上测试Go客户端

# run go litellm proxy
docker compose up

cd bridge
go run main.go -mcpUri http://localhost:4000/mcp
# 2025/03/29 06:02:11 Connected to server with name litellm-mcp-server
# 2025/03/29 06:02:11 Ping successful
# 2025/03/29 06:02:11 Found 1 tools
# 2025/03/29 06:02:11 Tool: get_current_time

# 2025/03/29 06:02:11 Calling get_current_time tool

# 2025/03/29 06:02:11 Result: 13:02