Skip to content

MCP Server

stone edited this page Nov 13, 2026 · 4 revisions

MCP server

stkcraft-mcp exposes the crate's conversions to an agent through the Model Context Protocol. It is a small stdio server: newline-delimited JSON-RPC 2.0 on stdin/stdout, logs on stderr.

Build and run:

cargo build --release --features mcp --bin stkcraft-mcp
cargo install stkcraft-time --features mcp --bin stkcraft-mcp

Client configuration

{
  "mcpServers": {
    "stkcraft-time": {
      "command": "/absolute/path/to/stkcraft-mcp",
      "args": []
    }
  }
}

During development, cargo run --release works as well:

{
  "mcpServers": {
    "stkcraft-time": {
      "command": "cargo",
      "args": [
        "run", "--release", "--features", "mcp",
        "--bin", "stkcraft-mcp",
        "--manifest-path", "/absolute/path/to/STKCraft-time/Cargo.toml"
      ]
    }
  }
}

Tools

The table below is synchronized with the 0.2.1 repository guide. The wgc_* GPS and calendar tools accept an optional lsk_path; the legacy tai_to_gps and gps_to_tai tools do not. tools/list exposes the actual schemas supported by the running server.

Tool Required arguments Returns
lsk_info — (lsk_path optional) Coverage dates/JDNs, entries, source and policy.
delta_at jdn, or year/month/day TAI - UTC in whole seconds.
utc_to_tai UTC fields TAI seconds, sec/nanos, ISO 8601.
tai_to_utc tai_seconds, or sec + nanos Civil UTC fields and ISO 8601.
utc_to_et UTC fields NAIF ET.
et_to_utc et Civil UTC fields and ISO 8601.
tai_to_tt tai_seconds, or sec + nanos TT seconds past J2000 TT.
tai_to_gps tai_seconds, or sec + nanos GPS seconds past the GPS epoch.
gps_to_tai gps_seconds TAI epoch.
wgc_week_tow_to_et week_tow, optional lsk_path Checked ET for a WGC GPS week/TOW string.
wgc_gps_seconds_to_et gps_seconds, optional lsk_path Checked ET for finite GPS seconds past GPS zero.
wgc_et_to_gps_seconds et, optional lsk_path WGC's six-decimal numeric GPS seconds display cell.
wgc_gps_seconds_to_week_tow gps_seconds, optional lsk_path WGC's six-decimal GPS week/TOW display.
wgc_et_to_calendar et, system, format, optional lsk_path WGC-style six-decimal ymd or doy calendar string.
utc_to_ut1 UTC fields, eop_path UT1 seconds past 2000-01-01T00:00:00 UT1.
ut1_to_utc ut1_seconds, eop_path Civil UTC fields and ISO 8601.
sclk_to_et sclk_path, spacecraft_id, and ticks or clock_string Ticks, optional fields, ET and TAI.
et_to_sclk sclk_path, spacecraft_id, et Ticks, optional fields and clock string.
format_utc UTC fields, optional kind, precision, pattern, calendar, lsk_path Formatted string.
etcal et, optional precision SPICE calendar string.

WGC display cells are rounded and are not lossless epoch values. Consult the MCP guide for kernel selection, error handling and complete examples.

Example: utc_to_et

Request:

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
  "name":"utc_to_et",
  "arguments":{"year":2016,"month":12,"day":31,"hour":23,"minute":59,"second":60.5}
}}

Response (content is a JSON string inside text):

{
  "et": 536500868.6839298,
  "utc": {
    "year": 2016, "month": 12, "day": 31,
    "hour": 23, "minute": 59, "second": 60.5,
    "iso8601": "2016-12-31T23:59:60.500000000Z"
  }
}

Protocol behaviour

Aspect Behaviour
Protocol version always advertises 2024-11-05
Invalid request JSON-RPC error -32600 (including a missing method)
Unknown method JSON-RPC error
Tool failure result with isError: true and the error text
Message size limited to 1 MiB
Panics isolated per request with catch_unwind; the server stays up
Transport newline-delimited messages, one per line

The transport is deliberately minimal so it works behind any client that can spawn a process.

Security notes

  • The server reads local paths supplied by the client. Treat lsk_path, sclk_path and eop_path as you would any other file argument.
  • It performs no network I/O and opens no sockets.
  • It writes protocol messages to stdout only; anything else goes to stderr.

Full documentation

The repository guide is docs/MCP.md, including complete schema listings and additional worked examples.

Clone this wiki locally