Call-owning middleware · PyPI 0.1.0 · Alpha · Apache-2.0
fastmcp-acgs for FastMCP (MCP Server).
Intercepts MCP server tool calls through on_call_tool middleware before and around call_next dispatch, serving any connected MCP client.
Package Specification · Inspected HEAD 853ab3a
- Framework maintainer
- Prefect · gofastmcp.com
- Upstream repository
- PrefectHQ/fastmcp
- PyPI release
- fastmcp-acgs==0.1.0
- Python requirement
- >=3.10
- Framework constraint
- fastmcp-slim[server]>=4.1.0,<5
- Governance engine pin
- acgs-lite>=3.0.1,<4
- Integration mechanic
- Call-owning middleware (wraps tool call)
- Hook entry point
- ACGSMiddleware.on_call_tool
01 · Local Setup & Quickstart
Attach governance to one tool-calling agent.
Install the pinned release from PyPI alongside acgs-lite>=3.0.1,<4. Rule evaluation uses deterministic keyword and regex matching locally in Python—no external model or network call is made by the governance check.
Shell · PyPI installation
pip install "fastmcp-acgs==0.1.0"Python · FastMCP (MCP Server) integration
src/fastmcp_acgs/middleware.py#L92from fastmcp import FastMCP
from fastmcp_acgs import ACGSMiddleware
mcp = FastMCP("support", middleware=[ACGSMiddleware()])
@mcp.tool
def send_email(to: str, body: str) -> str:
"""Send an email."""
return f"sent to {to}"02 · Verdict & Review Mapping
How ACGS-Lite verdicts map to FastMCP (MCP Server).
When a tool call is proposed, the adapter formats the tool name and arguments via format_tool_call and evaluates them against the configured Constitution. Blocking rules always take precedence over review rules.
Calls matching no blocking or review rules pass through to call_next(context) unchanged.
Blocking rule violations or evaluation exceptions raise fastmcp.exceptions.ToolError before the tool executes.
Denied by default; with on_review='elicit', requests MCP client elicitation approval before running the tool.
03 · Public API Surface
Exported symbols and source entry points.
Each adapter keeps its public surface minimal and re-exports the shared GovernanceDecision, Verdict, and ToolCallFormatter types alongside the framework-specific hook or middleware class.
__all__ exports · fastmcp-acgs
src/fastmcp_acgs/middleware.py#L92 ↗ACGSMiddlewareOnReviewREVIEW_INPUT_KEYGovernanceDecisionToolCallFormatterVerdictformat_tool_callPrimary hook surface: ACGSMiddleware.on_call_tool. Custom ToolCallFormatter functions may be supplied if your tool arguments require custom canonical serialization before rule matching.
04 · Scope & Bypass Boundaries
What this adapter does and does not cover.
Verify these framework-specific boundaries when integrating fastmcp-acgs into an evaluation workflow.
- 01
Place ACGSMiddleware last in the middleware list so it inspects the final arguments right before tool execution.
- 02
Governs MCP tool calls arriving at the server; direct Python calls to the underlying function bypass MCP middleware.
- 03
Evaluates acgs-lite keyword/regex rules; does not mint SignedReceipt, ExecutionGrant, or EffectStore reservations.
- 04
In the current
0.1.xadapter series, rule evaluation runs throughacgs-lite'sToolCallGovernorpath. If your workflow requiresSignedReceipt,ExecutionGrant, or SQLiteEffectStorereservations, wire those contracts explicitly at the tool executor boundary.
Put one real workflow under your control.
Choose one tool. Define what it may do. Inspect what happens when a request crosses the boundary.