Security, performance, and correctness audit of an MCP server
Perform a comprehensive security, performance, and correctness audit of an MCP server.
Identify the MCP server to audit:
@modelcontextprotocol/sdk in dependencies and McpServer usageRead these files thoroughly:
src/index.ts — Server entry point, middleware chain, DI providerssrc/tools/ — Tool schemas and handlerssrc/resources/ — Resource handlerssrc/prompts/ — Prompt handlerspackage.json — Dependencies, scriptsFollow the complete Security Agent checklist from agents/security.md:
CRITICAL checks:
HIGH checks:
MEDIUM checks:
Follow the Performance Agent checklist from agents/performance.md:
Check MCP protocol compliance and best practices:
.describe()initialize response includes correct capabilitiesCheck that tool descriptions are substantive enough for an AI agent to use correctly without external documentation. For each tool:
[HIGH] Thin description. A good description is 2-4 sentences.[MEDIUM] Missing usage guidance.[MEDIUM] Return value not described..describe() should include more than just the field name restated. Flag .describe("The user ID") or .describe("query") as [MEDIUM] Generic parameter description — it should say something like .describe("The user's UUID, found in the response from create-user or search-users").docs/, README.md, OpenAPI specs), compare tool descriptions against it. Flag tools that don't use the project's own terminology or miss important context as [MEDIUM] Description not informed by project docs.[LOW] Consider mentioning related tools.Present description quality findings in the report alongside security and performance findings.
Present findings in priority order:
## MCP Server Audit Report: <server-name>
### Summary
| Category | Critical | High | Medium | Pass |
|----------|----------|------|--------|------|
| Security | N | N | N | N |
| Performance | N | N | N | N |
| Correctness | N | N | N | N |
### Critical Findings
#### [CRITICAL-1] <title>
**File**: path:line
**Issue**: Clear description
**Fix**: Specific code change
**Why**: What could go wrong if not fixed
### High Findings
...
### Medium Findings
...
### Passed Checks
- ✓ All tools have Zod schemas
- ✓ Rate limiting configured
- ...
For each finding, offer to fix it:
I found N issues. Would you like me to fix them? I'll address critical issues first.
Apply fixes directly to the code, then re-run the affected checks to verify.
After fixes:
npm run typechecknpm test