MCP HubMCP Hub
YUZongmin

semantic-scholar-fastmcp-mcp-server

by: YUZongmin

A FastMCP server implementation for the Semantic Scholar API, providing comprehensive access to academic paper data, author information, and citation networks.

22created 25/12/2024
Visit
API
Academic

πŸ“ŒOverview

Purpose: To provide a FastMCP server implementation for the Semantic Scholar API, enabling effective access to academic paper data, author information, and citation networks.

Overview: The Semantic Scholar MCP Server streamlines the process of retrieving and analyzing academic research data. It is designed to support enhanced search capabilities, citation analysis, and author profiling, all within a modular architecture that promotes easy maintenance and extensibility.

Key Features:

  • Paper Search & Discovery: Allows for comprehensive exploration of papers with functionalities such as full-text searches, advanced filtering, and recommendations to enhance research efficiency.

  • Citation Analysis: Facilitates the exploration of citation networks, enabling users to track references and analyze the impact of academic work within the scholarly community.

  • Author Information: Provides in-depth author data including profiles, publication histories, and batch retrieval options to support research on academics and their contributions.

  • Advanced Operational Features: Includes customizable search strategies, efficient batch operations, rate limiting compliance, and rigorous error handling for a robust and user-friendly experience.


Semantic Scholar MCP Server

A FastMCP server implementation for the Semantic Scholar API, providing comprehensive access to academic paper data, author information, and citation networks.

Project Structure

The project has been refactored into a modular structure for better maintainability:

semantic-scholar-server/
β”œβ”€β”€ semantic_scholar/            # Main package
β”‚   β”œβ”€β”€ __init__.py             # Package initialization
β”‚   β”œβ”€β”€ server.py               # Server setup and main functionality
β”‚   β”œβ”€β”€ mcp.py                  # Centralized FastMCP instance definition
β”‚   β”œβ”€β”€ config.py               # Configuration classes
β”‚   β”œβ”€β”€ utils/                  # Utility modules
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ errors.py           # Error handling
β”‚   β”‚   └── http.py             # HTTP client and rate limiting
β”‚   β”œβ”€β”€ api/                    # API endpoints
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ papers.py           # Paper-related endpoints
β”‚       β”œβ”€β”€ authors.py          # Author-related endpoints
β”‚       └── recommendations.py  # Recommendation endpoints
β”œβ”€β”€ run.py                      # Entry point script

This structure:

  • Separates concerns into logical modules
  • Makes the codebase easier to understand and maintain
  • Allows for better testing and future extensions
  • Keeps related functionality grouped together
  • Centralizes the FastMCP instance to avoid circular imports

Features

  • Paper Search & Discovery

    • Full-text search with advanced filtering
    • Title-based paper matching
    • Paper recommendations (single and multi-paper)
    • Batch paper details retrieval
    • Advanced search with ranking strategies
  • Citation Analysis

    • Citation network exploration
    • Reference tracking
    • Citation context and influence analysis
  • Author Information

    • Author search and profile details
    • Publication history
    • Batch author details retrieval
  • Advanced Features

    • Complex search with multiple ranking strategies
    • Customizable field selection
    • Efficient batch operations
    • Rate limiting compliance
    • Support for both authenticated and unauthenticated access
    • Graceful shutdown and error handling
    • Connection pooling and resource management

System Requirements

  • Python 3.8+
  • FastMCP framework
  • Environment variable for API key (optional)

Installation

Installing via Smithery

To install Semantic Scholar MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install semantic-scholar-fastmcp-mcp-server --client claude

Manual Installation

  1. Clone the repository:
git clone https://github.com/YUZongmin/semantic-scholar-fastmcp-mcp-server.git
cd semantic-scholar-server
  1. Install FastMCP and other dependencies following: https://github.com/jlowin/fastmcp

  2. Configure FastMCP:

For Claude Desktop users, configure the server in your FastMCP configuration file (typically ~/.config/claude-desktop/config.json):

{
  "mcps": {
    "Semantic Scholar Server": {
      "command": "/path/to/your/venv/bin/fastmcp",
      "args": [
        "run",
        "/path/to/your/semantic-scholar-server/run.py"
      ],
      "env": {
        "SEMANTIC_SCHOLAR_API_KEY": "your-api-key-here"  // Optional
      }
    }
  }
}
  • Replace paths with actual locations on your machine.
  • Add API key if available; otherwise, remove the env section.
  1. Start using the server:

