MCP Server

Install and use the @codehabits/mcp server for real-time convention checks, domain knowledge lookup, reviewer suggestions, and convention feedback.

The Codehabits MCP server (@codehabits/mcp) exposes six tools that read from .codehabits/ in your repo. Agents call these tools on demand to check code against team conventions, look up domain knowledge, and suggest reviewers.

Prerequisites

  • Run npx @codehabits/cli enable first so .codehabits/ exists
  • Node.js 20+ and an MCP-compatible client (Cursor, Claude Desktop, etc.)

Install

Project-level (recommended)
npx @codehabits/cli mcp-install

This writes to .cursor/mcp.json in your repository:

.cursor/mcp.json
{
  "mcpServers": {
    "codehabits": {
      "command": "npx",
      "args": ["@codehabits/mcp"],
      "cwd": "."
    }
  }
}

For all projects on your machine:

Global install
npx @codehabits/cli mcp-install --global

Restart required

Restart your IDE after installing MCP so it picks up the new server configuration.

Available tools

ToolDescription
get_team_contextConventions and anti-patterns, optionally filtered by scope or file path
check_codeValidate a code snippet against team conventions and anti-patterns
get_knowledgeLook up domain knowledge by topic (auth, database, API, etc.)
suggest_reviewersSuggest reviewers based on expertise for a set of changed files
record_feedbackPropose a convention change (writes to gitignored proposals.json)
approve_proposalMerge an approved proposal into active intelligence and regenerate skills

When to use MCP vs skills alone

Agent Skills load passively when agents start working. MCP tools are for active lookups: validating a snippet before committing, querying domain context mid-task, or routing PRs to the right reviewers.

One-prompt setup for agents

The /agents page includes a bootstrap prompt that runs enable, mcp-install, and reads llms.txt in one shot. Paste it into Cursor Agent or Claude Code when onboarding a repo.

Troubleshooting

No intelligence found

MCP reads from process.cwd(). Ensure the server's cwd points at your repo root and .codehabits/meta.json exists. Run codehabits enable if missing.

Tools not appearing

Confirm .cursor/mcp.json is valid JSON, restart the IDE, and check MCP logs in your client's developer tools.