loading…
Search for a command to run...
loading…
Enables searching and managing academic papers from arXiv with tools, resources, and prompt templates for literature review.
Enables searching and managing academic papers from arXiv with tools, resources, and prompt templates for literature review.
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.
Clone or download this project
Install dependencies:
pip install -r requirements.txt
Run the server directly:
python research_server.py
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.
Run the interactive demo:
python example_usage.py
This will show you an interactive menu with various examples.
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())
connect(server_script_path) - Connect to the MCP serverclose() - Close the connectionsearch_papers(topic, max_results) - Search for papers on a topicextract_info(paper_id) - Get detailed information about a paperget_folders() - List all research topic foldersget_topic_papers(topic) - Get all papers for a specific topicget_search_prompt(topic, num_papers) - Generate a search prompt templatelist_tools() - List all available toolslist_resources() - List all available resourceslist_prompts() - List all available prompt templatesfrom 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())
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())
python example_usage.py
Select from:
When configured with Claude Desktop, you can use natural language:
Use the search_papers tool to find papers about "machine learning"
Use the extract_info tool to get details for paper ID "2301.12345"
Show me the papers://folders resource
Show me papers://machine_learning
Use the generate_search_prompt template for "quantum computing" with 10 papers
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/
└── ...
The project consists of two main components:
MCP Server (research_server.py)
Python Client (research_client.py)
Resources provide read-only access to stored data:
Reusable prompts that guide the AI to:
All paper metadata is stored locally in JSON format:
data/papers/{topic}/{paper_id}.jsonSearch 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
Get metadata for a specific paper.
Parameters:
paper_id: arXiv paper ID (e.g., "2301.12345")Returns: JSON string with paper metadata
Lists all topic folders with paper counts.
Returns: JSON with topics and counts
Get all papers for a specific topic.
Parameters:
topic: Topic nameReturns: JSON with all papers in the topic
Generate a research prompt.
Parameters:
topic: Research topicnum_papers: Number of papers to search for (default: 5)Returns: Formatted prompt string
Server won't start
pip install -r requirements.txtPapers not found
search_papersdata/papers directory exists and has write permissionsarXiv API errors
Connection errors
connect() is correct and absoluteAsync runtime errors
asyncio.run()JSON parsing errors
Import errors
pip install -r requirements.txtFeel free to extend this server with additional features:
MIT License - feel free to use and modify for your projects.
Выполни в терминале:
claude mcp add research-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.