MCP Server
Use AFA as a tool inside Claude Code, Cursor, and other MCP-compatible IDEs.
MCP Server
AFA ships an MCP (Model Context Protocol) server that exposes analysis and enhancement as tools for AI-powered IDEs.
Start the server
afa serve --transport stdioThe server communicates over stdio, which is the standard transport for MCP in IDE integrations.
IDE integration
Claude Code
Add AFA as an MCP server in your Claude Code configuration:
{
"mcpServers": {
"afa": {
"command": "afa",
"args": ["serve", "--transport", "stdio"]
}
}
}Once configured, Claude Code can invoke AFA tools directly during conversations.
Cursor
Add to your Cursor MCP settings (.cursor/mcp.json):
{
"mcpServers": {
"afa": {
"command": "afa",
"args": ["serve", "--transport", "stdio"]
}
}
}Available tools
| Tool | Description |
|---|---|
afa_analyze | Analyze a code snippet or file for security, performance, maintainability, and documentation issues |
afa_enhance | Generate an enhancement candidate and evaluate it through all nine gates |
afa_gate_check | Evaluate a set of metrics against the gate engine |
Available resources
| Resource | Description |
|---|---|
afa://status | Current AFA configuration and status |
afa://history | Recent audit trail entries |
Example usage in Claude Code
Once configured, you can ask Claude Code to use AFA:
"Analyze this function with AFA and tell me what it found."
"Run an AFA enhancement on utils.py in dry-run mode."
"Check if these metrics would pass AFA's gates."
The IDE agent will invoke the appropriate MCP tool and present the results inline.
Requirements
- AFA must be installed and available on your PATH
- An LLM API key must be set (ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY)
- Developer tier or above for full MCP server access (Community tier does not include
mcp_serverfeature)
HTTP transport
For non-IDE integrations, you can also run the MCP server over HTTP:
afa serve --transport http --port 8080This starts a FastAPI server with both REST API endpoints and MCP protocol support. See REST API for endpoint documentation.