Exposes a stateful RPN calculator through MCP with two tools: evaluate and clear. The evaluate tool handles standard arithmetic operators (add, subtract, multiply, divide, power, modulo) plus stack commands like dup, swap, and clear. Stack state persists between calls unless you explicitly clear it. Reach for this when you need Claude to chain multi-step calculations without juggling intermediate results in conversation context. The RPN approach means you can build complex expressions incrementally, useful for financial calculations, unit conversions, or any scenario where you're iteratively computing values. Runs over stdio transport and packages cleanly via pip.
MCP server that exposes an RPN calculator
pip install mcp-rpn
mcp-rpn
The server uses stdio transport for MCP protocol communication.
Evaluate an RPN (Reverse Polish Notation) expression.
{
"name": "evaluate",
"arguments": {
"expression": "3 4 +",
"show_stack": true
}
}
Operators:
+ - Add- - Subtract- - Multiply/ - Divide** - Power% - ModuloCommands:
clear - Clear the stackdup - Duplicate top of stackswap - Swap top two elementsExamples:
3 4 + returns 710 5 2 + * 2 - returns 323 2 / returns 1.5Clear the calculator stack.
{
"name": "clear",
"arguments": {}
}
git clone https://github.com/daedalus/mcp-rpn.git
cd mcp-rpn
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
mcp-name: io.github.daedalus/mcp-rpn