Testing MCP Endpoints
Learn how to test your MCP servers using various tools and methods to ensure they work correctly before publishing.
Testing Methods
You can test MCP endpoints using:
- cURL - Command-line testing
- Postman - GUI-based testing
- MCP Inspector - Official testing tool
- Custom Clients - Using MCP SDKs
Method 1: Testing with cURL
The fastest way to test MCP endpoints.
List Available Tools
curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'Call a Tool
curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": {
"city": "San Francisco"
}
}
}'List Resources
curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "resources/list"
}'Read a Resource
curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 4,
"method": "resources/read",
"params": {
"uri": "weather://cities/supported"
}
}'Method 2: Testing with Postman
Postman provides a GUI for API testing.
Setup
- Open Postman
- Create a new request
- Set method to POST
- Enter URL:
https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp - Add header:
Content-Type: application/json
Test Tools/List
Body (raw JSON):
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Click Send.
Create Test Suite
Save requests in Postman:
- Save request as “List Tools”
- Create collection “MCP Server Tests”
- Add more requests for different methods
- Run entire collection for complete testing
Method 3: MCP Inspector
Official tool for testing MCP servers.
Installation
npx @modelcontextprotocol/inspector \
https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcpFeatures
The MCP Inspector provides:
- Interactive interface
- Tool discovery
- Parameter forms
- Response viewer
- Error highlighting
Usage
- Inspector opens in browser
- Shows available tools automatically
- Click a tool to see details
- Fill in parameters
- Click “Call” to test
- View results
Method 4: Using MCP SDKs
Test programmatically with official SDKs.
TypeScript Example
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamable-http.js'
async function testServer() {
const transport = new StreamableHTTPClientTransport({
url: 'https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp'
})
const client = new Client({
name: 'test-client',
version: '1.0.0'
}, {
capabilities: {}
})
await client.connect(transport)
// Test: List tools
const tools = await client.listTools()
console.log('Tools:', tools)
// Test: Call tool
const result = await client.callTool({
name: 'get_weather',
arguments: { city: 'San Francisco' }
})
console.log('Result:', result)
}
testServer().catch(console.error)Python Example
from mcp import Client
from mcp.client.streamable_http import StreamableHTTPClientTransport
async def test_server():
transport = StreamableHTTPClientTransport(
url='https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp'
)
client = Client(name='test-client', version='1.0.0')
await client.connect(transport)
# Test: List tools
tools = await client.list_tools()
print('Tools:', tools)
# Test: Call tool
result = await client.call_tool(
name='get_weather',
arguments={'city': 'San Francisco'}
)
print('Result:', result)
import asyncio
asyncio.run(test_server())Testing Checklist
Basic Functionality
- Server responds to requests
-
tools/listreturns all tools -
tools/callexecutes successfully -
resources/listreturns resources -
resources/readprovides content -
prompts/listshows prompts (if any)
Tool Testing
- All tools listed correctly
- Tool descriptions are clear
- Input schemas validate properly
- Required parameters enforced
- Optional parameters work
- Mock scenarios trigger correctly
- Responses match output schema
Edge Cases
- Invalid tool name returns error
- Missing required parameter returns error
- Invalid parameter type returns error
- Unknown resource URI returns error
- Empty requests handled gracefully
Error Handling
- Error codes are correct (-32600, -32601, -32602, -32603)
- Error messages are helpful
- Stack traces not exposed in production
Automated Testing
Create Test Script
Save this as test-mcp.sh:
#!/bin/bash
ENDPOINT="https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp"
echo "Testing MCP Server..."
# Test 1: List tools
echo "Test 1: List Tools"
curl -s -X POST $ENDPOINT \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
| jq '.result.tools | length'
# Test 2: Call tool with valid params
echo "Test 2: Call Tool (Valid)"
curl -s -X POST $ENDPOINT \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_weather","arguments":{"city":"San Francisco"}}}' \
| jq '.result'
# Test 3: Call tool with missing param (should error)
echo "Test 3: Call Tool (Missing Param)"
curl -s -X POST $ENDPOINT \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_weather","arguments":{}}}' \
| jq '.error.code'
echo "Tests complete!"Run: chmod +x test-mcp.sh && ./test-mcp.sh
Monitoring Test Results
Success Indicators
✅ Status Code: 200 OK ✅ Response Format: Valid JSON-RPC 2.0 ✅ Result Field: Present (no error) ✅ Data Matches Schema: Follows output schema
Failure Indicators
❌ Status Code: 4xx or 5xx ❌ Error Field: Present with code and message ❌ Invalid JSON: Malformed response ❌ Timeout: No response within reasonable time
Common Test Scenarios
Scenario 1: New Tool Added
- List tools to verify it appears
- Call tool with valid parameters
- Verify response format
- Test edge cases
Scenario 2: Mock Scenario Updated
- Call tool with scenario condition
- Verify new mock data returned
- Test fallback if condition not met
Scenario 3: Schema Changed
- Call tool with old parameters (should fail or adapt)
- Call tool with new parameters
- Verify backward compatibility if needed
Performance Testing
Response Time
Measure endpoint performance:
time curl -X POST https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Expected: < 500ms for most requests
Load Testing
Use Apache Bench:
ab -n 100 -c 10 -p request.json -T application/json \
https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp-n 100: 100 requests total-c 10: 10 concurrent requests
Next Steps
After testing:
- Fix Issues - Address any errors found
- Update Documentation - Reflect any changes
- Check Compliance - Verify design rules
- Publish - When tests pass, publish to Exchange
Related Guides
- Creating Your First MCP Server - Build a server
- Using Design Rules - Ensure quality
- Publishing to Exchange - Share your work
- API Reference - Complete endpoint docs
Need help? Check the MCP Methods Reference for complete method documentation.