NYTimes Article Search MCP 服务器
这是一个基于TypeScript的MCP服务器,允许根据关键词搜索过去30天内的新约时报文章。它通过提供以下功能展示了核心MCP概念:
- 文章搜索工具
- 与新约时报API的集成

功能
工具
search_articles- 基于关键词搜索过去30天内的新约时报文章- 需要参数:
keyword - 返回文章列表,包含标题、摘要、URL、发布日期和作者
- 需要参数:
开发
安装依赖:
npm install
构建服务器:
npm run build
开发时自动重建:
npm run watch
调试
由于MCP服务器通过stdio通信,调试可能具有挑战性。我们推荐使用MCP Inspector,它作为包脚本提供:
npm run inspector
Inspector将提供一个URL,用于在浏览器中访问调试工具。
安装
通过Smithery安装
要自动通过Smithery为Claude Desktop安装NYTimes Article Search:
npx -y @smithery/cli install nyt --client claude
手动安装
要在Claude Desktop中使用,添加服务器配置:
在MacOS:~/Library/Application Support/Claude/claude_desktop_config.json
在Windows:%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"nyt": {
"command": "node",
"args": ["path/to/your/build/index.js"],
"env": {
"NYTIMES_API_KEY": "your_api_key_here"
}
}
}
}
环境变量
在项目根目录创建一个.env文件,并添加您的新约时报API密钥:
NYTIMES_API_KEY=your_api_key_here
运行服务器
构建项目后,您可以使用以下命令运行服务器:
node build/index.js
服务器将启动并通过stdio监听MCP请求。
许可证
本项目根据MIT许可证授权。
