美国国家航空航天局SciX MCP服务器
NASA天体物理数据系统(SciX)API的模型上下文协议(MCP)服务器。该服务器使LLM能够搜索天文文献、检索论文元数据、分析引文指标和导出书目数据。
快速入门(MCP客户端)
获取API密钥
- 在以下网址创建帐户 SciX
- 在生成API令牌https://scixplorer.org/user/settings/token
- 设置环境变量:
export SCIX_API_TOKEN=your_api_key_here或者创建一个 .env 文件:
cp .env.example .env
# Edit .env and add your key配置您的MCP客户端(Claude、Codex等)
添加到MCP客户端配置中:
{
"mcpServers": {
"ads": {
"command": "npx",
"args": ["scix-mcp"],
"env": {
"SCIX_API_TOKEN": "your_api_key_here"
}
}
}
}常见位置:克劳德桌面(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS或 %AppData%\\Claude\\claude_desktop_config.json 在Windows上)和Codex CLI(~/.config/codex/config.json).编辑后重新启动客户端。
读取的本地MCP客户端 .mcp/server.json 还可以在中获取打包的配置 .mcp/server.json;只要把你的 SCIX_API_TOKEN.
示例提示
- Find refereed JWST exoplanet papers from 2022-2024 sorted by citation_count, return the top 5 in markdown with bibcodes, titles, first author, and citation counts.
- Build a query for gravitational wave kilonova follow-ups since 2017 (fielded abstract search), add the first 50 results to library
, and then give me metrics (h-index, total cites) for those bibcodes in JSON.
- Fetch paper 2020ApJ...905....3A, list its first 10 references with titles, and also list the first 10 forward citations with publication years.
- Create a public library named “Cosmic Web Reviews”, seeded with bibcodes [...], then share the public URL and export the contents in BibTeX.
- For bibcodes [...], return citation metrics plus a ranked list of which papers cite the most recent one (rows=25) in markdown.
- Get all my libraries, pick the one with the most documents, and return its metadata plus the first 5 document titles in JSON.特性
- 文献检索:使用高级Solr查询语法进行全文搜索
- 纸张详细信息:检索任何出版物的全面元数据
- 引文指标:计算h指数、引用计数和使用统计数据
- 引文网络:探索正向和反向引用
- 出口:以BibTeX、AASTeX、EndNote和MEDLARS格式生成引文
- 文档搜索:通过以下方式查询SciX帮助/docs内容
search_docs工具 - 双格式:支持人类可读的Markdown和机器可读的JSON
可用工具
搜索和元数据
search:Solr支持SciX上的搜索。参数:query(必填),rows(1-100,默认值10),start(偏移,默认值0),sort(score desc|citation_count desc|date desc|date asc|read_count desc,默认值score desc),response_format(markdown|json,默认值markdown).
- 示例查询: author:"Einstein, A." title:relativity, black holes year:2020-2023, author:^Smith, dark energy AND galaxy clusters.
get_paper:在以下时间取一篇论文bibcode可选response_format.get_metrics:指标bibcodes(1-2000)可选response_format;返回h-index、g-index、引用计数、使用统计数据。
引文网络
get_citations:转发引用bibcode;可选rows(1-100,默认值20)和response_format.get_references:反向引用bibcode;可选rows(1-100,默认值20)和response_format.
出口
export:出口bibcodes(1-2000)英寸format(bibtex|aastex|endnote|medlars).返回所选格式的纯文本。
文档
search_docs:搜索SciX帮助文档。参数:query(必填,自然语言),limit(1-20,默认值5)。返回一个排名列表,其中包含标题、节/小节、源URL、相关性得分和一个重点片段。
图书馆
get_libraries:列出库;可选的type(all|owner|collaborator,默认值all)以及response_format.get_library:元数据+文档library_id;可选response_format.create_library:创建name(必填),可选description,public(默认值false),bibcodes,以及response_format.delete_library:永久删除library_id;可选response_format.edit_library:更新name,description,或public为了library_id;可选response_format.manage_documents:添加/删除文档library_id,bibcodes(1-2000),action(add|remove),可选response_format.add_documents_by_query:将搜索结果添加到库中library_id,query,可选rows(1-2000,默认值25),以及response_format.library_operation:使用以下命令在库上运行set opslibrary_id,operation(union|intersection|difference|copy|empty),可选source_library_ids,name/description(供复制),以及response_format.
权限和共享
get_permissions:查看以下内容的所有者/合作者library_id;可选response_format.update_permissions:授予/更改用户的访问权限library_id,email,permission(owner|admin|write|read),可选response_format.transfer_library:转让所有权library_id,email,可选response_format.
注释
get_annotation:获取笔记内容library_id+bibcode;可选response_format.manage_annotation:添加/更新注释library_id,bibcode,content,可选response_format.delete_annotation:删除注释library_id+bibcode;可选response_format.
速率限制
- 每天5000个请求 每个API密钥
- 响应标头中返回速率限制信息
- 联系adshelp@cfa.harvard.edu对于更高的限制
SciX搜索语法
SciX搜索支持强大的查询语法:
| 语法 | 描述 | 示例 |
|---|---|---|
author:"Last, F." | 确切作者 | author:"Huchra, John" |
author:^Last | 第一作者 | author:^Smith |
title:keyword | 标题搜索 | title:exoplanet |
abstract:keyword | 摘要搜索 | abstract:"dark matter" |
year:YYYY-YYYY | 年份范围 | year:2020-2023 |
property:refereed | 仅作裁判 | property:refereed |
citations(bibcode:X) | 引用X的论文 | citations(bibcode:2019ApJ...) |
references(bibcode:X) | X引用的论文 | references(bibcode:2019ApJ...) |
AND, OR, NOT 布尔运算符 black holes AND galaxy |
发展
安装和构建
npm install
npm run build本地命令
# Watch mode
npm run dev
# Test with MCP Inspector
npx @modelcontextprotocol/inspector node build/index.js测试
该项目包括一个使用Vitest的全面测试套件。
运行测试
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage测试结构
测试在 test/ 目录:
test/
├── helpers/
│ └── mockFetch.ts # Fetch mocking utilities
├── client.test.ts # HTTP client tests
├── search-docs.test.ts # Documentation search tests
└── tools/
├── search.test.ts # Search tool tests
├── paper.test.ts # Paper details tests
├── metrics.test.ts # Metrics tests
├── citations.test.ts # Citations/references tests
├── export.test.ts # Export tests
└── library.test.ts # Library management tests测试覆盖率
测试套件包括:
- HTTP客户端:GET/POST/PUT/DELETE方法、错误处理(401/404/429)、超时、请求格式
- 搜索工具:查询参数编码、分页、结果限制、响应格式
- 纸张工具:双代码验证、字段选择、丢失论文的错误处理
- 度量工具:批量bibcode处理、MAX_BIBCODES限制、度量类型选择
- 引文工具:正向/反向引用、排序、行限制
- 导出工具:多种导出格式(BibTeX、AASTeX、EndNote等),批处理
- 库工具:所有CRUD操作、权限、注释、库操作
API测试令牌
测试使用mock fetch,不需要真正的API令牌。测试套件设置 ADS_DEV_KEY=test-api-key 自动。
实时集成测试(可选)
要针对真正的ADS API运行测试(默认情况下跳过):
- 设置您真正的API密钥:
export SCIX_API_TOKEN=your_real_api_key- 运行集成测试(尚未实现):
pnpm test:integration备注:集成测试计入您的每日速率限制(5000个请求/天)。
项目结构
src/
├── index.ts # Main server entry point
├── client.ts # SciX API client wrapper
├── types.ts # TypeScript/Zod type definitions
├── formatters.ts # Response formatting utilities
├── config.ts # Configuration constants
└── tools/
├── search.ts # Search tool
├── paper.ts # Paper details tool
├── metrics.ts # Metrics tool
├── citations.ts # Citation network tools
└── export.ts # Export tool库工具
get_libraries/get_library:列出并检查库create_library/delete_library/edit_library:管理库元数据manage_documents:向库添加/删除bibcodeadd_documents_by_query:将搜索查询的结果添加到库中library_operation:库上的联合/交叉/差异/复制/空get_permissions/update_permissions/transfer_library:管理共享get_annotation/manage_annotation/delete_annotation:处理文件上的注释
示例用法
搜索论文
Use search with query "supernova 2023" to find recent supernova papers获取纸张详细信息
Use get_paper with bibcode "2023ApJ...950..123S"计算指标
Use get_metrics with bibcodes ["2023ApJ...950..123S", "2022MNRAS.517.1234T"]导出引文
Use export with bibcodes ["2023ApJ...950..123S"] and format "bibtex"错误处理
服务器提供明确的错误消息:
- 401:API密钥无效-检查
SCIX_API_TOKEN - 404:找不到资源-检查bibcode格式
- 429:超出速率限制-等待重置
- 超时:请求耗时>30秒
资源
许可证
麻省理工学院
支持
对于API问题:adshelp@cfa.harvard.edu 对于服务器问题:在GitHub上打开问题
