User GuidesTesting MCP Endpoints

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:

  1. cURL - Command-line testing
  2. Postman - GUI-based testing
  3. MCP Inspector - Official testing tool
  4. 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

  1. Open Postman
  2. Create a new request
  3. Set method to POST
  4. Enter URL: https://ma2d.vercel.app/api/platform/YOUR_SERVER_ID/mcp
  5. 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:

  1. Save request as “List Tools”
  2. Create collection “MCP Server Tests”
  3. Add more requests for different methods
  4. 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/mcp

Features

The MCP Inspector provides:

  • Interactive interface
  • Tool discovery
  • Parameter forms
  • Response viewer
  • Error highlighting

Usage

  1. Inspector opens in browser
  2. Shows available tools automatically
  3. Click a tool to see details
  4. Fill in parameters
  5. Click “Call” to test
  6. 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/list returns all tools
  • tools/call executes successfully
  • resources/list returns resources
  • resources/read provides content
  • prompts/list shows 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

  1. List tools to verify it appears
  2. Call tool with valid parameters
  3. Verify response format
  4. Test edge cases

Scenario 2: Mock Scenario Updated

  1. Call tool with scenario condition
  2. Verify new mock data returned
  3. Test fallback if condition not met

Scenario 3: Schema Changed

  1. Call tool with old parameters (should fail or adapt)
  2. Call tool with new parameters
  3. 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:

  1. Fix Issues - Address any errors found
  2. Update Documentation - Reflect any changes
  3. Check Compliance - Verify design rules
  4. Publish - When tests pass, publish to Exchange

Need help? Check the MCP Methods Reference for complete method documentation.