Biomedical APIs MCP Server
Enables AI agents to query free biomedical and pharmaceutical APIs for clinical trials, drug data, molecular structures, adverse events, and research literature.
README
Biomedical APIs MCP Server
This Model Context Protocol (MCP) server exposes 14 tools to query free biomedical and pharmaceutical APIs—plus stubs for restricted/paid sources—enabling AI agents to access clinical trial data, drug information, molecular structures, adverse events, and research literature.
🎯 Available APIs
Free & Open APIs (fully functional)
- ClinicalTrials.gov → Search registered clinical trials worldwide
- ChEMBL → Small molecules, bioactivity data, drug-like compounds
- PubChem → Chemical compounds, molecular properties
- OpenFDA → FDA adverse event reports (drug, device, food)
- Europe PMC → Biomedical research articles and preprints
Restricted/Paid APIs (stubs only)
- dbGaP → NIH genomic & clinical datasets (requires NIH credentials)
- PhysioNet → Physiological signals (requires credentialed access)
- MIMIC-IV → ICU records (PhysioNet credential + CITI training)
- UK Biobank → Large-scale biomedical data (application required)
- DrugBank → Structured drug data (academic/commercial license)
- BindingDB → Protein-ligand binding affinities (bulk download)
- OpenTrials → Merged trial data & sponsors (open access)
- Crunchbase → Company & funding data (free tier limited)
🚀 Quick Start
1. Install Dependencies
npm install
2. Configure Environment (optional)
Copy .env.example to .env and add optional API keys:
cp .env.example .env
Edit .env:
OPENFDA_API_KEY=your_key_here # Optional: increases OpenFDA rate limits
CRUNCHBASE_API_KEY=your_key_here # Optional: enables Crunchbase free tier
3. Build the Server
npm run build
4. Run in Development Mode
npm run dev
5. Use in Production
npm start
🧪 Testing with MCP Inspector
MCP Inspector lets you test your server interactively:
npx @modelcontextprotocol/inspector node dist/server.js
Once connected, you can:
- List all 14 available tools
- Test tool calls with custom inputs
- View structured JSON responses
- Debug errors and API rate limits
🔌 Connecting to Clients
VS Code (Copilot Agent Mode)
The server is pre-configured in .vscode/mcp.json:
{
"servers": {
"biomed-apis": {
"type": "stdio",
"command": "node",
"args": ["dist/server.js"]
}
}
}
To connect:
- Open this workspace in VS Code
- Restart VS Code (if needed)
- Open Copilot Chat and confirm the MCP server is listed
- Ask: "Search ClinicalTrials.gov for epilepsy trials started in 2023"
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"biomed-apis": {
"command": "node",
"args": ["C:\\For Me\\Projects\\mcp with DBs\\dist\\server.js"]
}
}
}
Restart Claude Desktop. The tools will appear in the MCP panel.
Claude Code CLI
claude mcp add --transport stdio biomed-apis node "C:\\For Me\\Projects\\mcp with DBs\\dist\\server.js"
📚 Example Tool Calls
1. Search Clinical Trials
{
"tool": "search_clinical_trials",
"input": {
"query": "epilepsy",
"filter": "AREA[StartDate]2020-01-01+TO+2023-12-31",
"pageSize": 5
}
}
Returns: NCT IDs, titles, status, phases, conditions, interventions
2. Search ChEMBL Compounds
{
"tool": "search_chembl_compounds",
"input": {
"query": "aspirin",
"limit": 5
}
}
Returns: ChEMBL IDs, molecular formulas, weights, max clinical phase
3. Get ChEMBL Bioactivity Data
{
"tool": "get_chembl_activities",
"input": {
"targetChemblId": "CHEMBL2",
"limit": 10
}
}
Returns: Activity IDs, assay IDs, molecules, types (IC50, Ki, etc.), values, units
4. Get PubChem Compound by Name
{
"tool": "get_pubchem_compound",
"input": {
"name": "glucose"
}
}
Returns: CID, molecular formula, weight, IUPAC name, SMILES
5. Search OpenFDA Drug Adverse Events
{
"tool": "search_openfda_drug_events",
"input": {
"search": "patient.drug.medicinalproduct:\"metformin\"",
"limit": 10
}
}
Returns: Receive dates, patient ages, reactions, drug names
6. Search Europe PMC Articles
{
"tool": "search_europepmc_articles",
"input": {
"query": "CRISPR gene editing",
"pageSize": 10
}
}
Returns: Article IDs, sources, titles, authors, journals, publication years
7. Query Restricted APIs (Stubs)
{
"tool": "query_dbgap",
"input": {
"query": "GWAS cardiovascular disease"
}
}
Returns: [dbGaP stub] Querying: "GWAS cardiovascular disease". Access requires NIH credentials & dbGaP approval.
Note: Stubs for dbGaP, PhysioNet, MIMIC-IV, UK Biobank, DrugBank, BindingDB, OpenTrials, and Crunchbase return informational messages. Replace the stub functions in
src/clients/restrictedStubs.tswith real implementations once you have credentials.
🛠️ Project Structure
mcp-biomed-server/
├── src/
│ ├── server.ts # Main MCP server with all 14 tools
│ └── clients/
│ ├── clinicalTrialsClient.ts # ClinicalTrials.gov
│ ├── chemblClient.ts # ChEMBL
│ ├── pubchemClient.ts # PubChem
│ ├── openfdaClient.ts # OpenFDA
│ ├── europePmcClient.ts # Europe PMC
│ └── restrictedStubs.ts # Stubs for restricted APIs
├── dist/ # Compiled JavaScript (after build)
├── .vscode/
│ └── mcp.json # VS Code MCP config
├── .env.example # Environment variable template
├── package.json
├── tsconfig.json
└── README.md
🔧 Development
Adding a New Tool
- Create a client function in
src/clients/(or add to existing file) - Register the tool in
src/server.ts:server.registerTool( 'my_tool_name', { title: 'My Tool', description: 'What it does', inputSchema: { param: z.string().describe('Parameter description') }, outputSchema: { result: z.string() } }, async ({ param }) => { const result = await myClientFunction(param); return { content: [{ type: 'text', text: JSON.stringify({ result }) }], structuredContent: { result } }; } ); - Rebuild:
npm run build
Debugging
- Use
npm run devfor live TypeScript execution viatsx - Server logs errors to
stderr(visible in MCP Inspector or client logs) - Check rate limits if APIs return HTTP 429
⚖️ Rate Limits & Best Practices
| API | Rate Limit | Notes |
|---|---|---|
| ClinicalTrials.gov | ~1000 req/day | No key required; public access |
| ChEMBL | Unknown (generous) | No key; community-supported |
| PubChem | ~5 req/sec | No key; use delays for bulk requests |
| OpenFDA | 240 req/min (1000/day without key) | API key increases to 240 req/min |
| Europe PMC | Unknown (generous) | No key; rate-limited |
Tips:
- Use
pageSize/limitparameters to control result counts - Add exponential backoff for HTTP 429 errors
- Consider caching responses for repeated queries
📖 References
- Model Context Protocol Docs
- MCP TypeScript SDK
- ClinicalTrials.gov API
- ChEMBL API
- PubChem PUG REST
- OpenFDA API
- Europe PMC API
📝 License
MIT (adjust as needed for your project)
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-api) - Add your client in
src/clients/ - Register tools in
src/server.ts - Test with MCP Inspector
- Submit a pull request
🐛 Troubleshooting
"Cannot find module" errors
npm install # Reinstall dependencies
npm run build # Rebuild after changes
VS Code doesn't recognize the MCP server
- Ensure
.vscode/mcp.jsonexists - Rebuild:
npm run build - Restart VS Code
- Check VS Code's MCP output panel for errors
API returns 429 (Too Many Requests)
- Add delays between requests
- Use optional API keys (OpenFDA, Crunchbase)
- Reduce
pageSize/limitparameters
Stub tools return placeholder messages
- This is expected! Restricted APIs require credentials
- Replace functions in
src/clients/restrictedStubs.tswith real implementations
🎉 Next Steps
- Test all 14 tools with MCP Inspector
- Connect to VS Code Copilot and try example queries
- Replace stubs with real API implementations (if you have access)
- Add rate limiting and caching for production use
- Extend with more APIs: BindingDB real download, OpenTrials integration, etc.
Built with 💙 using Model Context Protocol
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。