bioc-pmc-mcp
v1.1.0
Published
MCP server for accessing PMC Open Access articles in BioC format
Maintainers
Readme
BioC PMC MCP Server
A Model Context Protocol (MCP) server for accessing PMC Open Access articles in BioC format. This package provides seamless integration with AI assistants and research tools through the MCP protocol.
✨ Features
- 🔬 PMC Article Access - Access full-text articles from PMC Open Access collection
- 📦 Batch Download - Download multiple articles with concurrency control
- 🎯 Multiple ID Support - Support for both PubMed ID and PMC ID
- 📄 Format Flexibility - Support for XML and JSON formats
- 🌐 Encoding Options - Unicode and ASCII encoding support
- ⚡ Fast Response - 30-second timeout with optimized performance
- 🛡️ Robust Error Handling - Comprehensive error management
- 📊 Detailed Logging - Debug-friendly logging system
- 🔧 Easy Integration - Simple MCP protocol implementation
🚀 Quick Start
Installation
npm install -g bioc-pmc-mcpUsage
As a Global Command
bioc-pmc-mcpAs an MCP Server
The server will start and listen for MCP protocol messages via stdio.
Integration with Claude Desktop
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"bioc-pmc-mcp": {
"command": "npx",
"args": ["-y", "bioc-pmc-mcp"]
}
}
}After adding this configuration, restart Claude Desktop and you'll be able to access PMC articles directly through the MCP interface.
Development Installation
cd bioc-pmc-mcp
npm install
npm start📖 Usage
MCP Tool Integration
The server provides four tools for accessing PMC articles:
1. get_article - Get Single Article
Parameters:
id(string, required): PubMed ID or PMC ID (e.g., 17299597 or PMC1790863)format(string, optional): Data format ("xml" or "json"), default "json"encoding(string, optional): Encoding format ("unicode" or "ascii"), default "unicode"
Example:
{
"name": "get_article",
"arguments": {
"id": "17299597",
"format": "json",
"encoding": "unicode"
}
}2. batch_download - Batch Download Articles
Parameters:
ids(array, required): Array of article IDsformat(string, optional): Data format, default "json"encoding(string, optional): Encoding format, default "unicode"concurrency(number, optional): Number of concurrent requests, default 5delay(number, optional): Delay between requests in milliseconds, default 100
Example:
{
"name": "batch_download",
"arguments": {
"ids": ["17299597", "PMC1790863"],
"format": "json",
"encoding": "unicode",
"concurrency": 3,
"delay": 200
}
}3. get_article_info - Get Article Information
Parameters:
id(string, required): PubMed ID or PMC ID
Example:
{
"name": "get_article_info",
"arguments": {
"id": "17299597"
}
}4. validate_id - Validate Article ID
Parameters:
id(string, required): Article ID to validate
Example:
{
"name": "validate_id",
"arguments": {
"id": "17299597"
}
}Response Format:
{
"success": true,
"id": "17299597",
"format": "json",
"encoding": "unicode",
"data": {
// BioC format article data
}
}🔧 Technical Details
- Timeout: 30 seconds
- Headers: Automatic Content-Type and User-Agent
- Error Handling: Distinguishes between network, API, and timeout errors
- Logging: Detailed request and response logging
- Concurrency Control: Configurable concurrent request limits
- Rate Limiting: Configurable delays between requests
🛠️ Error Handling
The server handles the following error types:
- Timeout Errors: Requests exceeding 30 seconds
- Network Errors: Unable to connect to API server
- API Errors: Server returning error status codes (404, 400, 500+)
- Parameter Errors: Missing required parameters or incorrect types
- ID Validation Errors: Invalid article ID formats
🧪 Testing
Run the test suite:
npm testThis will test:
- API connectivity
- Parameter validation
- Error handling
- Batch download functionality
📁 Project Structure
├── server.js # Main server file
├── package.json # Project configuration and dependencies
├── README.md # Project documentation
├── LICENSE # MIT License
├── INSTALLATION.md # Installation guide
├── CLAUDE_INTEGRATION.md # Claude Desktop integration guide
├── mcp-config-example.json # MCP configuration example
└── test/
└── test-api.js # Test suite