From 7ba5befe59ea3893de7c690673445e36438855d5 Mon Sep 17 00:00:00 2001 From: educoder Date: Wed, 29 Apr 2026 19:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SKILL.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SKILL.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SKILL.md b/SKILL.md index fbae190..9bfc901 100644 --- a/SKILL.md +++ b/SKILL.md @@ -5,6 +5,7 @@ description: 提供 Educoder 用户与课堂相关查询能力,当前支持用 ## MCP 服务地址 +- 线上地址:`http://47.98.32.66:48000/mcp` - 本地开发:`http://localhost:8001/mcp` > 使用 `streamable-http` 模式连接,不使用 SSE。 @@ -12,8 +13,9 @@ description: 提供 Educoder 用户与课堂相关查询能力,当前支持用 ## 接入方式 - 客户端应使用 `streamable-http` MCP 客户端 +- 使用 OpenClaw 安装本 skill 时,MCP 服务地址直接填写线上地址:`http://47.98.32.66:48000/mcp` - 不要使用 `sse_client` -- 服务端口默认是 `8001` +- 本地开发端口默认是 `8001`,线上端口使用 `48000` - MCP 路径默认是 `/mcp` ## 前置配置 @@ -84,15 +86,17 @@ async with streamable_http_client(self.server_url, headers=headers or None) as ( 如果使用 OpenClaw,推荐按下面的方式接入: -1. 用户在界面上输入自己的 `Authorization` -2. OpenClaw 后端把该值保存到当前用户自己的会话上下文 -3. 当前用户发起工具调用时,后端读取这个用户自己的 `Authorization` -4. 用这个值创建当前用户专属的 MCPClient -5. MCPClient 建连时把 `Authorization` 放进 MCP headers +1. 安装 skill 时,MCP 服务地址填写:`http://47.98.32.66:48000/mcp` +2. 用户在界面上输入自己的 `Authorization` +3. OpenClaw 后端把该值保存到当前用户自己的会话上下文 +4. 当前用户发起工具调用时,后端读取这个用户自己的 `Authorization` +5. 用这个值创建当前用户专属的 MCPClient +6. MCPClient 建连时把 `Authorization` 放进 MCP headers 参考流程: ```python +tool_server_url = "http://47.98.32.66:48000/mcp" current_user_authorization = session_store.get(current_user_id, "educoder_authorization") client = MCPClient( @@ -288,7 +292,7 @@ from mcp.client.streamable_http import streamable_http_client async def main(): async with httpx.AsyncClient(headers={"Authorization": "demo-token"}) as http_client: - async with streamable_http_client("http://127.0.0.1:8001/mcp", http_client=http_client) as (read, write, _): + async with streamable_http_client("http://47.98.32.66:48000/mcp", http_client=http_client) as (read, write, _): async with ClientSession(read, write) as session: await session.initialize()