← Home
Testing procedures for MCP servers built from the Template-MCP template.
# TypeScript compilation (catches type errors)
npm run build
# ESLint (catches style and logic issues)
npm run lint
Both checks must pass before merging.
The primary way to test MCP tools:
npm run build.mcp.json:
{
"mcpServers": {
"my-mcp": {
"type": "stdio",
"command": "node",
"args": ["/path/to/dist/index.js"]
}
}
}
Test tools by sending MCP protocol messages via stdin:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js
Test the REST API directly to isolate MCP vs. API issues:
curl -s -H "Authorization: Bearer $API_KEY" \
"https://api.example.com/resources?limit=5" | jq .
tools/list response.describe() textTest tools against different connections to verify:
connection param is omittedlist_connections shows all configured connections| Scenario | Expected Behavior |
|---|---|
| API returns 401 | Tool returns auth error message |
| API returns 404 | Tool returns "not found" message |
| API returns 500 | Tool returns server error message |
| API is unreachable | Tool returns connection error |
| Invalid JSON response | Tool returns parse error |
| Config file missing | Server fails to start with clear message |
| Invalid config JSON | Server fails to start with clear message |
Use watch mode for rapid iteration:
npm run dev
TypeScript recompiles on file save. Restart the Claude Code MCP connection to pick up changes.
Before merging to main:
npm run build succeedsnpm run lint passeslist_connections tool worksapi_request raw tool worksnpm run setup)Repo: Template-MCP · MokoStandards
| Field | Value |
|---|---|
| Minimum Version | 04.07.00 |
| Platform | mcp-server |
| Applies To | MCP server repositories |
| Revision | Date | Author | Description |
|---|---|---|---|
| 1.0 | 2026-05-19 | Moko Consulting | Initial version |
Printed from wiki · testing