Skip to main content

citadel-predict-mcp

Python Versions License: MIT

Model Context Protocol (MCP) server for Citadel Predict pre-execution AI agent cost estimation.

citadel-predict-mcp connects your hosted Citadel Predict API directly into Claude Desktop and Claude Code via a local standard I/O (stdio) MCP server.

With this server configured, Claude can natively estimate token usage ranges ($low, expected, high$) and flag out-of-distribution risks for autonomous workflows before running them—without requiring manual CLI execution.


Features

  • Native Claude Tool Calling: Claude automatically decides when to call estimate_agent_cost when planning or dispatching tasks.
  • 🔒 Zero Network Exposure: Runs strictly as a local stdio subprocess spawned by Claude Desktop / Claude Code.
  • 🎯 Pre-Execution Guardrails: Predicts token consumption bounds before multi-step tools or reasoning loops execute.
  • 🛡️ User-Friendly Error Handling: Catches authentication, rate-limiting, and validation issues, presenting clear, actionable suggestions to Claude rather than raw stack traces.

Installation

Install the package via pip:

pip install citadel-predict-mcp

(For local development from the repository root: pip install -e packages/citadel-predict-mcp)

Verifying installation:

citadel-predict-mcp --help

Quickstart: One-Command Auto-Configuration (Recommended)

To automatically configure both Claude Desktop and Claude Code on Windows, macOS, or Linux with zero manual JSON editing:

# Run from repository root with your active Python environment:
python scripts/configure_mcp.py

# Or pass parameters non-interactively:
python scripts/configure_mcp.py --api-key cp_live_your_key_here --api-url http://localhost:8000

The script automatically detects your active virtual environment, locates the platform-specific executable (citadel-predict-mcp.exe on Windows or citadel-predict-mcp on macOS/Linux), and cleanly merges the server definition into both claude_desktop_config.json and .claude/settings.json while preserving all existing configurations.


Manual Configuration (Alternative)

If you prefer to configure manually:

1. Claude Desktop (claude_desktop_config.json)

Operating System Exact Configuration File Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

Add citadel-predict under mcpServers:

{
  "mcpServers": {
    "citadel-predict": {
      "command": "citadel-predict-mcp",
      "env": {
        "CITADEL_API_KEY": "cp_live_your_api_key_here",
        "CITADEL_API_URL": "http://localhost:8000"
      }
    }
  }
}

2. Claude Code (.claude/settings.json)

claude mcp add citadel-predict -- citadel-predict-mcp

Available Tools

estimate_agent_cost

Description:

Estimate token cost and usage range for an AI agent task BEFORE running it. Use this when the user is about to execute, dispatch, or run a multi-step agent task and cost/budget matters.

Input Parameters:

  • task_text (string, required): The natural language description of the agent task (1 to 4000 characters).
  • tools (array of strings, optional): List of tool names available to the agent (e.g. ["web_search", "draft_document"]).
  • num_tools (integer, optional): Tool count if specific tool names are not listed.
  • model_id (string, optional, default: "claude-sonnet"): Model calibration profile to evaluate against.

Sample Return Payload:

{
  "success": true,
  "model_id": "claude-sonnet",
  "expected_tokens": 3200,
  "low_tokens": 1500,
  "high_tokens": 5800,
  "out_of_distribution": false,
  "ood_reasons": [],
  "confidence": "normal",
  "driving_factors": ["task_length", "tools_count"],
  "summary": "Expected: 3,200 tokens (Range: 1,500 – 5,800)"
}

Manual Test Checklist for Testers

Follow this 5-minute checklist to verify your MCP setup:

  1. Installation:
    • Run citadel-predict-mcp --help in your terminal to verify the command is accessible on your PATH.
  2. Configuration:
    • Add the JSON entry to claude_desktop_config.json with your active Citadel API key.
  3. Restart:
    • Fully quit and reopen Claude Desktop.
  4. Invocation Test:
    • Send the following prompt in a new Claude Desktop chat:

      "I am planning to have an agent research competitor pricing across 5 company sites and compile a markdown report. Estimate the token cost and budget range before we start."

  5. Verification:
    • Confirm Claude invokes the estimate_agent_cost tool (indicated by a tool-call widget in the conversation).
    • Confirm Claude receives the token ranges (expected_tokens, low_tokens, high_tokens) and presents a natural language summary with the budget estimate to you.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

citadel_predict_mcp-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

citadel_predict_mcp-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file citadel_predict_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: citadel_predict_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for citadel_predict_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a2c4624a9435ffdc477f0f7bce9e70129907c6ae3c859083e4f36471a212c49
MD5 db19dd6aba17ecc40941b886f26d18fc
BLAKE2b-256 8ba303bef294849328f156322aa20ba5d6b495d69ee4b92f4e7d2150a40e150b

See more details on using hashes here.

File details

Details for the file citadel_predict_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for citadel_predict_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e21398797ddf640402684289bb6540c0db13dc709a29f8d705b45a2f1264c69c
MD5 1241a118d9dac458e4687d8629beae00
BLAKE2b-256 93c0cbe79110ea00e75c0bd1da356a40c8d9542c5533529bd93a4e4d32fe0072

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page