Skip to main content
Glama
README.md
# mcp-rpn

> MCP server that exposes an RPN calculator

[![PyPI](https://img.shields.io/pypi/v/mcp-rpn.svg)](https://pypi.org/project/mcp-rpn/)
[![Python](https://img.shields.io/pypi/pyversions/mcp-rpn.svg)](https://pypi.org/project/mcp-rpn/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](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

A3.9/5.0

Scored across 2 tools

Disambiguation4/5

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.

Naming Consistency5/5

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.

Tool Count3/5

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.

Completeness4/5

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.

Maintenance

ActivityInactive
ResponsivenessNo issues