ai-backend-performance-mcp
Summary: This is a read-only static analysis MCP server that inspects Node.js/TypeScript backend projects for performance anti-patterns and returns structured, evidence-backed findings.
Full project scan (
analyze_project) — runs all analyzers and returns grouped findings with a summary (total, confirmed, potential counts).Database query analysis (
analyze_database_queries) — detects N+1 query patterns, unbounded finds, and sequential query calls in MongoDB/PostgreSQL code.MongoDB index analysis (
analyze_indexes) — compares query filter/sort fields against in-repocreateIndexdefinitions to flag potential missing indexes.Async pattern analysis (
analyze_async_patterns) — findsawaitinside loops, sequential awaits that could be parallelized, and blocking sync operations.Connection pooling analysis (
analyze_connection_pooling) — flags database clients or pools created inside request handlers, loops, or other hot paths.Dependency hygiene analysis (
analyze_dependencies) — inspectspackage.jsonand lockfiles for unused packages and dev/prod misclassification.
Each tool accepts a single required projectPath argument and returns findings with category, severity, confidence score, code snippet evidence, and a recommendation. Findings are marked confirmed vs potential, and nothing is ever executed or modified — analysis is purely static and text-based, with path validation to prevent traversal outside the target project.
Note: the README also advertises a seventh tool, investigate_performance, but it is not present in the provided server schema — only the six tools above are actually exposed.
Analyzes MongoDB query patterns for performance anti-patterns such as N+1 queries and unbounded finds, and checks index coverage for filter/sort fields based on in-repo createIndex calls.
Analyzes PostgreSQL query patterns for performance anti-patterns such as N+1 queries and ineffective batching, providing evidence-backed findings for database optimization.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ai-backend-performance-mcp analyze my Node.js backend at /app for performance anti-patterns"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ai-backend-performance-mcp
Static analysis MCP server for Node.js backend performance issues. AI agents can inspect a project for database query anti-patterns, async bottlenecks, connection pooling mistakes, and dependency hygiene problems — without modifying your code.
Why this project?
Backend performance issues often hide in plain sight: N+1 queries in loops, clients created per request, sequential awaits that could run in parallel, or dependencies misclassified in package.json. This MCP server exposes those patterns as structured, evidence-backed findings that AI coding assistants can reason about.
What it does
Read-only static analysis of JavaScript/TypeScript source files
Six focused MCP tools for common backend performance categories
Structured findings with severity, confidence, code snippets, and recommendations
Distinguishes confirmed evidence from potential issues
What it does not do
Execute your application or repository code
Modify files, install packages, or change indexes
Replace profiling, load testing, or database
EXPLAINanalysis
Related MCP server: AgentSkillMesh
Architecture
flowchart TD
Client[MCP Client / AI Agent]
Server[MCP Server]
Tools[MCP Tools]
Engine[Analysis Engine]
Analyzers[Individual Analyzers]
Findings[Structured Findings]
Client --> Server
Server --> Tools
Tools --> Engine
Engine --> Analyzers
Analyzers --> Findings
Findings --> Tools
Tools --> Server
Server --> ClientSee docs/architecture.md for layer details.
Analyzers
Analyzer | Detects |
Database queries | N+1 patterns, unbounded finds/queries |
MongoDB indexes | Filter/sort fields without matching |
Async patterns |
|
Connection pooling | Client/pool creation in handlers or loops |
Dependencies | Unused deps, dev/prod misclassification, lockfile stats |
MCP Tools
Tool | Description |
| Full scan with grouped findings and summary |
| MongoDB/PostgreSQL query patterns |
| MongoDB index coverage heuristics |
| Async/await performance patterns |
| Connection lifecycle anti-patterns |
|
|
| Full scan plus code-path context, related findings, clusters, and inspect-next hints |
Tool reference: docs/tools.md
Installation
Local (primary until the package is on npm): clone, install, and build. npm install runs prepare, which compiles dist/.
git clone https://github.com/robinafaruqia/ai-backend-performance-mcp.git
cd ai-backend-performance-mcp
npm installThen start the server over stdio:
node dist/index.jsAfter npm publish:
npx -y ai-backend-performance-mcpMCP configuration
Use a local build in Cursor (or Claude Desktop) first. Replace the path with the absolute path to this repo:
{
"mcpServers": {
"backend-performance": {
"command": "node",
"args": ["/absolute/path/to/ai-backend-performance-mcp/dist/index.js"]
}
}
}After the package is published to npm:
{
"mcpServers": {
"backend-performance": {
"command": "npx",
"args": ["-y", "ai-backend-performance-mcp"]
}
}
}Usage
Invoke any tool with a projectPath pointing to a Node.js backend repository:
{
"projectPath": "/path/to/your/api"
}Example output (truncated)
{
"projectPath": "/app/examples/sample-node-api",
"technologies": ["express", "mongodb"],
"metadata": {
"packageName": "sample-node-api",
"packageVersion": "1.0.0",
"sourceFileCount": 4
},
"findings": [
{
"category": "pooling",
"severity": "critical",
"title": "Connection or client created in request handler",
"evidence": {
"kind": "confirmed",
"snippet": "const client = await MongoClient.connect(...)"
},
"confidence": 0.9,
"recommendation": "Create a shared client/pool at module scope and reuse it."
}
],
"summary": {
"totalFindings": 6,
"confirmedCount": 3,
"potentialCount": 3
}
}Try the included demo project at examples/sample-node-api.
Safety
Read-only: never writes to analyzed projects
Path validation: prevents traversal outside
projectPathNo code execution: parses source text only; does not run repository code
Untrusted input: treat analyzed repos as untrusted
Limitations
Static analysis only; findings that depend on cluster state stay
potentialDynamic
require()/ runtime-generated queries are not fully trackedIndex analysis compares in-repo
createIndexcalls only (not Atlas/ops-managed indexes) and stays silent when the repo defines noneArray.find, batched$in/ANY(),_idlookups, and module-scope DB clients are not treated as issuesSequential awaits are flagged only when they do not consume prior bindings;
Promise.allis never reported as a findingDependency unused detection is import-scan based
Redis-specific rules are planned but not implemented in v0.1.0
Development
git clone https://github.com/robinafaruqia/ai-backend-performance-mcp.git
cd ai-backend-performance-mcp
npm install
npm run typecheck
npm run lint
npm test
npm run buildSee docs/development.md.
Testing
npm testFixture projects under tests/fixtures/ pair problematic and valid code for N+1 queries, indexes, async, pooling, and dependencies so analyzers do not fire on every await, query, loop, or connection.
Roadmap
Redis/cache analyzer
Prisma/TypeORM-specific query rules
ProjectContext caching
SARIF/JSON report export
Configurable severity thresholds
Contributing
Contributions are welcome! See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
License
MIT — see LICENSE.
Available Tools
6 toolsanalyze_async_patternsB
Detect async performance issues including await in loops, sequential awaits, and blocking operations.
Inputs: projectPath (required).
analyze_connection_poolingB
Detect database client or pool creation inside request handlers, loops, or other hot paths.
Inputs: projectPath (required).
analyze_database_queriesA
Detect MongoDB/PostgreSQL query anti-patterns such as N+1 queries, unbounded finds, and sequential query calls.
Inputs: projectPath (required).
analyze_dependenciesA
Analyze package.json and lockfile for dependency hygiene issues including unused and misclassified packages.
Inputs: projectPath (required).
analyze_indexesB
Analyze MongoDB query patterns against createIndex definitions to surface potential missing indexes.
Inputs: projectPath (required).
analyze_projectB
Analyze a Node.js backend project for performance issues across database, async, pooling, and dependencies.
Inputs: projectPath (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a clearly distinct performance concern: project-wide analysis, database queries, indexes, async patterns, connection pooling, and dependencies. There is no overlap or ambiguity in their purposes.
All tool names follow the identical 'analyze_<topic>' pattern, making it predictable and easy to infer the function of each tool from its name. No mixed conventions or inconsistent verbs.
Six tools is well-scoped for a performance analysis server. Each tool addresses a distinct aspect of backend performance without redundancy, and the count feels neither thin nor overwhelming.
The tool covers major performance domains: database queries, indexes, async patterns, connection pooling, dependencies, and a project overview. Minor potential gaps like memory or caching analysis are absent, but the core performance concerns are well represented.
Related MCP Connectors
Provide AI-powered real-time analysis and intelligence on NPM packages, including security, depend…
Scores your code across 12 areas, with findings, fix prompts, and re-assessment in your AI agent
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze code health in TypeScript/JavaScript projects, providing tools to run analysis, start a dashboard, and get summaries.5 npm3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to perform static security linting for issues like dynamic eval, secret leaks, and insecure regexes, plus sub-millisecond AST symbol search across large repositories through the Model Context Protocol. It offers a zero-dependency, pure ESM runtime suited to high-concurrency agent workflows.1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI coding assistants to run static analysis on GitHub repositories, raw code snippets, or local directories to detect cloud cost leaks in Terraform/AWS configs, PostgreSQL migration table-lock hazards, and OWASP/Next.js API security gaps. Each finding returns structured severity, line-level detail, and drop-in fixes.MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to submit code files for analysis and receive rule-based findings with severities, line numbers, and SARIF fingerprints, covering security, complexity, and dependency/configuration drift.568 PyPI7MIT