Skip to main content

psrmcp

English | 简体中文

An MCP (Model Context Protocol) server wrapping the pulsar astronomy software stack (dspsr / psrchive / tempo2 / psrcat / PINT): task-oriented tools, controlled parameters, structured results, and full provenance.

Repositories: https://gitlab.com/zhangyazhou416/psrmcp · https://github.com/zhangyazhou416/psrmcp

Why psrmcp?

Same question — "How many pulsars have P < 5 ms and DM > 200 pc cm⁻³?" — asked to a general-purpose LLM with web search, and to Claude Code connected to psrmcp:

General LLM (web search) Claude Code + psrmcp
Answer "no exact number available" — and a suggestion to go query the ATNF catalogue yourself 54 — computed from the local catalogue, full result set, no truncation
Basis Anecdotes scattered across papers and web pages A live catalogue query executed at answer time
Follow-up value — Breakdown by population (32 in Terzan 5, 9 from galactic-plane surveys…), extremes (fastest 1.4 ms, DM up to 540), astrophysical interpretation
General LLM (web search) Claude Code + psrmcp
DeepSeek: cannot give an exact number, suggests querying ATNF yourself psrmcp: 54 pulsars, with population breakdown and extremes

The difference is not model intelligence — it is where the answer comes from: recalled from training data (frozen, unverifiable, wrong for anything off the beaten track) versus computed from the live catalogue through a contract-tested tool, with the domain CLI knowledge (flags, column names, file formats) already encoded.

Quick start

Install from PyPI

pip install psrmcp        # library + the psrmcp CLI entry point
# standalone CLI instead: uv tool install psrmcp  /  pipx install psrmcp

psrmcp --init-config ~/.psrmcp.toml
PSRMCP_CONFIG=~/.psrmcp.toml psrmcp

The pulsar software stack is installed separately (below); without it the server still starts and reports missing backends.

Run from source

# 1. Install the pulsar software stack (optional; without it the server degrades
#    gracefully and reports each missing backend via pulsar_environment)
bash scripts/install_pulsar_stack.sh          # add --with-presto to also build PRESTO

# 2. Set up the MCP server environment
uv sync

# 3. Generate a default config and start (stdio)
uv run psrmcp --init-config ~/.psrmcp.toml
PSRMCP_CONFIG=~/.psrmcp.toml uv run psrmcp

Connect an MCP client (e.g. Claude Code / Claude Desktop)

{
  "mcpServers": {
    "psrmcp": {
      "command": "uv",
      "args": ["--directory", "/path/to/psrmcp", "run", "psrmcp"],
      "env": {"PSRMCP_CONFIG": "~/.psrmcp.toml"}
    }
  }
}

Installed from PyPI, the entry point is simply "command": "psrmcp".

Development

uv run pytest -q                                  # unit tests (no backends required)
PSRMCP_CONTRACT=1 uv run pytest tests/contract    # contract tests (needs the installed stack)

Publishing to PyPI

Automatic via CI (PyPI Trusted Publishing / OIDC — no long-lived tokens): .github/workflows/publish.yml is the primary channel, .gitlab-ci.yml kept as a fallback.

git tag v0.1.0 && git push origin v0.1.0    # a tag triggers build & upload (keep tag in sync with version)

One-time setup: register a pending publisher on pypi.org (Owner zhangyazhou416, Repository psrmcp, Workflow publish.yml) — see the workflow file header for details. Manual publishing: uv build && uv publish.

Status

v0.1.0 — MVP (Phase 0–2): environment introspection, data discovery, catalog queries, archive inspect/convert/merge, dedispersion, RFI, standard profiles, TOA extraction, PINT timing fits and diagnostics.

License

MIT

Metadata

Release files for psrmcp 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psrmcp 0.1.5
File Size Uploaded Provenance Actions
psrmcp-0.1.5.tar.gz 703.5 kB With provenance Details for psrmcp-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psrmcp 0.1.5
File Interpreter ABI Platform Actions
psrmcp-0.1.5-py3-none-any.whl Python 3 none any Details for psrmcp-0.1.5-py3-none-any.whl

Total release size: 838.1 kB

Release files / psrmcp-0.1.5.tar.gz

Download URL psrmcp-0.1.5.tar.gz
Size 703.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f3c4534dee1bcab7a0eb3ce349725e97a8bb8a2226ca8e0bd6fd5fe6adad9d37
BLAKE2b-256 checksum
How to use checksums
76af7868a33c2602f36ef623f0705881429e221e4a4f737d9ee54b0c7e4d7bcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / psrmcp-0.1.5-py3-none-any.whl

Download URL psrmcp-0.1.5-py3-none-any.whl
Size 134.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce833fc8393d000286c27b8da453e87cb72e0e3922ceef89c624e429472e36cf
BLAKE2b-256 checksum
How to use checksums
38d442792bb9eccd8acc5ada76a950c9e314ca1e3facb72e4dece35f093c4b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for psrmcp 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for psrmcp-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page