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

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.3
File Size Uploaded Provenance Actions
psrmcp-0.1.3.tar.gz 649.0 kB With provenance Details for psrmcp-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 756.9 kB

Release files / psrmcp-0.1.3.tar.gz

Download URL psrmcp-0.1.3.tar.gz
Size 649.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8e6d750624f45b734c3edac998c08bbc3c2c4ae486ae39b3aec841a0035857cb
BLAKE2b-256 checksum
How to use checksums
c507b41aa8cefe1accec88cbd17a7832d8385c234db45c0ef4ab90d3b82cf301
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 12, 2026.

Transparency log

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

Download URL psrmcp-0.1.3-py3-none-any.whl
Size 107.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0f6e608d6a8016fec0fdd85f642254840292dc832ba593a45085902ae1b2b86
BLAKE2b-256 checksum
How to use checksums
6b6d73ce693875f4c140d5b4efbafe3683ca959f41481c8fd06071b4d1f5d828
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 12, 2026.

Transparency log

Security for psrmcp 0.1.3

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.3.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 12, 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