Skip to content

feat: bundled zero-dependency MCP server - #25

Merged
adiled merged 6 commits into
mainfrom
mcp
Aug 28, 2026
Merged

adiled merged 6 commits into
mainfrom
mcp

Conversation

@adiled

@adiled adiled commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

Adds a bundled, zero-dependency MCP server to the package, plus a README tagline update.

MCP server (ohlc-resample-mcp bin)

  • New ohlc-resample-mcp binary ships inside this same package — install ohlc-resample and get the server for free, no second publish.
  • A thin adapter over the package's own CLI: each tool call builds an argv array and runs runCli in-process with injected streams. It has no resampling/parsing/formatting logic of its own, so every future CLI feature (formats, streaming, Parquet, --map) is inherited with zero maintenance.
  • No @modelcontextprotocol/sdk dependency — MCP is plain JSON-RPC 2.0 over stdio (initialize, tools/list, tools/call, ping), hand-rolled directly. Runtime deps stay just mri + hyparquet.
  • Single file-path tool resample_ohlcv_file: input_path (csv/json/jsonl/ndjson/parquet), base_timeframe, new_timeframe, format, shape, optional map (e.g. CCXT timestamp/amount), optional output_path. File-path-based, so the LLM pays tokens for intent, not payload.

Bug fix

  • Streaming CSV → CSV output previously failed with shaped.join is not a function: IncrementalWriter rendered object-shaped candles as CSV rows without converting to the 6-tuple shape. CSV rows are now always written in array shape regardless of the requested JSON shape.

Tests / docs

  • 11 new MCP tests (exercising dispatch directly) — 111 total passing.
  • README: tagline changed to "Transform, resample, and stream market data at any scale." and a new "MCP server (AI agents)" section.

Why

MCP is the interface for AI agents to drive market-data analysis. The server is agent-facing and file-path-based, and bundling it keeps a single package/release with zero extra maintenance.

This PR is based on main (cherry-picked) and carries only the MCP + README work.

adiled added 6 commits August 27, 2026 23:18
Thin stdio JSON-RPC adapter over the package's own CLI (runCli in-process);
no @modelcontextprotocol/sdk dependency. Single file-path tool
resample_ohlcv_file. Fix streaming CSV->CSV output bug (IncrementalWriter
now always writes array-shape rows). Update README tagline.
…ohlcv_file

- auditOhlcv + AuditReport: single streaming pass validating and describing
  market-data input (records, time range, base timeframe, ordering, duplicate
  timestamps, OHLC integrity, bad values, missing bars)
- CLI --audit prints a JSON trust report instead of resampling; reuses the
  same streaming readers for CSV/JSONL/Parquet
- MCP audit_ohlcv_file tool delegates to the CLI via --audit (zero extra logic)
- Fix double-mapping: readers already apply --map, so auditOhlcv must not
  re-map except for the parquet string-path branch
- Capture CSV header / JSONL shape+schema into the report after streaming
- Tests: __tests__/audit.ts (14 new tests)
@adiled
adiled merged commit 80a0bc2 into main Aug 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant