test-mcp-server

Commands-com/test-mcp-server

3.2

If you are the rightful owner of test-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a comprehensive guide to setting up and deploying an MCP server using the create-commands-mcp template.

Tools
  1. ping

    Test server connectivity

  2. echo

    Echo back user input

  3. datetime

    Get current date/time in various formats

my-server

MCP server created with api template

Created with create-commands-mcp

Quick Start

# Install dependencies
npm install

# Configure environment (optional)
cp .env.example .env
# Customize settings if needed - works out of the box!

# Start development server
npm run dev

# Test your server
curl http://localhost:3000/health

Available Tools

  • ping - Test server connectivity
  • echo - Echo back user input
  • datetime - Get current date/time in various formats

Development

Adding New Tools

Quick Start

  1. Create a new tool file in src/tools/:
// src/tools/myTool.ts
export const myTool = {
  name: "my_tool",
  description: "Does something useful - be specific for better AI usage",
  inputSchema: {
    type: "object",
    properties: {
      input: { 
        type: "string", 
        description: "Clear description helps AI understand when to use this tool" 
      }
    },
    required: ["input"]
  },
  handler: async (args: { input: string }) => {
    // Your tool logic here
    return { 
      success: true,
      result: `Processed: ${args.input}`,
      // Return structured data when possible
    };
  }
};
  1. Export from src/tools/index.ts:
export { myTool } from './myTool';
  1. Test your tool:
npm run dev  # Start server
npm run doctor  # Verify tool registration

Tool Design Best Practices

  • šŸ“ Clear descriptions - AI needs to understand when to use your tool
  • šŸ”§ Specific input schemas - Define exactly what parameters you need
  • āœ… Error handling - Return meaningful error messages
  • šŸ“Š Structured output - Consistent response format helps AI usage
  • šŸš€ Performance - Keep tools fast (< 30s timeout recommended)

Documentation & Examples

Testing

# Run all tests
npm test

# Watch mode
npm run test:watch

# Health check
npm run doctor

Building

# Build TypeScript
npm run build

# Start production server
npm start

Commands.com Integration

JWT Validation (Works Immediately)

Your server automatically validates Commands.com JWTs using public JWKS:

# No setup required - works out of the box
npm run dev

# Test with any Commands.com JWT token
curl -H "Authorization: Bearer JWT_TOKEN" http://localhost:3000/ping

Gateway Integration (Optional)

To list your server on Commands.com and receive gateway traffic:

  1. Deploy your server to any hosting platform (Railway, Vercel, AWS, etc.)
  2. Register at Commands.com Creator Portal
  3. Configure your server's proxy URL in the Commands.com UI
  4. Commands.com gateway routes user requests to your self-hosted server
  5. You handle all server hosting and scaling
# Verify configuration
npm run doctor

Deployment

Railway (Recommended for Testing)

Quick Deploy in 2 minutes:

  1. Push to GitHub:

    git init && git add . && git commit -m "Initial commit"
    git remote add origin https://github.com/yourusername/my-server.git
    git push -u origin main
    
  2. Connect to Railway:

    • Visit railway.app
    • Connect your GitHub repository
    • Railway auto-detects and deploys instantly
  3. Get live URL:

    • Your server: https://my-server-production.up.railway.app
    • Test health: curl https://my-server-production.up.railway.app/health

Environment variables (optional):

  • Set in Railway dashboard if needed
  • Server works out-of-the-box with defaults

Vercel

  1. Connect your repository to Vercel
  2. Configure environment variables
  3. Deploy serverless functions

Docker

# Build image
docker build -t my-server .

# Run container
docker run -p 3000:3000 --env-file .env my-server

Commands.com Marketplace

Why Commands.com?

Commands.com provides a complete business platform for just 15% revenue share:

  • šŸŽÆ Marketing & Discovery - Marketplace promotion and user acquisition
  • šŸ’³ Stripe Billing - Payment processing and subscription management
  • šŸ” OAuth & Auth - User management and secure access
  • šŸ“Š Analytics - Usage tracking and performance insights
  • 🌐 Gateway Routing - Routes users to your self-hosted server

You keep 85% of revenue while hosting your own infrastructure.

Submit Your Server

  1. Deploy your server to any hosting platform
  2. Test your server: npm run commands:validate
  3. Submit to marketplace: Commands.com Creator Portal

Marketplace Guidelines

  • āœ… All tools must have clear descriptions
  • āœ… Error handling for all edge cases
  • āœ… Proper JWT authentication
  • āœ… Health check endpoint working
  • āœ… Rate limiting respected

Architecture

src/
ā”œā”€ā”€ index.ts              # Main server entry point
ā”œā”€ā”€ tools/                # Tool implementations
│   ā”œā”€ā”€ index.ts         # Tool exports
│   ā”œā”€ā”€ ping.ts          # Connectivity test
│   ā”œā”€ā”€ echo.ts          # Input/output test
│   └── datetime.ts      # System integration
ā”œā”€ā”€ auth/
│   └── verifyToken.ts   # JWT validation
ā”œā”€ā”€ types.ts             # TypeScript definitions
└── scripts/
    ā”œā”€ā”€ doctor.ts        # Health checks
    └── validate-commands.ts

Security

  • āœ… JWT tokens validated against Commands.com JWKS
  • āœ… Input validation on all tools
  • āœ… No secrets logged or exposed
  • āœ… CORS configured for Commands.com domains
  • āœ… Rate limiting implemented

Support

License

MIT