Sponsored by Deepsite.site

Codesentinel

Created By
Rasha Salima month ago
Content

CodeSentinel MCP Server

A comprehensive code quality analysis server for the Model Context Protocol (MCP). CodeSentinel integrates with Claude Code and other MCP-compatible clients to detect security vulnerabilities, deceptive patterns, incomplete code, and highlight good practices.

Why CodeSentinel?

AI coding assistants can inadvertently introduce subtle issues: hardcoded secrets, empty catch blocks, TODO placeholders left behind, or patterns that hide errors. CodeSentinel acts as a quality gate, analyzing code for 93 distinct patterns across 5 categories before issues reach production.

Key differentiators:

  • Verification-aware detection: Many patterns include verification steps to reduce false positives
  • LLM-optimized output: Structured JSON output designed for AI consumption and action
  • Balanced analysis: Detects both issues AND strengths for fair code assessment
  • Multi-language support: Works with TypeScript, JavaScript, Python, Go, Rust, Java, and more

Features

  • Security Analysis (16 patterns): Hardcoded secrets, SQL injection, XSS, command injection, insecure crypto, disabled SSL, and more
  • Deceptive Pattern Detection (17 patterns): Empty catch blocks, silent failures, error-hiding fallbacks, linter suppression
  • Placeholder Detection (19 patterns): TODO/FIXME/HACK comments, lorem ipsum, test data, incomplete implementations
  • Error & Code Smell Detection (18 patterns): Type coercion issues, null references, async anti-patterns, floating point comparison
  • Strength Recognition (23 patterns): Highlights good practices like proper typing, error handling, testing patterns, documentation
  • HTML Reports: Visual reports with quality scores and actionable suggestions

Installation

From npm

npm install -g code-sentinel-mcp

From source

git clone https://github.com/your-username/code-sentinel.git
cd code-sentinel
npm install
npm run build

Usage with Claude Code

Quick setup

claude mcp add code-sentinel -- npx code-sentinel-mcp

Or if installed globally

claude mcp add code-sentinel -- code-sentinel

Manual configuration

Add to your Claude Code MCP configuration file (~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "code-sentinel": {
      "command": "npx",
      "args": ["code-sentinel-mcp"]
    }
  }
}

Available Tools

analyze_code

Full analysis returning structured JSON with all issues and strengths. Best for programmatic processing.

Parameters:

  • code (string, required): The source code to analyze
  • filename (string, required): Filename for language detection (e.g., "app.ts")

Returns: JSON object with issues, strengths, and summary statistics.

generate_report

Full analysis with a visual HTML report. Best for human review.

Parameters:

  • code (string, required): The source code to analyze
  • filename (string, required): Filename for language detection

Returns: Markdown summary plus complete HTML report.

check_security

Security-focused analysis only. Use when you specifically want to audit for vulnerabilities.

Parameters:

  • code (string, required): The source code to check
  • filename (string, required): Filename

Returns: List of security issues or confirmation of none found.

check_deceptive_patterns

Check for code patterns that hide errors or create false confidence.

Parameters:

  • code (string, required): The source code to check
  • filename (string, required): Filename

Returns: List of deceptive patterns found.

check_placeholders

Find TODOs, dummy data, and incomplete implementations.

Parameters:

  • code (string, required): The source code to check
  • filename (string, required): Filename

Returns: List of placeholder code found.

analyze_patterns

Analyze code for architectural, design, and implementation patterns. Detects pattern usage, inconsistencies, and provides actionable suggestions.

Parameters:

  • code (string, required): The source code to analyze
  • filename (string, required): Filename for language detection
  • level (string, optional): Pattern level to analyze:
    • architectural: System structure patterns (layering, modules)
    • design: Gang of Four patterns (Singleton, Factory, Observer)
    • code: Implementation idioms (error handling, async patterns)
    • all: All levels (default)
  • query (string, optional): Natural language query to focus analysis (e.g., "how is error handling done?")

Returns: LLM-optimized JSON with detected patterns, inconsistencies, suggestions, and ready-to-execute action items.

