更新 'SKILL.md'

main
educoder 2 weeks ago
parent e2fd4d4c78
commit 7ba5befe59

@ -5,6 +5,7 @@ description: 提供 Educoder 用户与课堂相关查询能力,当前支持用
## MCP 服务地址 ## MCP 服务地址
- 线上地址:`http://47.98.32.66:48000/mcp`
- 本地开发:`http://localhost:8001/mcp` - 本地开发:`http://localhost:8001/mcp`
> 使用 `streamable-http` 模式连接,不使用 SSE。 > 使用 `streamable-http` 模式连接,不使用 SSE。
@ -12,8 +13,9 @@ description: 提供 Educoder 用户与课堂相关查询能力,当前支持用
## 接入方式 ## 接入方式
- 客户端应使用 `streamable-http` MCP 客户端 - 客户端应使用 `streamable-http` MCP 客户端
- 使用 OpenClaw 安装本 skill 时MCP 服务地址直接填写线上地址:`http://47.98.32.66:48000/mcp`
- 不要使用 `sse_client` - 不要使用 `sse_client`
- 服务端口默认是 `8001` - 本地开发端口默认是 `8001`,线上端口使用 `48000`
- MCP 路径默认是 `/mcp` - MCP 路径默认是 `/mcp`
## 前置配置 ## 前置配置
@ -84,15 +86,17 @@ async with streamable_http_client(self.server_url, headers=headers or None) as (
如果使用 OpenClaw推荐按下面的方式接入 如果使用 OpenClaw推荐按下面的方式接入
1. 用户在界面上输入自己的 `Authorization` 1. 安装 skill 时MCP 服务地址填写:`http://47.98.32.66:48000/mcp`
2. OpenClaw 后端把该值保存到当前用户自己的会话上下文 2. 用户在界面上输入自己的 `Authorization`
3. 当前用户发起工具调用时,后端读取这个用户自己的 `Authorization` 3. OpenClaw 后端把该值保存到当前用户自己的会话上下文
4. 用这个值创建当前用户专属的 MCPClient 4. 当前用户发起工具调用时,后端读取这个用户自己的 `Authorization`
5. MCPClient 建连时把 `Authorization` 放进 MCP headers 5. 用这个值创建当前用户专属的 MCPClient
6. MCPClient 建连时把 `Authorization` 放进 MCP headers
参考流程: 参考流程:
```python ```python
tool_server_url = "http://47.98.32.66:48000/mcp"
current_user_authorization = session_store.get(current_user_id, "educoder_authorization") current_user_authorization = session_store.get(current_user_id, "educoder_authorization")
client = MCPClient( client = MCPClient(
@ -288,7 +292,7 @@ from mcp.client.streamable_http import streamable_http_client
async def main(): async def main():
async with httpx.AsyncClient(headers={"Authorization": "demo-token"}) as http_client: 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: async with ClientSession(read, write) as session:
await session.initialize() await session.initialize()

Loading…
Cancel
Save