Skip to content

MCP (Model Context Protocol)

Install

pip install scopebound

Integration

from scopebound import ScopeboundSDK
from scopebound.adapters.mcp import mcp_hook

sb = ScopeboundSDK()
hook = mcp_hook(sb, role="invoice-processor")

# Sync MCP server
@server.pre_call
def enforce(tool_name: str, arguments: dict) -> None:
    hook(tool_name, arguments)

# Async MCP server
@server.pre_call
async def enforce(tool_name: str, arguments: dict) -> None:
    await hook.async_call(tool_name, arguments)

Direct endpoint

You can also call the MCP enforcement endpoint directly:

curl -X POST https://your-partner.api.scopebound.ai/v1/mcp/enforce \
  -H "X-Scopebound-API-Key: sb-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jwt": "your-session-jwt",
    "tool_name": "read_invoices",
    "arguments": {"status": "pending"}
  }'

Deny behaviour

On deny, mcp_hook raises ScopeboundDenyError. Your MCP server should catch this and return an appropriate error response to the agent.