Configuration
The server is configured through the Config
dataclass. At startup it is built with from_env(),
so every setting has a sensible default and can be overridden with an
environment variable. No configuration files are required.
See the full class reference at arxiv_query_mcp.config.Config.
Setting environment variables
Set variables in the env block of your MCP client configuration:
{
"mcpServers": {
"arxiv": {
"command": "arxiv-query-mcp",
"env": {
"ARXIV_MCP_CACHE_DIR": "/data/arxiv-cache",
"ARXIV_MCP_L2_TTL": "86400"
}
}
}
}
Numeric values that cannot be parsed stop the server at startup with an error
that names the offending variable. Boolean switches are false for 0,
false, no and off (case-insensitive) and true for anything else.
Connection and output
Environment variable |
Default |
Description |
|---|---|---|
|
|
Official arXiv Atom API endpoint |
|
|
Seconds before an HTTP request times out |
|
|
Characters per page returned by arxiv_fetch_paper_text |
|
|
Largest PDF parsed when a paper has no HTML version; |
|
|
|
Environment variable |
Default |
Description |
|---|---|---|
|
GitHub raw URL of the bundled |
URL of the agent skill, advertised to clients in the server instructions (see Agent skill). Set to an empty string to disable the notice. |
|
(empty) |
Semantic Scholar API key for arxiv_related_papers. Without one, requests share the public quota and are throttled more often. |
|
|
Minimum seconds between Semantic Scholar requests, across all server processes |
|
|
Semantic Scholar API base URL |
The URL prefixes arxiv_abs_base, arxiv_html_base and arxiv_pdf_base
(https://arxiv.org/abs, /html and /pdf) are fixed defaults and have
no environment variable.
Caching
Environment variable |
Default |
Description |
|---|---|---|
|
|
Set to |
|
platform cache dir |
Directory of the on-disk cache; empty means the user cache directory
from |
|
|
Seconds an entry stays in the in-memory cache |
|
|
Seconds an entry stays in the on-disk cache (4 hours) |
|
|
Seconds empty or not-found results are cached |
|
|
Maximum entries in the in-memory cache (least recently used evicted) |
Rate limiting and retries
Environment variable |
Default |
Description |
|---|---|---|
|
|
Set to |
|
|
Minimum seconds between arXiv requests, shared by all server processes using the same cache directory |
|
|
Maximum simultaneous requests per process |
|
|
Attempts per request before the error is returned |
|
|
Initial retry back-off in seconds (doubles with each attempt) |
|
|
Upper bound for a single retry wait, including |
Warning
arXiv asks API clients to make no more than one request every three
seconds. Lowering ARXIV_MCP_RATE_LIMIT_PERIOD below the default risks
being blocked.
Agent skill
The package ships an agent skill,
src/arxiv_query_mcp/skills/arxiv-query-mcp/SKILL.md, that
explains when and how to use the tools: query syntax, search strategy,
pagination, and error handling. The server advertises its URL in the MCP server
instructions, which clients show to the agent when it connects, for example:
Agent skill: a SKILL.md with guidance on when and how to use these tools is
available at https://raw.githubusercontent.com/.../SKILL.md. If your client
supports skills or can fetch URLs, read it before your first call.
Point ARXIV_MCP_SKILL_URL at your own copy to customise the guidance, or set
it to an empty string to remove the notice. Run arxiv-query-mcp setup (or
arxiv-query-mcp install-skill) to download it into
~/.claude/skills/arxiv-query-mcp/; if the download fails the bundled copy is
installed instead.
Programmatic configuration
Config is a frozen dataclass. To override defaults in code, instantiate it
with explicit values in a custom server entry point:
from arxiv_query_mcp.config import Config
from arxiv_query_mcp import server
# Increase timeout and fetch limit, keep everything else at the defaults
server.config = Config(request_timeout=60.0, max_fetch_chars=20_000)
Assign server.config before the server starts, because the cache and rate
limiter are created from it in the server lifespan.