IntegrationsModel Context Protocol

Model Context Protocol (MCP) Security Proxy

Secure Model Context Protocol JSON-RPC 2.0 tool execution boundaries against prompt injection, unauthorized tool escalation, and data exfiltration using MCPSecurityProxy.

Overview & Zero External Dependencies

MCPSecurityProxy is built directly into sictack. It requires zero external MCP libraries, allowing it to sit transparently between any MCP client (such as Claude Desktop or custom MCP hosts) and MCP tool servers over standard stdio or HTTP SSE transports.

Configuring MCPSecurityProxy

Initialize the proxy with an authenticated SecureAgent and register server tools:

mcp_proxy_setup.py
from sictack import SecureAgent, Config, Policy
from sictack.integrations.mcp import MCPSecurityProxy

# 1. Define deterministic policy
policy = Policy(
    name="mcp-server-policy",
    allowed_permissions=["read_metric"],
    denied_permissions=["drop_schema"],
    require_approval_permissions=["restart_service"],
)

# 2. Initialize SecureAgent
agent = SecureAgent(
    agent_id="mcp-server-agent",
    permissions=["read_metric", "drop_schema", "restart_service"],
    config=Config(default_policy=policy),
)

# 3. Instantiate MCPSecurityProxy
proxy = MCPSecurityProxy(agent=agent, agent_id="mcp-server-agent")

# 4. Register server tools with parameter schemas
def read_system_metric(metric_id: str) -> dict:
    return {"metric": metric_id, "value": 98.4}

def drop_database_schema(schema_name: str) -> str:
    return f"Dropped {schema_name}"

proxy.register_mcp_tool(
    name="read_metric",
    handler=read_system_metric,
    permission="read_metric",
    description="Reads real-time host metric values",
)
proxy.register_mcp_tool(
    name="drop_schema",
    handler=drop_database_schema,
    permission="drop_schema",
    description="Drops database schema",
)

JSON-RPC 2.0 Message Handling

Pass JSON-RPC 2.0 message dictionaries into proxy.handle_jsonrpc(). SICTACK verifies policies and returns standardized MCP responses:

handle_jsonrpc.py
# Processing a standard JSON-RPC tools/call packet
allowed_request = {
    "jsonrpc": "2.0",
    "id": "req-1",
    "method": "tools/call",
    "params": {
        "name": "read_metric",
        "arguments": {"metric_id": "cpu_load"}
    }
}
response = proxy.handle_jsonrpc(allowed_request)
print("Allowed Output:", response)
# -> Allowed Output: {
#      'jsonrpc': '2.0',
#      'id': 'req-1',
#      'result': {
#        'content': [{'type': 'text', 'text': '{"metric": "cpu_load", "value": 98.4}'}],
#        'isError': False,
#        '_sictack': {'verdict': 'ALLOW', 'allowed': True},
#        '_intentlock': {'verdict': 'ALLOW', 'allowed': True}
#      }
#    }

# Processing an unauthorized tools/call packet
denied_request = {
    "jsonrpc": "2.0",
    "id": "req-2",
    "method": "tools/call",
    "params": {
        "name": "drop_schema",
        "arguments": {"schema_name": "production"}
    }
}
denied_response = proxy.handle_jsonrpc(denied_request)
print("Denied Output:", denied_response["result"])
# -> Denied Output: {
#      'content': [{'type': 'text', 'text': "[SICTACK_SECURITY_BLOCK] Tool 'drop_schema' was blocked by security policy."}],
#      'isError': True,
#      '_sictack': {'verdict': 'DENY', 'allowed': False},
#      '_intentlock': {'verdict': 'DENY', 'allowed': False}
#    }

Listing MCP Tools (tools/list)

The proxy responds to standard tools/list requests, exporting tool schemas for LLM context:

tools_list.py
# Listing registered tools in MCP standard format
list_request = {
    "jsonrpc": "2.0",
    "id": "req-3",
    "method": "tools/list",
    "params": {}
}
tools_response = proxy.handle_jsonrpc(list_request)
print("Tools:", tools_response["result"]["tools"])
# -> Tools: [{'name': 'read_metric', 'description': '...', 'inputSchema': {...}}, ...]

Multi-Agent Delegation via MCP Headers

When MCP servers serve requests originating from complex multi-agent swarms, clients can transmit cryptographic delegation tokens in the _meta envelope. MCPSecurityProxy verifies the signature, enforces depth bounds, and accounts for shared execution budgets:

mcp_delegation_proxy.py
from sictack.unified import Sictack
from sictack.integrations.mcp import MCPSecurityProxy

# 1. Initialize unified security manager
security = Sictack(signing_key="mcp-shared-key")

# 2. Bind MCPSecurityProxy to unified security instance
proxy = MCPSecurityProxy(
    security=security,
    agent_id="mcp-worker-agent",
)

proxy.register_mcp_tool(
    name="query_database",
    handler=lambda query: f"Results for: {query}",
    permission="db:query",
)

# 3. Client passes cryptographic delegation token inside _meta or tool parameters
request_with_delegation = {
    "jsonrpc": "2.0",
    "id": "req-delegated-1",
    "method": "tools/call",
    "params": {
        "name": "query_database",
        "arguments": {"query": "SELECT * FROM audit_logs"},
        "_meta": {
            "delegation_token": {
                "delegation_id": "delg_9921a",
                "parent_agent_id": "supervisor-agent",
                "child_agent_id": "mcp-worker-agent",
                "signature": "...",
            }
        }
    }
}

response = proxy.handle_jsonrpc(request_with_delegation)
print("Delegated MCP Response:", response["result"])

Supported Capabilities & Boundaries

MCP MethodSupport StatusSecurity Behavior
tools/callFully EnforcedPolicy verified, action hashed, audit logged.
tools/listSupportedReturns list of registered MCP tools and JSON schemas.
resources/*Out of ScopeResource URI resolution is handled by host transport.
prompts/*Out of ScopePrompt templates belong to client LLM configuration.
Execution Boundary Focus

SICTACK focuses strictly on the execution boundary. In MCP architectures, prompt and resource messages are data transfers; the actual security hazard occurs when a tool is called to enact side effects on host systems.