code-features-mcp
v1.0.1
Published
MCP server that exposes code analysis tools — language detection, line counting, symbol extraction, TODO finder, and complexity estimation
Maintainers
Readme
code-features-mcp
An MCP (Model Context Protocol) server that exposes code analysis tools to AI assistants.
Gives Claude (and any MCP-compatible client) the ability to:
| Tool | What it does |
|---|---|
| detect_language | Identify the programming language of a snippet |
| count_lines | Count total / code / comment / blank lines |
| extract_symbols | Pull out functions, classes, interfaces, types |
| find_todos | Locate TODO / FIXME / HACK / NOTE / BUG comments |
| measure_complexity | Estimate cyclomatic complexity |
Zero dependencies. Works as a library too.
Install
npm install -g code-features-mcp # global CLI
npm install code-features-mcp # libraryUse as an MCP server
Add to your claude_desktop_config.json (or any MCP client config):
{
"mcpServers": {
"code-features": {
"command": "code-features-mcp"
}
}
}The server communicates over stdio using JSON-RPC 2.0 — the standard MCP transport.
Tools
detect_language
{ "code": "def foo(): pass", "filename": "script.py" }{ "language": "python", "confidence": 1.0, "method": "extension" }method is "extension" when a filename is supplied, "heuristic" when detected from content, or "unknown".
count_lines
{ "code": "// comment\nconst x = 1;\n\n", "language": "javascript" }{ "total": 4, "code": 1, "comment": 1, "blank": 2 }extract_symbols
{ "code": "function greet(name) {}\nclass Animal {}", "language": "javascript" }[
{ "name": "greet", "kind": "function", "line": 1 },
{ "name": "Animal", "kind": "class", "line": 2 }
]Supported languages: JavaScript, TypeScript, Python, Go, Rust, Java, Ruby.
find_todos
{ "code": "// TODO: fix this\n// FIXME: broken edge case" }[
{ "kind": "TODO", "text": "fix this", "line": 1 },
{ "kind": "FIXME", "text": "broken edge case", "line": 2 }
]Recognised tags: TODO, FIXME, HACK, NOTE, BUG, XXX, OPTIMIZE, REFACTOR.
measure_complexity
{ "code": "if (a && b) { for (let i=0;i<n;i++) { while(true) break; } }" }{ "complexity": 5, "rating": "low", "decisionPoints": 4 }Rating scale: low (≤5) → moderate (≤10) → high (≤20) → very high (>20).
Formula: complexity = 1 + decision points (if/for/while/case/catch/&&/||/ternary).
Use as a library
import { detectLanguage, countLines, extractSymbols, findTodos, measureComplexity } from 'code-features-mcp';
const { language } = detectLanguage('fn main() {}', 'main.rs');
// 'rust'
const lines = countLines(myCode, 'python');
// { total: 42, code: 30, comment: 8, blank: 4 }
const symbols = extractSymbols(myCode, 'typescript');
// [{ name: 'MyClass', kind: 'class', line: 5 }, ...]
const todos = findTodos(myCode);
// [{ kind: 'TODO', text: 'refactor', line: 12 }]
const { complexity, rating } = measureComplexity(myCode, 'javascript');
// { complexity: 7, rating: 'moderate', decisionPoints: 6 }CommonJS
const { detectLanguage, countLines } = require('code-features-mcp');MCP protocol
The server implements JSON-RPC 2.0 over stdio and handles:
| Method | Description |
|---|---|
| initialize | Handshake, returns server info and capabilities |
| tools/list | Returns the list of available tools |
| tools/call | Executes a tool with given arguments |
| ping | Health check |
License
MIT
