使用说明
合成mcp
模型上下文协议(MCP)服务器 合成mcp API
[!重要] 此MCP服务器尚未准备好用于生产。要完成设置,请按照您的 工作区。在发布到包管理器之前删除此通知。
摘要
Synth:Synth API提供了对股票、大宗商品和加密货币的概率价格预测的编程访问。
目录
安装
[!提示] 要完成将MCP服务器发布到npm和其他服务器,您必须 运行你的第一代动作.
Claude Desktop
使用预构建的作为桌面扩展安装MCP服务器 mcp-server.mcpb 文件:
只需拖放 mcp-server.mcpb 将文件安装到Claude Desktop上以安装扩展。
MCP捆绑包包括MCP服务器和所有必要的配置。安装后,服务器将无需额外设置即可使用。
[!注意] MCP捆绑包提供了一种简化的方式来打包和分发MCP服务器。了解更多 桌面扩展.
Cursor
或手动:
- 打开光标设置
- 选择工具和集成
- 选择新MCP服务器
- 如果配置文件为空,请将以下JSON粘贴到MCP服务器配置中:
{
"command": "npx",
"args": [
"synth-mcp",
"start",
"--server-url",
""
]
}
Claude Code CLI
claude mcp add Synth -- npx -y synth-mcp start --server-url
Gemini
gemini mcp add Synth -- npx -y synth-mcp start --server-url
Windsurf
参见 官方Windsurf文档 获取最新信息
- 打开风帆设置
- 在左侧菜单中选择Cascade
- 点击
Manage MCPs(要管理MCP,您应该使用Windsurf帐户登录) - 点击
View raw config打开mcp配置文件。 - 如果配置文件为空,请粘贴完整的json
{
"command": "npx",
"args": [
"synth-mcp",
"start",
"--server-url",
""
]
}
VS Code
或手动:
参见 官方VS Code文档 获取最新信息
- 打开 命令面板
- 搜索并打开
MCP: Open User Configuration。这应该会打开mcp.json文件 - 如果配置文件为空,请粘贴完整的json
{
"command": "npx",
"args": [
"synth-mcp",
"start",
"--server-url",
""
]
}
Stdio installation via npm
To start the MCP server, run:npx synth-mcp start --server-url
有关服务器参数的完整列表,请运行:
npx synth-mcp --help
渐进式发现
具有许多工具的MCP服务器可能会使LLM上下文窗口膨胀,导致令牌使用增加和工具混乱。动态模式通过只公开一小部分元工具来解决这个问题,这些元工具让代理根据需要逐步发现和调用工具。
要启用动态模式,请传递 --mode dynamic 启动服务器时标记:
{
"mcpServers": {
"Synth": {
"command": "npx",
"args": ["synth-mcp", "start", "--mode", "dynamic"],
// ... other server arguments
}
}
}
在动态模式下,服务器只注册以下元工具,而不是每个单独的工具:
list_tools:列出所有可用工具及其名称和描述。describe_tool:按名称返回一个或多个工具的输入架构。execute_tool:使用提供的输入参数按名称执行工具。
这种方法显著减少了每次请求时发送到LLM的令牌数量,这对于具有大量工具的服务器特别有用。
发展
在本地运行,不使用已发布的npm包:
- 克隆此存储库
- 跑
npm install - 跑
npm run build - 跑
node ./bin/mcp-server.js start --server-url要将此本地版本与Cursor、Claude或其他MCP客户端一起使用,您需要添加以下配置:
{
"command": "node",
"args": [
"./bin/mcp-server.js",
"start",
"--server-url",
""
]
}
或者,要在本地调试MCP服务器,请使用官方的MCP检查器:
npx @modelcontextprotocol/inspector node ./bin/mcp-server.js start --server-url
发布到Anthropic MCP注册表
将您的MCP服务器发布到 人类MCP注册表,根据以下步骤进行操作 官方出版指南.
步骤1:在生成配置中配置mcpName
添加 mcpName 字段到您的 .speakeasy/gen.yaml 文件:
mcp-typescript:
mcpName: io.github.username/server-name # Use reverse-DNS format
# ... other configuration
这 mcpName 应遵循反向DNS格式(例如。, io.github.username/server-name)以确保注册表中的唯一性。
步骤2:重新生成MCP服务器
使用更新的配置运行Speakeasy生成。这将:
- 添加
mcpName字段到您的package.json(npm包验证所需) - 生成一个
server.json包含注册表元数据的文件
步骤3:发布到npm
注册表通过检查您发布的包是否包含以下内容来验证npm包 mcpName 字段:
npm publish
注册表将从npm获取您的包,并验证 mcpName 在 package.json 匹配您的服务器名称。
步骤4:安装Publisher CLI
安装 mcp-publisher CLI工具:
macOS/Linux(自制):
brew install mcp-publisher
macOS/Linux/WSL(curl):
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher && sudo mv mcp-publisher /usr/local/bin/
Windows PowerShell:
$arch = if ([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture -eq "Arm64") { "arm64" } else { "amd64" }
Invoke-WebRequest -Uri "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_windows_$arch.tar.gz" -OutFile "mcp-publisher.tar.gz"
tar xf mcp-publisher.tar.gz mcp-publisher.exe
rm mcp-publisher.tar.gz
# Move mcp-publisher.exe to a directory in your PATH
步骤5:身份验证
根据您的命名空间进行身份验证:
对于 io.github.* 命名空间(GitHub OAuth):
mcp-publisher login github
对于自定义域,如 com.yourcompany.* (DNS身份验证):
# Generate keypair
openssl genpkey -algorithm Ed25519 -out key.pem
# Get public key for DNS record
echo "yourcompany.com. IN TXT \"v=MCPv1; k=ed25519; p=$(openssl pkey -in key.pem -pubout -outform DER | tail -c 32 | base64)\""
# Add the TXT record to your DNS, then login
mcp-publisher login dns --domain yourcompany.com --private-key $(openssl pkey -in key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
步骤6:发布到注册表
从服务器目录发布到注册表:
mcp-publisher publish
您将看到:
✓ Successfully published
步骤7:验证发布
检查您的服务器是否出现在注册表中:
curl "https://registry.modelcontextprotocol.io/v0/servers?search=io.github.username/server-name"
有关包括远程部署、故障排除和CI/CD自动化在内的完整文档,请参阅 官方出版指南.
贡献
虽然我们重视对此MCP服务器的贡献,但代码是以编程方式生成的。添加到内部文件的任何手动更改都将在下一代上被覆盖。 我们期待着您的反馈。请随时打开PR或带有概念证明的问题,我们将尽最大努力将其纳入未来的版本中。