Metadata-Version: 2.4
Name: criterium-mcp
Version: 0.1.2
Summary: MCP Server for multi-criteria decision analysis (AHP, TOPSIS, Sensitivity, Decision Trees)
Author-email: Yohann <yohann@example.com>
License: MIT
Requires-Python: >=3.10
Requires-Dist: mcp[cli]>=1.6.0
Requires-Dist: numpy>=1.24.0
Description-Content-Type: text/markdown

# criterium-mcp

**Multi-criteria decision analysis tools** for LLM agents via the Model Context Protocol (MCP).

Provides four complementary methods that share the same data model (criteria weights + alternative scores), letting the LLM orchestrate cross-validation:

| Method | What it does |
|---|---|
| **AHP** | Pairwise comparison → priority weights + consistency ratio (CR) |
| **TOPSIS** | Distance-to-ideal ranking (Euclidean in weighted space) |
| **Sensitivity** | Weight perturbation to find critical ranking transitions |
| **Decision Tree** | Sequential decisions with multi-criteria leaf outcomes |

## Quick start

```bash
# Install from PyPI
uv tool install criterium-mcp

# Or run directly
uvx criterium-mcp
```

## MCP configuration

Add to your MCP client config (e.g. `claude_desktop_config.json`, `roo-code.json`, etc.):

```json
{
  "mcpServers": {
    "criterium": {
      "command": "uvx",
      "args": ["criterium-mcp"]
    }
  }
}
```

## Tools

### `get_saaty_scale()`
Returns the Saaty 1-9 scale reference table for pairwise comparisons.

### `compute_ahp_weights(pairwise_matrix)`
Computes priority weights from an n×n pairwise comparison matrix using Saaty's eigenvector method. Reports:

- **Weights**: normalized priority vector (sum = 1)
- **λ_max**: principal eigenvalue
- **CI**: consistency index
- **CR**: consistency ratio (Saaty's RI table included)
- **Consistent?**: CR < 0.10 verdict

### `score_alternatives_ahp(weights, criteria_minimize, alternatives)`
Scores and ranks alternatives using AHP weights with min-max normalization. Handles both maximize and minimize criteria (e.g. "cost" → minimize, "quality" → maximize).

### `evaluate_topsis(weights, criteria_minimize, alternatives)`
TOPSIS ranking: finds the alternative closest to the ideal solution and farthest from the nadir. Provides an alternative perspective to the AHP weighted sum — if both methods agree, the decision is more robust.

### `sensitivity_analysis(base_weights, criteria_minimize, alternatives, steps=20)`
Systematically varies each criterion weight from 0 to 1 and tracks ranking changes. Reports critical weight thresholds where the top alternative flips — essential for identifying fragile recommendations.

### `evaluate_decision_tree(tree, weights, criteria_minimize)`
Evaluates a sequential decision tree where leaf outcomes are multi-criteria score vectors. Three node types:

- **decision**: you choose (maximize utility)
- **chance**: nature chooses (expected utility with probabilities)
- **leaf**: terminal outcome with per-criterion scores

Returns the optimal path and the full tree annotated with utilities at every node.

## Development

```bash
git clone https://github.com/yohann/criterium-mcp
cd criterium-mcp
uv venv
source .venv/bin/activate
uv pip install -e .
criterium
```

## License

MIT
