Smithery注册表OpenAPI服务器
该服务器为Smithery Registry API提供了一个OpenAPI接口,允许您搜索和获取模型上下文协议(MCP)服务器的启动配置。
特性
- 列出具有高级筛选功能的可用MCP服务器
- 获取详细的服务器信息,包括连接配置
- 使用base64编码配置生成WebSocket URL
- 通过承载令牌进行身份验证
- 与OpenAPI工具和客户端兼容
认证
对Smithery Registry API的所有请求都需要身份验证:
- 您需要在
Authorization头球 - 格式:
Authorization: Bearer your-api-token - 从您的Smithery用户配置文件中获取API密钥下的令牌
用法
安装
pip install -r requirements.txt运行服务器
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadAPI终点
GET /servers-列出可用的MCP服务器
- 查询参数: - q:搜索查询(语义搜索) - page:页码(默认值:1) - pageSize:每页项目数(默认值:10) - 高级过滤语法 q 参数: - 文本搜索:“机器学习” - 所有者筛选器:所有者:用户名 - 存储库筛选器:repo:存储库名称 - 部署状态:已部署 - 示例:“所有者:smithery ai repo:fetch是:部署的机器学习”
GET /servers/{qualified_name}-获取特定服务器的详细信息
POST /create-websocket-url-使用编码的配置创建WebSocket URL
- 请求正文:
{
"qualifiedName": "username/repository",
"config": {
// Configuration object matching the server's schema
}
}WebSocket连接
对于与MCP服务器的直接WebSocket连接:
- URL格式:
https://server.smithery.ai/${qualifiedName}/ws?config=${base64encode(config)} - 配置必须符合服务器的configSchema
- 配置是base64编码的JSON
与OpenAPI工具集成
该服务器旨在与任何符合OpenAPI的工具和框架兼容。API遵循RESTful约定,并在 /docs 运行时的端点。
TypeScript SDK使用
与Smithery TypeScript SDK一起使用:
import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js"
import { createSmitheryUrl } from "@smithery/sdk/config.js"
const url = createSmitheryUrl(
"https://your-smithery-mcp-server/ws",
{
// config object matching schema
},
)
const transport = new WebSocketClientTransport(url)许可证
麻省理工学院
