Skip to content

MCP Client Setup

The server exposes an MCP endpoint alongside the REST API on the same port. Any MCP-compatible client (Cursor, Continue, Claude, custom agents built on any LLM provider, …) can connect directly without needing the curl-loop agent prompt.


After the server starts, two MCP transports are available under /mcp:

TransportURLProtocol version
SSEhttp://localhost:8000/mcp/sseMCP 2024-11-05 (widely supported)
Streamable HTTPhttp://localhost:8000/mcp/MCP 2025-03-26 (newer clients)

Use SSE unless your client specifically requires Streamable HTTP.


Most MCP-capable tools accept a JSON server list. Add an entry pointing at the SSE endpoint:

{
"mcpServers": {
"terraform-analyzer": {
"url": "http://localhost:8000/mcp/sse"
}
}
}

With API key auth enabled (a member key is sufficient for analysis — see Authentication):

{
"mcpServers": {
"terraform-analyzer": {
"url": "http://localhost:8000/mcp/sse",
"headers": {
"X-API-Key": "your-key-here"
}
}
}
}

Restart the client after editing.


Many CLI tools expose an mcp add command:

Terminal window
# SSE transport (most compatible)
mcp add terraform-analyzer http://localhost:8000/mcp/sse
# With API key
mcp add terraform-analyzer http://localhost:8000/mcp/sse \
--header "X-API-Key: your-key-here"
# List configured servers
mcp list

Refer to your specific client’s documentation for the exact flags.


The mcp.base_url config field controls where FastMCP routes internal tool calls — for a server calling itself, loopback (http://localhost:8000) works and avoids an extra network hop. If you put a reverse proxy or ingress in front of the server for external clients, configure your MCP client with the proxy’s public URL:

{
"mcpServers": {
"opentremor": {
"url": "https://your-host.example.com/mcp/sse"
}
}
}

Set mcp.enabled: false in the config to run REST-only:

mcp:
enabled: false

The fastmcp package must still be installed (it ships with the default image). The endpoint is simply not mounted.


FastMCP generates one tool per REST endpoint (FastMCP.from_fastapi(app)), so the tool surface mirrors the entire REST API — the client-led analysis loop, server-side /analyze, findings triage, org/quota management, and everything else in Endpoints. A representative subset:

Tool (generated name)REST equivalentDescription
get_rulesGET /{analyzer}/rulesFetch security ruleset
ingestPOST /{analyzer}/{namespace}/ingestParse and split a plan (client-led loop)
get_next_resourceGET /{namespace}/resource/nextNext unanalysed resource
submit_analysisPUT /resource/{hash}/analysisStore findings
analyzePOST /{analyzer}/{namespace}/analyzeOne-call server-side analysis (see Server-Side Analysis)
generate_reportGET /{namespace}/reportConsolidated report
get_resourceGET /resource/{hash}Fetch a single resource
dump_namespaceGET /{namespace}/dumpAll resources in namespace
list_analyzersGET /analyzersAvailable analyzers
list_findingsGET /findingsFilter finding triage records
update_finding_statusPATCH /findings/{hash}/{rule_id}Suppress/acknowledge a finding

The LLM uses these tools directly in a conversation — no system prompt or curl commands needed. Every call is still scoped by the caller’s X-API-Key/session exactly as the REST endpoint would be — MCP is a transport, not a separate auth model.