MCP Server
Run a Model Context Protocol (MCP) server that gives MCP-capable tools — Claude
Code, Cursor, Codex — direct access to Briefcase operations: sanitize PII,
estimate model cost, analyze output drift, and read the usage guide. The tools
are read-only and wrap briefcase.sanitize, briefcase.cost, and
briefcase.drift.
pip install briefcase-ai[mcp] For: agent runtimes & IDEs
Install
pip install briefcase-ai[mcp]Run It
Start the server over stdio with the console script:
briefcase-mcpOr run the module directly:
python -m briefcase.mcpBuild the Server in Python
build_server() returns a configured FastMCP instance, and main() runs it
over stdio.
from briefcase.mcp import build_server
server = build_server()print(server.name) # -> "briefcase"Register in an MCP Client
Point an MCP-capable client at the briefcase-mcp command. The exact config file
differs per tool, but the shape is the same:
{ "mcpServers": { "briefcase": { "command": "briefcase-mcp" } }}Tools
The server exposes four tools:
| Tool | What it does | Act |
|---|---|---|
sanitize_text | Redact PII from text before it leaves your environment | Capture |
estimate_cost | Estimate the cost of a model call | Operate |
analyze_drift | Check a set of outputs for consistency and drift | Replay & Verify |
how_to | Retrieve Briefcase usage guidance | — |
sanitize_text
Redact PII (emails, phones, SSNs, cards, API keys, IPs) from text. Wraps
briefcase.sanitize.Sanitizer.
| Input | Type |
|---|---|
text | str |
Returns { "sanitized": str, "redactions": list[str] } — the redacted text and
the PII types found.
sanitize_text("Contact me at jordan@example.com or 555-123-4567")-> {"sanitized": "Contact me at [REDACTED_EMAIL] or [REDACTED_PHONE]", "redactions": ["email", "phone"]}estimate_cost
Estimate the USD cost of an LLM call. Wraps briefcase.cost.CostCalculator.
| Input | Type | |
|---|---|---|
model | str | |
input_tokens | int | |
output_tokens | int | |
rate_card | str (optional) | platform × tier pricing, e.g. "bedrock:batch" |
Returns { "model": str, "rate_card": str, "input_cost": float, "output_cost": float, "cache_cost": float, "total_cost": float }.
estimate_cost("claude-haiku-4-5", 1000, 500)-> {"model": "claude-haiku-4-5", "rate_card": "standard", "input_cost": 0.001, "output_cost": 0.0025, "cache_cost": 0.0, "total_cost": 0.0035}analyze_drift
Analyze a list of model outputs for consistency and drift. Wraps
briefcase.drift.DriftCalculator.
| Input | Type |
|---|---|
outputs | list[str] |
Returns { "consistency_score": float, "agreement_rate": float, "consensus_output": str, "status": str }.
analyze_drift(["billing", "billing", "shipping"])-> {"consistency_score": 0.67, "agreement_rate": 0.67, "consensus_output": "billing", "status": "drifting"}how_to
Return Briefcase usage guidance.
| Input | Type |
|---|---|
topic | str (optional) |
Pass a topic keyword (e.g. "export", "sanitize", "cost", "logging") to get
matching sections, or leave it empty for the full guide.
Resource
The server also exposes a resource, briefcase://llms-full.txt, which serves the
bundled Briefcase usage guide for clients that read MCP resources.
Where this fits
These tools surface Briefcase capabilities to any MCP client. To go deeper on what each one does in the full SDK: