API ReferenceMCP Integration

MCP Integration

The Model Context Protocol (MCP) server allows AI assistants to interact with ClawNex tools directly during conversations.

Server Details

PropertyValue
Server nameclawnex
Protocol version2024-11-05
Primary transportstdio (JSON-RPC 2.0)
Optional transportHTTP SSE
Default HTTP port5002 (configurable via MCP_PORT)

Starting the Server

Stdio mode:

npx tsx ~/clawnex/src/mcp/server.ts

HTTP SSE mode:

MCP_ENABLED=1 MCP_API_KEY=replace-with-a-long-random-key MCP_PORT=5002 npx tsx ~/clawnex/src/mcp/server.ts

HTTP mode provides:

  • GET /sse — Server-Sent Events stream
  • POST /message — JSON-RPC message endpoint
  • GET /health — health check

HTTP SSE mode requires MCP_API_KEY. Keep the server bound to localhost unless you place it behind your own access controls.

RBAC and MCP

The MCP server is a local operator integration. Keep it bound to localhost unless you place it behind your own access controls. It calls local ClawNex endpoints and should be treated as trusted automation running on the host.

Available Tools

ToolPurpose
shield_scanScan text through the prompt shield
check_postureGet current security posture and service health
query_threatsQuery active threats and alerts
review_auditQuery recent audit events
manage_accessAdd or remove access-control list entries
configure_providerConfigure model-provider settings
generate_reportGenerate a report from ClawNex telemetry
run_shield_testsRun the shield validation suite
run_trust_auditRun trust-audit checks
manage_budgetInspect or manage cost-budget controls

Example: shield_scan

Input: text (required), direction (optional: inbound or outbound)

Verdict: BLOCK | Score: 85
Detections: prompt-injection-override, system-prompt-extraction

Example: check_posture

Input: none

Threat Score: 23 | Posture Score: 82
Services: shield: healthy, proxy: healthy, database: healthy

Client Configuration

Add the server to an MCP-capable client configuration:

{
  "mcpServers": {
    "clawnex": {
      "command": "npx",
      "args": ["tsx", "/path/to/clawnex/src/mcp/server.ts"]
    }
  }
}