Black-Scholes MCP Server
This project provides a Model Context Protocol (MCP) server for calculating the price and Greeks of European options using the Black-Scholes model.
Features
Calculate the Black-Scholes price for European call and put options
Compute option Greeks and higher-order Greeks:
Delta
Vega
Theta
Gamma
Rho
Lambda
Epsilon
Vanna
Charm
Vomma
Veta
Speed
Zomma
Color
Ultima
Vera
Related MCP server: Calculator MCP Server
Usage
Installation and Usage
Install dependencies (if using
uv):uv pip install -r requirements.txtOr use your preferred Python package manager.
Install this MCP server to Claude:
uv run mcp install main.pyThis command will add the configuration to
claude_desktop_config.jsonso that Claude can use this MCP server.(Optional) Run the MCP server directly:
python main.pyUse the MCP tools to calculate option prices and Greeks by providing the following arguments:
S: Spot priceK: Strike priceT: Time to maturity (in years)r: Risk-free rate (annual, decimal)q: Dividend yield (annual, decimal)vol: Volatility (annual, decimal)type: "call" or "put"
Running Tests
To run the tests for this project:
Install the package in development mode:
pip install -e .Run tests using unittest:
python -m unittest discover -s testsOr with pytest (after installing pytest from requirements.txt):
python -m pytestTo run specific test modules:
python -m unittest tests.calculators.test_black_scholes_priceOr with pytest:
python -m pytest tests/calculators/test_black_scholes_price.py
Acknowledgements
This project uses the modelcontextprotocol/python-sdk for MCP server implementation.
License
This project is licensed under the MIT License. See LICENSE for details.