MCP (Model Context Protocol) 橋接模組,支援 WebSocket 與 HTTP/SSE 傳輸
Project description
da2-xiaozhi-tunnel
MCP (Model Context Protocol) 橋接模組,用於連接小智雲端與其他 MCP 伺服器。
功能特色
- WebSocketTunnelMCP: WebSocket 隧道伺服器,對接小智雲端
- MCPHttpClient: HTTP/SSE 客戶端,連接遠端 MCP 伺服器
- 支援多伺服器工具聚合與智慧路由
- 自動重連機制
安裝
pip install da2-xiaozhi-tunnel
快速開始
from da2_xiaozhi_tunnel import WebSocketTunnelMCP, MCPHttpClient
# 建立主伺服器
mcp = WebSocketTunnelMCP(server_name="MyServer")
# 註冊本地工具
@mcp.tool("hello", "打招呼", {"type": "object", "properties": {}})
async def hello():
return "Hello, World!"
# 掛載遠端 MCP Server
hub = MCPHttpClient("http://remote-mcp/mcp", "hub", use_sse=False)
mcp.mount_client(hub)
# 連線
await mcp.connect("wss://api.xiaozhi.me/mcp/?token=YOUR_TOKEN")
await mcp.listen_loop()
文件
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
da2_xiaozhi_tunnel-0.1.0.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file da2_xiaozhi_tunnel-0.1.0.tar.gz.
File metadata
- Download URL: da2_xiaozhi_tunnel-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fca6ffff9f62a14ae9576057b53cc55a5d3db9bb5996ec5ac152bdea8a534a1b
|
|
| MD5 |
ce6689b32bb60586c39e09fdfb7ae42e
|
|
| BLAKE2b-256 |
bdb7df7859ef84a3409bc407d692b6f7357b3776137e5a4528f268eb7d707c78
|
File details
Details for the file da2_xiaozhi_tunnel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: da2_xiaozhi_tunnel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec702c501bace33315e563e3056a56e153e321b2897cede6442fbb90edf99c9
|
|
| MD5 |
744c818f9a0ce7d94297fae9c80fc4e7
|
|
| BLAKE2b-256 |
9cea55491f03e98ae62cb201de8b91abb771b58cecc4309988e084ff740acec1
|