MCP Server Codebase Analyzer

MCP Server Codebase Analyzer

Analyzes TypeScript codebases for health issues, fetches system incidents, and generates remediation plans.

Category
Visit Server

README

MCP Server Codebase Analyzer

A production-grade MCP (Model Context Protocol) server that analyzes TypeScript codebases, detects code health issues, fetches system incidents, and generates actionable remediation plans. Supports dual transport (STDIO for local dev, SSE for cloud deployment). Built with ts-morph, Express, and Zod validation.


🚀 Features

Three Core Tools:

  1. analyze_codebase_health — Scans TypeScript repositories for:

    • Large files (potential refactoring candidates)
    • Missing explicit function types (weak typing)
    • Circular dependencies (architectural issues)
    • Uses ts-morph for AST-level analysis
  2. fetch_system_incidents — Returns structured incident data:

    • Mock incident data (perfect for testing/demos)
    • Configurable delays and failure modes
    • LLM-friendly JSON responses
  3. generate_remediation_plan — Creates actionable fix plans:

    • Root cause analysis from stack traces
    • Step-by-step remediation steps
    • Code suggestions and best practices
    • Risk level assessment

All tools return structured success/error envelopes designed for LLM consumption.

Architecture Overview

flowchart LR
    Client[McpClient] --> Runtime[RuntimeSelector]
    Runtime -->|stdio| Stdio[StdioTransportAdapter]
    Runtime -->|sse| Sse[SseTransportAdapter]
    Stdio --> Server[McpServer]
    Sse --> Server
    Server --> Registry[ToolRegistry]
    Registry --> ToolA[analyze_codebase_health]
    Registry --> ToolB[fetch_system_incidents]
    Registry --> ToolC[generate_remediation_plan]

Local Run (STDIO)

  1. Install dependencies:
    • npm install
  2. Start server:
    • npm run dev:stdio
  3. The server starts over stdin/stdout and is ready for local MCP clients.

Run with SSE (Express)

  1. Set environment:
    • TRANSPORT=sse
    • optional: AUTH_TOKEN=your-secret-token
  2. Start server:
    • npm run dev:sse
  3. Endpoints:
    • GET /events for SSE stream
    • POST /messages?sessionId=... for MCP JSON-RPC messages

Connect From Cursor

For local usage, register Nexus-Core as a stdio MCP server:

  • command: node
  • args: dist/index.js (after build) or tsx src/index.ts (dev)
  • env: TRANSPORT=stdio

For hosted usage, configure your MCP client to use the SSE endpoint:

  • stream URL: https://<host>/events
  • message URL: https://<host>/messages?sessionId=<session-id>
  • add Authorization: Bearer <AUTH_TOKEN> if token auth is enabled.

Example Prompts

  • "Analyze my repo"
  • "Fetch incidents"
  • "Fix this error"

Environment Variables

See .env.example for all supported settings. Important controls:

  • TRANSPORT: stdio or sse
  • TOOL_TIMEOUT_MS: hard timeout for each tool call
  • TS_MORPH_MAX_FILES, TS_MORPH_MAX_DEPTH: analysis guardrails
  • INCIDENT_API_TIMEOUT_MS, INCIDENT_API_RETRIES: external dependency controls
  • SSE_HEARTBEAT_MS, SSE_SESSION_TTL_MS: SSE session lifecycle

Production Deployment

Docker

  • Build image: docker build -t nexus-core .
  • Run container:
    • docker run -e TRANSPORT=sse -e PORT=8080 -p 8080:8080 nexus-core

Cloud Run

Use deploy.sh:

PROJECT_ID=<gcp-project> REGION=<region> SERVICE=nexus-core ./deploy.sh

This script:

  1. Builds container image
  2. Pushes to GCR
  3. Deploys to Cloud Run

Reliability and Error Model

  • All tool requests are validated with Zod.
  • No tool execution returns unhandled exceptions.
  • Errors use a standard envelope with:
    • code
    • message
    • retryable
    • suggestedAction
    • meta (requestId, toolName, timing)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured