使用说明
@byul/mcp
符合最新的模型上下文协议(MCP)规范。
链接
概述
@byul/mcp 是一个基于stdio的MCP服务器,代理Byul REST API。它公开了一小部分MCP工具和一个资源,该资源将请求转发到Byul端点并返回原始JSON响应,以及一个简短的文章计数摘要字符串。
需求
- Node.js 18+
BYUL_API_KEY环境变量
快速启动
BYUL_API_KEY=byul_xxxxxxxxxxxxx npx -y @byul/mcp
配置
在LLM客户端中将此服务器注册为MCP提供程序。客户端将通过stdio启动服务器,并通过stdin/stdout使用JSON-RPC进行通信。
参数
- 工具(摘要;请参见
@docs完整规格)news_fetch→ 代理GET /news使用过滤器:limit,cursor,sinceId,minImportance,q,symbol,startDate,endDate
- 资源(摘要;见
@docs完整规格)byul://news{?limit,cursor,sinceId,minImportance,q,symbol,startDate,endDate}
每个响应包含:
- 类似“返回的N篇文章”的摘要字符串
- Byul API的原始JSON有效负载
可用工具
news_fetch
- 描述:获取最新财经新闻
- 参数:
limit(数量,可选)-文章数量(1-100)cursor(字符串,可选)–上一页的分页光标sinceId(字符串,可选)-返回在此ID之后创建的文章minImportance(数字,可选)-最低重要性(1-10)q(字符串,可选)-搜索查询symbol(字符串,可选)-股票代码(例如AAPL)startDate(字符串,可选)-ISO 8601开始时间戳(UTC)endDate(字符串,可选)-ISO 8601结束时间戳(UTC)
- 请求示例:
Fetch top 5 news articles about AAPL from the past week
安全
- 通过提供API密钥
BYUL_API_KEY仅环境变量。不要在代码或配置中硬编码凭据。
平台设置
1) 光标(最新)
~/.cursor/mcp.json 或项目 .cursor/mcp.json:
{
"mcpServers": {
"byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": { "BYUL_API_KEY": "byul_xxxxxxxxxxxxx" }
}
}
}
2) 克劳德代码(VS代码扩展)
命令行界面
claude mcp add -e BYUL_API_KEY=byul_xxxxxxxxxxxxx --scope user byul npx -- -y @byul/mcp
设置JSON
{
"mcpServers": {
"byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": { "BYUL_API_KEY": "byul_xxxxxxxxxxxxx" }
}
}
}
3) 克劳德桌面
claude_desktop_config.json:
{
"mcpServers": {
"byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": { "BYUL_API_KEY": "byul_xxxxxxxxxxxxx" }
}
}
}
4) VS代码
工作区 .vscode/mcp.json:
{
"mcpServers": {
"byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": { "BYUL_API_KEY": "byul_xxxxxxxxxxxxx" }
}
}
}
5) 风帆冲浪
windsurf_mcp.json:
{
"mcpServers": {
"mcp-server-byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": {
"BYUL_API_KEY": "byul_xxxxxxxxxxxxx"
}
}
}
}
6) Gemini CLI
~/.gemini/settings.json:
{
"mcpServers": {
"byul": {
"command": "npx",
"args": ["-y", "@byul/mcp"],
"env": { "BYUL_API_KEY": "byul_xxxxxxxxxxxxx" }
}
}
}
如果 mcpServers 对象不存在,请创建它。此包仅支持stdio(本地)传输。
故障排除
-
缺少API密钥
- 错误示例:
Missing BYUL_API_KEY environment variable - 修复:设置
BYUL_API_KEY在启动服务器之前,在您的环境中
- 错误示例:
-
企业代理/防火墙
npx必须到达注册表才能下载@byul/mcp第一轮;相应地配置代理设置
-
Windows/WSL路径和环境
- PowerShell示例:
$env:BYUL_API_KEY = "byul_xxxxxxxxxxxxx" npx -y @byul/mcp
- PowerShell示例:
-
运输范围
- 此套餐仅涵盖stdio传输。本指南有意不涉及HTTP/SSE传输。
符合最新的模型上下文协议(MCP)规范。