Skip to content

MCP Server

Run a Model Context Protocol (MCP) server that gives MCP-capable tools — Claude Code, Cursor, Codex — direct access to Briefcase AI 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

Terminal window
pip install briefcase-ai[mcp]

Run It

Start the server over stdio with the console script:

Terminal window
briefcase-mcp

Or run the module directly:

Terminal window
python -m briefcase.mcp

Build 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:

ToolWhat it doesAct
sanitize_textRedact PII from text before it leaves your environmentCapture
estimate_costEstimate the cost of a model callOperate
analyze_driftCheck a set of outputs for consistency and driftReplay & Verify
how_toRetrieve Briefcase AI usage guidance

sanitize_text

Redact PII (emails, phones, SSNs, cards, API keys, IPs) from text. Wraps briefcase.sanitize.Sanitizer.

InputType
textstr

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.

InputType
modelstr
input_tokensint
output_tokensint
rate_cardstr (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.

InputType
outputslist[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 AI usage guidance.

InputType
topicstr (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 AI usage guide for clients that read MCP resources.

Limits

The server records nothing. All four tools are stateless calls into the library: nothing is captured, exported, or persisted, and there is no @capture anywhere in the server. Governing your own decisions still means calling the SDK from your code.

mcp>=1.2,<2 is a hard requirement. mcp 2.0 removed mcp.server.fastmcp, and briefcase.mcp raises with the installed version named if it finds an incompatible one. Reinstall with the extra rather than pinning mcp yourself.

stdio only. briefcase-mcp and python -m briefcase.mcp run the server over stdio for a local client. There is no HTTP or SSE transport, so the server runs on the same machine as the client.

Each tool inherits its library’s limits. sanitize_text catches what the regex patterns catch, estimate_cost prices from a bundled table and raises on an unknown model, and analyze_drift scores edit distance with fixed status bands. Read those before acting on a tool result.

API reference

briefcase.mcp has build_server() and main().

Where this fits

These tools surface Briefcase AI capabilities to any MCP client. To go deeper on what each one does in the full SDK:

Next steps