Research MCP Server
Enables searching and managing academic papers from arXiv with tools, resources, and prompt templates for literature review.
README
Research MCP Server
A FastMCP-based Model Context Protocol (MCP) server for searching and managing academic papers from arXiv. This server demonstrates how to build MCP servers with tools, resources, and prompt templates.
Features
Tools
- search_papers: Search arXiv for papers on a specific topic and store their metadata locally
- extract_info: Retrieve detailed metadata for a specific paper by ID
Resources
- papers://folders: List all available research topic folders
- papers://{topic}: Get all papers for a specific research topic
Prompt Templates
- generate_search_prompt: Generate a structured prompt to guide research on a specific topic
Installation
-
Clone or download this project
-
Install dependencies:
pip install -r requirements.txt
Running the Server
Standalone Mode
Run the server directly:
python research_server.py
With Claude Desktop
Add the server to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Configuration:
{
"mcpServers": {
"research": {
"command": "python",
"args": [
"/absolute/path/to/research_server.py"
]
}
}
}
Replace /absolute/path/to/research_server.py with the actual path to your file.
Using the Python Client
Quick Start
Run the interactive demo:
python example_usage.py
This will show you an interactive menu with various examples.
Basic Client Usage
from research_client import ResearchClient
import asyncio
async def main():
client = ResearchClient()
# Connect to the server
await client.connect("./research_server.py")
# Search for papers
paper_ids = await client.search_papers("machine learning", max_results=5)
# Get detailed information
for paper_id in paper_ids:
await client.extract_info(paper_id)
# Browse topics
await client.get_folders()
# Close connection
await client.close()
asyncio.run(main())
Available Client Methods
Connection
connect(server_script_path)- Connect to the MCP serverclose()- Close the connection
Tools
search_papers(topic, max_results)- Search for papers on a topicextract_info(paper_id)- Get detailed information about a paper
Resources
get_folders()- List all research topic foldersget_topic_papers(topic)- Get all papers for a specific topic
Prompts
get_search_prompt(topic, num_papers)- Generate a search prompt template
Discovery
list_tools()- List all available toolslist_resources()- List all available resourceslist_prompts()- List all available prompt templates
Usage Examples
Example 1: Literature Review
from research_client import ResearchClient
import asyncio
async def literature_review():
client = ResearchClient()
await client.connect("./research_server.py")
# Search for papers
paper_ids = await client.search_papers("neural networks", max_results=5)
# Get details for each paper
for paper_id in paper_ids:
paper = await client.extract_info(paper_id)
print(f"Title: {paper['title']}")
print(f"Authors: {', '.join(paper['authors'])}")
await client.close()
asyncio.run(literature_review())
Example 2: Compare Topics
async def compare_topics():
client = ResearchClient()
await client.connect("./research_server.py")
topics = ["deep learning", "machine learning", "AI"]
for topic in topics:
await client.search_papers(topic, max_results=3)
# View all collected topics
folders = await client.get_folders()
await client.close()
asyncio.run(compare_topics())
Example 3: Interactive Menu (Recommended)
python example_usage.py
Select from:
- Literature Review - Search and analyze papers on a topic
- Compare Multiple Topics - Compare papers across different areas
- Deep Dive - Get comprehensive details on specific papers
- Browse Resources - Explore stored research data
- Generate Research Prompts - Create structured research prompts
- Run All Examples - Execute all examples sequentially
Using with Claude Desktop
When configured with Claude Desktop, you can use natural language:
- Search for papers:
Use the search_papers tool to find papers about "machine learning"
- Get paper details:
Use the extract_info tool to get details for paper ID "2301.12345"
- List all topics:
Show me the papers://folders resource
- View papers for a topic:
Show me papers://machine_learning
- Use prompt templates:
Use the generate_search_prompt template for "quantum computing" with 10 papers
Project Structure
MCP_server/
├── research_server.py # Main MCP server implementation
├── research_client.py # Python client for the MCP server
├── example_usage.py # Interactive examples and demos
├── requirements.txt # Python dependencies
├── README.md # This file
├── .gitignore # Git ignore rules
├── .claude_mcp_config.json # Example MCP configuration
└── data/
└── papers/ # Storage for paper metadata
├── topic1/ # Papers organized by topic
├── topic2/
└── ...
How It Works
Architecture
The project consists of two main components:
-
MCP Server (
research_server.py)- Built with FastMCP framework
- Exposes tools, resources, and prompt templates
- Handles arXiv API communication
- Manages local paper storage
-
Python Client (
research_client.py)- Connects to the MCP server via stdio
- Provides async methods to call tools and access resources
- Handles JSON parsing and formatting
- Manages connection lifecycle
Search Papers Tool
- Takes a topic and searches arXiv's API
- Parses XML responses to extract paper metadata
- Stores papers locally in topic-specific folders
- Returns list of paper IDs found
Extract Info Tool
- Searches local storage for a paper by ID
- Returns complete metadata including:
- Title and authors
- Abstract/summary
- Publication date
- PDF link
Resources
Resources provide read-only access to stored data:
- List all research topics you've explored
- View all papers within a specific topic
Prompt Templates
Reusable prompts that guide the AI to:
- Search for papers on a topic
- Extract and analyze paper details
- Provide structured summaries and recommendations
Client-Server Communication
- Client spawns server as subprocess
- Communication via JSON-RPC over stdio
- Client sends tool calls, resource requests, and prompt queries
- Server processes requests and returns structured responses
- Client parses and presents results
Data Storage
All paper metadata is stored locally in JSON format:
- Location:
data/papers/{topic}/{paper_id}.json - Format: JSON with title, authors, summary, publication date, and PDF link
API Reference
search_papers(topic: str, max_results: int = 5) -> List[str]
Search arXiv and store paper metadata.
Parameters:
topic: Research topic to search formax_results: Maximum number of papers to retrieve (default: 5)
Returns: List of paper IDs
extract_info(paper_id: str) -> str
Get metadata for a specific paper.
Parameters:
paper_id: arXiv paper ID (e.g., "2301.12345")
Returns: JSON string with paper metadata
Resource: papers://folders
Lists all topic folders with paper counts.
Returns: JSON with topics and counts
Resource: papers://{topic}
Get all papers for a specific topic.
Parameters:
topic: Topic name
Returns: JSON with all papers in the topic
generate_search_prompt(topic: str, num_papers: int = 5) -> str
Generate a research prompt.
Parameters:
topic: Research topicnum_papers: Number of papers to search for (default: 5)
Returns: Formatted prompt string
Troubleshooting
Server Issues
Server won't start
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check Python version (3.8+ required)
- Verify the server script path is correct
Papers not found
- Make sure you've searched for papers first using
search_papers - Check that the
data/papersdirectory exists and has write permissions
arXiv API errors
- The arXiv API has rate limits; wait a few seconds between searches
- Check your internet connection
- Verify the arXiv API is accessible (try accessing http://export.arxiv.org/api/query in browser)
Client Issues
Connection errors
- Ensure the server script path in
connect()is correct and absolute - Check that Python is in your PATH
- Verify no other process is using the server
Async runtime errors
- Make sure you're running client code with
asyncio.run() - Don't mix async and sync code without proper await statements
JSON parsing errors
- Check that the server is returning valid JSON
- Ensure you're using the latest version of the client
- Try running the server standalone first to verify it works
Import errors
- Install all dependencies:
pip install -r requirements.txt - Verify you're in the correct directory
- Check Python path and virtual environment
Contributing
Feel free to extend this server with additional features:
- Support for other academic databases (PubMed, Semantic Scholar)
- Paper similarity analysis
- Citation graph visualization
- Automatic literature review generation
License
MIT License - feel free to use and modify for your projects.
Learn More
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。