MCP Server Codebase Analyzer
MCP 服务器代码库分析器
一个生产级的 MCP(模型上下文协议)服务器,用于分析 TypeScript 代码库、检测代码健康问题、获取系统事件并生成可执行的补救计划。支持双重传输(用于本地开发的 STDIO 和用于云部署的 SSE)。基于 ts-morph、Express 和 Zod 验证构建。
🚀 功能
三大核心工具:
analyze_codebase_health— 扫描 TypeScript 仓库以查找:大文件(潜在的重构候选对象)
缺失的显式函数类型(弱类型)
循环依赖(架构问题)
使用
ts-morph进行 AST 级分析
fetch_system_incidents— 返回结构化的事件数据:模拟事件数据(非常适合测试/演示)
可配置的延迟和故障模式
对 LLM 友好的 JSON 响应
generate_remediation_plan— 创建可执行的修复计划:基于堆栈跟踪的根本原因分析
分步补救措施
代码建议和最佳实践
风险等级评估
所有工具均返回专为 LLM 使用而设计的结构化成功/错误信封。
Related MCP server: ts-diagnostics-mcp
架构概览
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]本地运行 (STDIO)
安装依赖:
npm install
启动服务器:
npm run dev:stdio
服务器通过 stdin/stdout 启动,并准备好供本地 MCP 客户端使用。
使用 SSE (Express) 运行
设置环境变量:
TRANSPORT=sse可选:
AUTH_TOKEN=your-secret-token
启动服务器:
npm run dev:sse
端点:
GET /events用于 SSE 流POST /messages?sessionId=...用于 MCP JSON-RPC 消息
从 Cursor 连接
对于本地使用,将 Nexus-Core 注册为 stdio MCP 服务器:
命令:
node参数:
dist/index.js(构建后)或tsx src/index.ts(开发环境)环境变量:
TRANSPORT=stdio
对于托管使用,配置您的 MCP 客户端以使用 SSE 端点:
流 URL:
https://<host>/events消息 URL:
https://<host>/messages?sessionId=<session-id>如果启用了令牌认证,请添加
Authorization: Bearer <AUTH_TOKEN>。
示例提示词
"Analyze my repo"
"Fetch incidents"
"Fix this error"
环境变量
查看 .env.example 获取所有支持的设置。重要的控制项:
TRANSPORT:stdio或sseTOOL_TIMEOUT_MS: 每个工具调用的硬超时时间TS_MORPH_MAX_FILES,TS_MORPH_MAX_DEPTH: 分析防护栏INCIDENT_API_TIMEOUT_MS,INCIDENT_API_RETRIES: 外部依赖控制SSE_HEARTBEAT_MS,SSE_SESSION_TTL_MS: SSE 会话生命周期
生产部署
Docker
构建镜像:
docker build -t nexus-core .运行容器:
docker run -e TRANSPORT=sse -e PORT=8080 -p 8080:8080 nexus-core
Cloud Run
使用 deploy.sh:
PROJECT_ID=<gcp-project> REGION=<region> SERVICE=nexus-core ./deploy.sh此脚本:
构建容器镜像
推送到 GCR
部署到 Cloud Run
可靠性和错误模型
所有工具请求均通过 Zod 进行验证。
工具执行不会返回未处理的异常。
错误使用标准信封,包含:
codemessageretryablesuggestedActionmeta(requestId,toolName, 时间)
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Ship production-ready TypeScript code in half the time, at half the cost.
- SuperlogOAuthsh.superlog
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables intelligent analysis of codebases to generate comprehensive documentation, calculate documentation coverage, and identify missing documentation with severity levels. Supports TypeScript, JavaScript, and Python with AI-powered suggestions for documentation improvements.416MIT
- AlicenseAqualityDmaintenanceProvides real-time TypeScript diagnostics with intelligent caching for AI agents, enabling instant queries instead of running tsc repeatedly.9323MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to interact with TypeScript projects through compiler-level code intelligence, providing tools for navigation, type information, diagnostics, refactoring, and semantic search.293423Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze code health in TypeScript/JavaScript projects, providing tools to run analysis, start a dashboard, and get summaries.223MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kushalsai-01/mcp-server-codebase-analyser'
If you have feedback or need assistance with the MCP directory API, please join our Discord server