testing

Home

Testing

Testing procedures for MCP servers built from the Template-MCP template.


Build Validation

# TypeScript compilation (catches type errors)
npm run build

# ESLint (catches style and logic issues)
npm run lint

Both checks must pass before merging.


Manual Tool Testing

Via Claude Code

The primary way to test MCP tools:

  1. Build the server: npm run build
  2. Register in .mcp.json:
    {
      "mcpServers": {
        "my-mcp": {
          "type": "stdio",
          "command": "node",
          "args": ["/path/to/dist/index.js"]
        }
      }
    }
    
  3. Restart Claude Code
  4. Ask Claude to use the tools and verify responses

Via Command Line

Test tools by sending MCP protocol messages via stdin:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js

Via curl (Testing the Underlying API)

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 .

Test Checklist

For Every New Tool

For Pagination Tools

For Mutation Tools (Create/Update/Delete)


Multi-Connection Testing

Test tools against different connections to verify:


Error Case Testing

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

Watch Mode Development

Use watch mode for rapid iteration:

npm run dev

TypeScript recompiles on file save. Restart the Claude Code MCP connection to pick up changes.


Pre-Release Checklist

Before merging to main:



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