MCP Server
Maina includes an MCP (Model Context Protocol) server that exposes its engines to any MCP-compatible IDE — Claude Code, Cursor, Windsurf, and others.
The install script handles this automatically:
curl -fsSL https://api.mainahq.com/install | bashOr configure manually per tool:
.claude/settings.json (auto-created by maina init):
{"mcpServers":{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}}.cursor/mcp.json or .mcp.json:
{"mcpServers":{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}}~/.codeium/windsurf/mcp_config.json:
{"mcpServers":{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}}.continue/mcpServers/maina.json (auto-discovered):
{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}.roo/mcp.json:
{"mcpServers":{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}}.amazonq/mcp.json:
{"mcpServers":{"maina":{"command":"npx","args":["@mainahq/cli","--mcp"]}}}~/.config/zed/settings.json under context_servers:
{"context_servers":{"maina":{"command":{"path":"npx","args":["@mainahq/cli","--mcp"]},"source":"custom"}}}No plugins, no extensions, no separate server process.
The MCP server exposes 10 tools, each delegating to the appropriate engine:
| Tool | Description | Engine |
|---|---|---|
getContext | Get focused codebase context for a command. Returns context assembled from the relevant layers with token budget applied. | Context |
getConventions | Get the project constitution and conventions. Returns .maina/constitution.md content. | Prompt |
verify | Run the verification pipeline on staged or specified files. Returns findings with severity and location. | Verify |
checkSlop | Check code for AI-generated slop patterns (filler words, hallucinated imports, dead code). | Verify |
reviewCode | Run two-stage review on a diff — spec compliance first, then code quality. | Verify + Prompt |
explainModule | Get a Mermaid dependency diagram for a directory. Visualizes module structure and cross-file references. | Context |
suggestTests | Generate TDD test stubs from a plan.md file. Returns test code with red-green annotations. | Prompt + Context |
analyzeFeature | Check spec/plan/tasks consistency for a feature. Reports mismatches and orphaned artifacts. | Context |
wikiQuery | Search and synthesize answers from codebase wiki. Returns AI-generated answer with source citations. | Context (L5) |
wikiStatus | Wiki health dashboard — article counts, coverage, staleness. | Context |
How It Works
Section titled “How It Works”IDE (Claude Code, Cursor, etc.) | | MCP protocol (JSON-RPC over stdio) | vmaina --mcp | +-- getContext -------> Context Engine (4 layers, dynamic budget) +-- getConventions ---> Prompt Engine (constitution + custom prompts) +-- verify -----------> Verify Engine (full pipeline) +-- checkSlop --------> Verify Engine (slop detector) +-- reviewCode -------> Verify Engine (two-stage review) +-- explainModule ----> Context Engine (semantic layer + tree-sitter) +-- suggestTests -----> Prompt Engine + Context Engine +-- analyzeFeature ---> Context Engine (cross-artifact analysis) +-- wikiQuery -------> Context Engine (L5 wiki layer) +-- wikiStatus ------> Context Engine (wiki health) | +-- Cache (all tools respect the 3-layer cache)Every tool call goes through the same engines as the CLI commands. The cache ensures repeated queries return instantly.
Context in Your IDE
Section titled “Context in Your IDE”With the MCP server running, your IDE’s AI assistant gains:
- Codebase awareness —
getContextprovides the same 4-layer context the CLI uses, so the AI sees relevant code, not everything. - Convention enforcement —
getConventionsinjects your constitution into every interaction. - Inline verification —
verifyandcheckSlopcatch issues as you write, not after you commit. - Review on demand —
reviewCodegives you the same two-stage review the CLI provides, inside your editor. - Test suggestions —
suggestTestsgenerates TDD stubs from your plan files. - Wiki search —
wikiQuerysearches compiled codebase knowledge and returns AI-synthesized answers with citations.
The MCP server is the same three engines, accessible from any tool that speaks MCP.