An MCP (Model Context Protocol) server written in Go to interact with the arXiv.org API. It allows any MCP-compatible client (Claude Desktop, MCP-enabled IDEs, AI agents) to search scientific articles, retrieve metadata, and get PDF links directly from arXiv.
Thank you to arXiv for use of its open access interoperability.
βββββββββββββββββββββββ stdio βββββββββββββββββββββββββββ
β MCP Client βββββββββββββββββββββΊβ MCP Server β
β (Claude, IDE, ...) β β cmd/server/main.go β
βββββββββββββββββββββββ ββββββββββββ¬βββββββββββββββ
β
ββββββββββββΌβββββββββββββββ
β Tool Handlers β
β internal/handler/ β
β β
β - export-metadata β
β - export-pdf-url β
ββββββββββββ¬βββββββββββββββ
β
ββββββββββββΌβββββββββββββββ
β HTTP Client β
β internal/http-client/ β
β β
β - Rate limiting (3s) β
β - Retry + backoff β
β - Query builder β
ββββββββββββ¬βββββββββββββββ
β
ββββββββββββΌβββββββββββββββ
β arXiv API β
β export.arxiv.org/api β
ββββββββββββββββββββββββββββ
arxiv-mcp-server/
βββ cmd/
β βββ server/main.go # MCP server entry point
β βββ client/main.go # Test client
βββ internal/
β βββ handler/
β β βββ export.go # Tool handler implementations
β βββ http-client/
β βββ http-client.go # HTTP client with rate limiting and retry
β βββ request.go # Query parameter parsing (reflection-based)
β βββ response.go # Response handling
βββ scripts/
β βββ build.sh # Build script
βββ go.mod
βββ go.sum
MCP Server (cmd/server/main.go) β Initializes the server using go-sdk/mcp, registers the tools, and starts the stdio transport.
Tool Handlers (internal/handler/export.go) β Implement tool logic as closure factories. Each handler receives the HTTP client and returns an MCP-compatible function.
HTTP Client (internal/http-client/) β Configured to respect arXiv API guidelines:
- Rate limiting: 3-second ticker between requests
- Retry with exponential backoff: up to 3 attempts, delay =
2^attempt * 3s - Connection pooling: max 1 idle connection, 90s timeout
- Timeout: 10 seconds per request
Query Builder (internal/http-client/request.go) β Reflection-based system that converts Go structs into query strings for the arXiv API, using query and queryschema struct tags.
Searches arXiv and returns complete metadata as an Atom feed (title, authors, abstract, categories, dates, links).
Searches arXiv and returns direct PDF URLs for matching articles.
Both tools accept the same parameter schema:
| Parameter | Type | Description |
|---|---|---|
id_list |
[]int |
List of specific article IDs |
start |
int |
Start index for pagination |
max_results |
int |
Maximum number of results returned |
search_query |
object |
Search filters (see below) |
Search filters (search_query):
| Field | API tag | Description |
|---|---|---|
Title |
ti |
Article title |
Author |
au |
Author name |
Abstract |
abs |
Abstract content |
Comment |
co |
Article comments |
JournalReference |
jr |
Journal reference |
SubjectCategory |
cat |
Subject category (e.g. cs.AI, math.CO, physics.optics) |
ReportNumber |
rn |
Report number |
All |
all |
Search across all fields |
When multiple filters are specified, they are combined with the AND operator.
- Go >= 1.24.0
# Build the server
./scripts/build.sh server
# Build the test client
./scripts/build.sh clientThis generates a server.exe (or client.exe) executable in the project root.
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"arxiv": {
"command": "/absolute/path/to/server.exe"
}
}
}Or, without compiling, run directly from source:
{
"mcpServers": {
"arxiv": {
"command": "go",
"args": ["run", "./cmd/server"],
"cwd": "/absolute/path/to/arxiv-mcp-server"
}
}
}Any MCP-compatible client that supports stdio transport can use this server. The server communicates via stdin/stdout following the MCP standard.
# Start the server (communicates via stdio)
./server.exeBelow are practical examples of how an LLM or AI agent can leverage this MCP server.
"Search for the article 'Attention Is All You Need' on arXiv and show me its metadata"
The client invokes export-metadata with:
{
"max_results": 1,
"search_query": { "Title": "Attention is all you need" }
}"Give me the 10 most recent articles in the cs.AI category"
{
"max_results": 10,
"search_query": { "SubjectCategory": "cs.AI" }
}"Find all articles by Yann LeCun on arXiv"
{
"max_results": 20,
"search_query": { "Author": "Yann LeCun" }
}"Get me the PDF link for the BERT paper"
The client invokes export-pdf-url with:
{
"max_results": 1,
"search_query": { "Title": "BERT Pre-training of Deep Bidirectional Transformers" }
}"Search for machine learning articles in the bioinformatics field"
{
"max_results": 5,
"search_query": {
"SubjectCategory": "q-bio",
"All": "machine learning"
}
}"Show me results 10 through 20 for 'quantum computing'"
{
"start": 10,
"max_results": 10,
"search_query": { "All": "quantum computing" }
}"Do a literature review on transformers applied to computer vision, show me titles and abstracts of the first 15 articles"
The AI agent invokes export-metadata with the appropriate parameters and then synthesizes the results for the user.
"Search for the most recent articles published in Physical Review Letters"
{
"max_results": 10,
"search_query": { "JournalReference": "Physical Review Letters" }
}-
[π΄]
export-bibtextool: add a tool that returns citations in BibTeX format, useful for LaTeX integration and bibliography management tools. -
[π΄]
get-article-by-idtool: a dedicated tool to retrieve a single article by its arXiv ID (e.g.2106.09685), without going through search. -
[π΄]
search-similartool: given an article ID, find related articles based on category and abstract keywords. -
[π ] Support OR and ANDNOT operators in queries: currently search filters are combined with
ANDonly. Add support for more complex boolean operators. -
[π ] Response caching: implement an in-memory (or on-disk) cache to avoid duplicate API requests and reduce latency.
-
[π‘] Structured logging: replace
log.Fatalwith a structured logger (e.g.slog) with configurable levels, useful for debugging and production monitoring. -
[π‘] Dockerfile: add a Dockerfile to simplify deployment and integration in containerized environments.
-
[π‘] OpenAPI/JSON Schema documentation: automatically generate tool parameter documentation from the
queryschemastruct tags. -
[π‘] Graceful shutdown handling: intercept OS signals (SIGINT, SIGTERM) to properly close connections and release resources.
-
[π’] External configuration: allow configuring the base URL, timeout, rate limit, and retry via environment variables or a configuration file.
-
[π’] Unit and integration tests: add a test suite for handlers, the HTTP client, and parameter parsing. Use HTTP mocks for unit tests and integration tests against the real API.
See LICENSE file.
This project uses the arXiv API and the Go MCP SDK.