analyze_design_patterns

Focused analysis of Gang of Four (GoF) design patterns. Best for understanding OOP structure.

Parameters:

  • code (string, required): The source code to analyze
  • filename (string, required): Filename for language detection

Returns: Detected design patterns with confidence levels, locations, and implementation details.

Example Usage

Ask Claude to analyze code:

Analyze this code for quality issues:

const API_KEY = "sk-abc123456789";

async function fetchData() {
  try {
    const response = await fetch(url);
    return response.json();
  } catch (e) {
    // TODO: handle error
  }
}

CodeSentinel will detect:

  • Critical (CS-SEC003): OpenAI API key hardcoded in source
  • High (CS-DEC001): Empty catch block silently swallowing errors
  • Low (CS-PH001): TODO comment indicating incomplete implementation

Detection Categories

Security Issues (CS-SEC)

IDPattern
SEC001Hardcoded secrets (API keys, tokens, passwords)
SEC002GitHub tokens
SEC003OpenAI API keys
SEC004AWS access keys
SEC005-010SQL injection patterns
SEC011-015XSS vulnerabilities
SEC016Command injection (eval, exec)

Deceptive Patterns (CS-DEC)

IDPattern
DEC001-003Empty/comment-only catch blocks
DEC010-012Silent promise rejections
DEC020-025Error-hiding fallbacks (
DEC030+Linter suppression, fake success responses

Placeholders (CS-PH)

IDPattern
PH001-005TODO/FIXME/HACK/XXX/NOTE comments
PH010-015Lorem ipsum, placeholder text
PH020-025Test/dummy data (test@example.com, password123)
PH030+console.log debugging, debugger statements

Errors & Code Smells (CS-ERR)

IDPattern
ERR001-005Loose equality (==), type coercion issues
ERR010-015Null reference risks
ERR020-025Async anti-patterns
ERR030+parseInt without radix, array mutation in loops

Strengths (CS-STR)

IDPattern
STR001-005TypeScript strict typing
STR010-015Proper error handling patterns
STR020-025Test coverage indicators
STR030+Documentation, input validation

Scoring Algorithm

Quality score (0-100) calculated as:

Score = 100 - (critical × 25) - (high × 15) - (medium × 5) - (low × 1) + (strengths × 2)
SeverityPoint Deduction
Critical-25 points
High-15 points
Medium-5 points
Low-1 point
Strength+2 points (bonus)

Supported Languages

CodeSentinel detects language from file extensions:

ExtensionLanguage
.ts, .tsxTypeScript
.js, .jsxJavaScript
.pyPython
.goGo
.rsRust
.javaJava
.ktKotlin
.swiftSwift
.csC#
.cpp, .cC/C++
.phpPHP
.vueVue
.svelteSvelte

Extending CodeSentinel

Add custom patterns by editing files in src/analyzers/:

src/analyzers/
├── security.ts      # Security vulnerability patterns
├── deceptive.ts     # Error-hiding patterns
├── placeholders.ts  # Incomplete code patterns
├── errors.ts        # Code smell patterns
└── strengths.ts     # Good practice patterns

Each pattern follows this structure:

{
  id: 'CS-SEC001',           // Unique ID with category prefix
  pattern: /regex/g,          // RegExp to match
  title: 'Short description',
  description: 'Detailed explanation',
  severity: 'critical',       // critical | high | medium | low | info
  category: 'security',
  suggestion: 'How to fix',
  verification: {             // Optional: reduce false positives
    assumption: 'What we assume is true',
    confirmIf: 'When to confirm as real issue',
    falsePositiveIf: 'When to dismiss'
  }
}

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run watch

# Test with MCP inspector
npm run inspector

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add patterns following the existing format
  4. Submit a pull request

License

MIT

Server Config

{
  "mcpServers": {
    "code-sentinel": {
      "command": "npx",
      "args": [
        "code-sentinel-mcp"
      ]
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
Tavily Mcp
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
CursorThe AI Code Editor
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.