Skip to content

feat: MCP stdio server for prices and greeks - #30

Closed
CarloLepelaars wants to merge 2 commits into
mainfrom
feat/mcp-server
Closed

feat: MCP stdio server for prices and greeks#30
CarloLepelaars wants to merge 2 commits into
mainfrom
feat/mcp-server

Conversation

@CarloLepelaars

Copy link
Copy Markdown
Owner

Fixes #29.

What

Stdlib MCP server so agents can price every public instrument without writing Python. No extra dependency.

python -m blackscholes.mcp
# or: blackscholes-mcp

Two tools:

  • instruments — kind → constructor params
  • pricekind + market params + fields (price / core / all / method names)

kind is a short name (call, black76_put, straddle_long, …) or the class name. New public classes in __all__ show up automatically.

Why this shape

  • One tool + a catalog covers BSM, Black-76, binary, and all structures.
  • fields maps onto existing methods — no reimplemented greeks.
  • Stdlib JSON-RPC keeps the published package at zero runtime deps (the official mcp SDK is not added).
  • Protocol: newline-delimited JSON-RPC (initialize, initialized, ping, tools/list, tools/call). Empty resources/list / prompts/list for picky hosts. Tool failures return isError: true.

Checks

uv run ruff check
uv run pytest -s --cov=blackscholes.mcp --cov-report=term-missing

91 passed. mcp.py at 100% coverage. Version 0.2.4.

Docs: docs/9.mcp.md, README, AGENTS.md / CLAUDE.md / llms.txt.

Not a release — please review and approve first.

Expose every public class over JSON-RPC stdio via two tools
(instruments, price). Zero extra deps. Fixes #29.
Drop the hand-rolled protocol layer. Explicit KINDS, price() returns
price + core greeks, tests compare to the classes.
@CarloLepelaars

Copy link
Copy Markdown
Owner Author

Scrapping MCP. A formula library is imported from Python; a JSON-RPC server is the wrong product. Closing this PR and dropping the branch.

@CarloLepelaars
CarloLepelaars deleted the feat/mcp-server branch August 19, 2026 13:31
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.

MCP stdio server for pricing and greeks

1 participant