rpn-mcp
# mcp-rpn
> MCP server that exposes an RPN calculator
[](https://pypi.org/project/mcp-rpn/)
[](https://pypi.org/project/mcp-rpn/)
[](https://github.com/astral-sh/ruff)
## Install
```bash
pip install mcp-rpn
```
## Usage
```bash
mcp-rpn
```
The server uses stdio transport for MCP protocol communication.
## MCP Tools
### evaluate
Evaluate an RPN (Reverse Polish Notation) expression.
```json
{
"name": "evaluate",
"arguments": {
"expression": "3 4 +",
"show_stack": true
}
}
```
**Operators:**
- `+` - Add
- `-` - Subtract
- `-` - Multiply
- `/` - Divide
- `**` - Power
- `%` - Modulo
**Commands:**
- `clear` - Clear the stack
- `dup` - Duplicate top of stack
- `swap` - Swap top two elements
**Examples:**
- `3 4 +` returns `7`
- `10 5 2 + * 2 -` returns `32`
- `3 2 /` returns `1.5`
### clear
Clear the calculator stack.
```json
{
"name": "clear",
"arguments": {}
}
```
## Development
```bash
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 Registry
mcp-name: io.github.daedalus/mcp-rpn
TDQS
Scored across 2 tools
The evaluate and clear tools have clearly distinct primary purposes: evaluate processes RPN expressions, while clear resets the stack. However, evaluate also supports a 'clear' command, creating a minor overlap where users might use a command inside an expression instead of the dedicated tool, but descriptions make the distinction clear enough.
Both tool names are simple, lowercase, single-word verbs (evaluate and clear), following a consistent pattern. There is no mixing of conventions, and each name accurately reflects its action.
With only 2 tools, the server feels slightly thin, though the scope is a narrow RPN calculator. The clear tool is somewhat redundant because the evaluate tool already supports a 'clear' command, making the count less justified than if it were a single evaluate tool.
The evaluate tool covers core arithmetic operators and stack manipulation commands (dup, swap), providing a functional surface for an RPN calculator. A minor gap is the lack of a dedicated stack inspection command or tool, but the primary lifecycle of evaluation and clearing is covered.