🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@codehabits/mcp

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codehabits/mcp

MCP server for codehabits: get_team_context, check_code, get_knowledge, and reviewer tools over stdio for Cursor, Claude Code, and MCP-compatible agents.

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
188
1242.86%
Maintainers
1
Weekly downloads
 
Created
Source

@codehabits/mcp

npm version license

MCP server for codehabits team intelligence. Expose your repository’s conventions, anti-patterns, and domain knowledge to AI coding agents through the Model Context Protocol.

Works with Cursor, Claude Code, and other MCP-capable clients. Pair with @codehabits/cli to generate .codehabits/ from PR history.

Prerequisites

  • Node.js 20+
  • Intelligence files in the project root (run once per repo):
npx @codehabits/cli login
npx @codehabits/cli enable

The MCP server reads .codehabits/ from the process working directory (cwd). It reloads when intelligence files change on disk.

Quick install (Cursor)

From your repository root (after enable):

npx @codehabits/cli mcp-install

This writes .cursor/mcp.json (or ~/.cursor/mcp.json with --global):

{
  "mcpServers": {
    "codehabits": {
      "command": "npx",
      "args": ["@codehabits/mcp"],
      "cwd": "/absolute/path/to/your/repo"
    }
  }
}

Restart the IDE so the server loads.

Manual MCP configuration

Use the same shape anywhere MCP stdio servers are supported. Important: set cwd to the repo that contains .codehabits/.

Cursor (project)

Path: .cursor/mcp.json

{
  "mcpServers": {
    "codehabits": {
      "command": "npx",
      "args": ["-y", "@codehabits/mcp"],
      "cwd": "${workspaceFolder}"
    }
  }
}

Claude Code (example)

Add to your Claude MCP config (path varies by install):

{
  "mcpServers": {
    "codehabits": {
      "command": "npx",
      "args": ["-y", "@codehabits/mcp"],
      "cwd": "/path/to/your/repo"
    }
  }
}

Run directly (debug)

cd /path/to/your/repo
npx @codehabits/mcp

Stdio transport only; intended for IDE integration, not HTTP.

Tools

ToolDescription
get_team_contextConventions, anti-patterns, and knowledge; optionally filtered by scope or file_path
check_codeValidate a code snippet against team rules; returns violations and suggestions
get_knowledgeLook up a domain topic (e.g. authentication, database, deployment)
suggest_reviewersRank reviewers for a list of changed file paths
record_feedbackPropose a convention change or correction (writes local proposals.json, gitignored)
approve_proposalMerge an approved proposal into tracked intelligence and regenerate skills

get_team_context

Use before writing or reviewing code.

ParameterTypeDescription
scopeenum (optional)all, imports, testing, naming, async, api, auth, database, structure, error-handling, documentation, security, performance, type-safety
file_pathstring (optional)Tailor context to a file type or path

check_code

ParameterTypeDescription
codestringSnippet to validate
file_pathstring (optional)Path for context-aware rules

get_knowledge

ParameterTypeDescription
topicstringTopic name (fuzzy match supported)

suggest_reviewers

ParameterTypeDescription
filesstring[]Changed file paths

record_feedback / approve_proposal

Agents can suggest updates when the user overrides team rules:

  • record_feedback stores a proposal in .codehabits/proposals.json (not committed by default).
  • Human reviews, then approve_proposal with proposal_id updates conventions.json and regenerates skill markdown / AGENTS.md (creates normal git changes to commit).
record_feedback fieldDescription
typenew_convention, update_convention, new_exception, deprecate
targetIdExisting convention id (for update/exception/deprecate)
ruleRule text (new conventions)
reasonWhy the change is proposed
categorye.g. testing, naming
file_pathWhere the issue appeared

Example agent workflows

Before implementing a feature

Call get_team_context with scope: "api" or file_path set to the file you are editing.

During review

Call check_code on the diff snippet; fix violations the tool reports.

When the model disagrees with a convention

Call record_feedback with type: "new_exception" and a clear reason; a teammate runs approve_proposal after review.

PR assignment

Call suggest_reviewers with the list of changed paths.

How it works

sequenceDiagram
  participant IDE as IDE / Agent
  participant MCP as @codehabits/mcp
  participant FS as .codehabits/*.json
  IDE->>MCP: tools/call (stdio)
  MCP->>FS: read + watch
  FS-->>MCP: IntelligenceFile
  MCP-->>IDE: conventions / violations / knowledge
  • Transport: MCP over stdio (@modelcontextprotocol/sdk).
  • State: Loaded from disk; no separate database.
  • Hot reload: File watcher updates in-memory intelligence when JSON changes (e.g. after codehabits sync).

If intelligence is missing, tools return a message asking you to run codehabits enable first.

Passive vs active intelligence

MechanismPackageWhen agents use it
AGENTS.md + .claude/skills/ + .agents/skills/CLI enableAutomatically in context / skill discovery
MCP tools (this package)@codehabits/mcpOn demand during chat or agent loops

Use both: skills for always-on team voice; MCP for lookups, checks, and structured feedback.

Troubleshooting

SymptomFix
“No intelligence data available”Run npx @codehabits/cli enable in the repo; confirm .codehabits/meta.json exists
Tools return stale rulesRun npx @codehabits/cli sync; restart IDE if the watcher did not fire
Server starts but wrong conventionsCheck MCP cwd points at the repo root, not a subfolder
npx fails in IDEUse full path to codehabits-mcp or pin version: npx -y @codehabits/mcp@0.1.1

Verify integration:

npx @codehabits/cli status
PackageRole
@codehabits/cliLogin, enable, sync, mcp-install, CI tokens

License

MIT © codehabits

Keywords

mcp

FAQs

Package last updated on 30 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts