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.2

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.2
File Size Uploaded Provenance Actions
psrmcp-0.1.2.tar.gz 613.5 kB With provenance Details for psrmcp-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 699.3 kB

Release files / psrmcp-0.1.2.tar.gz

Download URL psrmcp-0.1.2.tar.gz
Size 613.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e86655dc844605784d4101a5a2dc119cc984129136cd79b368b7d045ef81efb7
BLAKE2b-256 checksum
How to use checksums
a71bbaadd15d89dcdb3f93d57310c433d694a3410db9b685fa74e423e4ac18a0
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 7, 2026.

Transparency log

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

Download URL psrmcp-0.1.2-py3-none-any.whl
Size 85.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20fff6bc4dba3efd046cc47840864306d4c870cb228aec3ae931dd48b8943d0b
BLAKE2b-256 checksum
How to use checksums
c05209557852cbc1208850ba86d642b2168d163aa64406faefb0abda268c0e64
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 7, 2026.

Transparency log

Security for psrmcp 0.1.2

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.2.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 7, 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