It will be available to your Claude Desktop instance. Claude manages the server process automatically.

API Key (Optional)

To get higher rate limits and better performance:

  1. Get an API key from Semantic Scholar API: https://www.semanticscholar.org/product/api
  2. Add it to your FastMCP configuration as shown above.

If no API key is provided, the server uses unauthenticated access with lower rate limits.

Configuration

Environment Variables

  • SEMANTIC_SCHOLAR_API_KEY: Your Semantic Scholar API key (optional).

Rate Limits

The server automatically adjusts rate limits:

With API Key:

  • Search, batch, and recommendation endpoints: 1 request per second
  • Other endpoints: 10 requests per second

Without API Key:

  • All endpoints: 100 requests per 5 minutes
  • Longer timeouts for requests

Available MCP Tools

Note: All tools align with the official Semantic Scholar API documentation: https://api.semanticscholar.org/api-docs/

Paper Search Tools

  • paper_relevance_search: Search papers using relevance ranking

    • Supports query parameters including year range and citation count filters
    • Returns paginated results with customizable fields
  • paper_bulk_search: Bulk paper search with sorting options

    • Optimized for larger result sets
    • Supports sorting by citation count, publication date, etc.
  • paper_title_search: Find papers by exact title match

    • Returns detailed information with customizable fields
  • paper_details: Get comprehensive details about a specific paper

    • Accepts various paper ID formats (S2 ID, DOI, ArXiv, etc.)
    • Returns detailed metadata with nested field support
  • paper_batch_details: Retrieve multiple paper details efficiently

    • Accepts up to 1000 paper IDs per request
    • Supports same ID formats and fields as single paper details

Citation Tools

  • paper_citations: Get papers citing a specific paper

    • Returns paginated citing papers with citation context when available
    • Supports field customization and sorting
  • paper_references: Get papers referenced by a specific paper

    • Returns paginated referenced papers with reference context when available
    • Supports field customization and sorting

Author Tools

  • author_search: Search authors by name

    • Returns paginated results with customizable fields
    • Includes affiliations and publication counts
  • author_details: Get detailed information about an author

    • Includes metrics like h-index and citation counts
  • author_papers: Get papers by an author

    • Returns paginated list of publications with customizable fields
  • author_batch_details: Get details for multiple authors

    • Efficiently retrieve information for up to 1000 authors
    • Returns fields same as single author details

Recommendation Tools

  • paper_recommendations_single: Get recommendations based on a single paper

    • Returns similar papers based on content and citation patterns
    • Supports field customization
  • paper_recommendations_multi: Get recommendations based on multiple papers

    • Accepts positive and negative example papers
    • Returns papers similar to positive examples and dissimilar to negative ones

Usage Examples

Basic Paper Search

results = await paper_relevance_search(
    context,
    query="machine learning",
    year="2020-2024",
    min_citation_count=50,
    fields=["title", "abstract", "authors"]
)

Paper Recommendations

# Single paper recommendation
recommendations = await paper_recommendations_single(
    context,
    paper_id="649def34f8be52c8b66281af98ae884c09aef38b",
    fields="title,authors,year"
)

# Multi-paper recommendation
recommendations = await paper_recommendations_multi(
    context,
    positive_paper_ids=["649def34f8be52c8b66281af98ae884c09aef38b", "ARXIV:2106.15928"],
    negative_paper_ids=["ArXiv:1805.02262"],
    fields="title,abstract,authors"
)

Batch Operations

# Get details for multiple papers
papers = await paper_batch_details(
    context,
    paper_ids=["649def34f8be52c8b66281af98ae884c09aef38b", "ARXIV:2106.15928"],
    fields="title,authors,year,citations"
)

# Get details for multiple authors
authors = await author_batch_details(
    context,
    author_ids=["1741101", "1780531"],
    fields="name,hIndex,citationCount,paperCount"
)

Error Handling

The server provides standardized error responses:

{
    "error": {
        "type": "error_type",  // rate_limit, api_error, validation, timeout
        "message": "Error description",
        "details": {
            // Additional context
            "authenticated": true/false  // Indicates if request was authenticated
        }
    }
}