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.1.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.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: citadel_predict_mcp-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f1ab1b303d246ad9b5a7cd4c5f2a94c101219073c64ff9f5b012df4c1bb51f40
MD5 afa18610135fc6cd610e91de987ec37d
BLAKE2b-256 d3a4adbef25d2b4828b7b49fa87cc90c01d492d0ecb431af3306e4bd3d981655

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for citadel_predict_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28139aae52e71c9c91af8f4785b3e779c5c3cc74eb8dd11dcb1d0e36df902685
MD5 005713e4edd69924e0742169f615cb4d
BLAKE2b-256 e63efc264dd784f7d7040a625f3e740ec96c46e529c6197decce90a910b7facf

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1.0

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