MCP Hello World
A minimal MCP (Model Context Protocol) server that responds with "Hello, World" via Streamable HTTP. This project serves as a reference implementation and integration testing baseline for MCP client development.
Features
- Streamable HTTP MCP endpoint at
/mcp
that returns "Hello, World" - Health check endpoint at
/healthz
for monitoring - Prometheus metrics at
/metrics
for observability - Production-ready with proper error handling, logging, and security
- TypeScript codebase with comprehensive test coverage
- Docker support for containerized deployment
- Cloud Run ready for serverless deployment
Quick Start
Prerequisites
- Node.js 20+
- npm or yarn
Local Development
- Install dependencies
- Start development server
- Test the endpoints
Using with MCP Inspector
The primary use case is connecting via MCP Inspector for integration testing:
- Deploy or run locally (see deployment options below)
- Open MCP Inspector in your browser
- Connect to your MCP server
- Local development:
http://localhost:8080/mcp
- Cloud Run:
https://your-service-url.run.app/mcp
- Local development:
- Verify connection
- You should see "Hello, World" message
- Connection status should show as connected
- Response time should be < 300ms (excluding cold starts)
API Endpoints
POST /mcp
- MCP Streamable HTTP
Main MCP endpoint that implements the Streamable HTTP protocol.
Request:
Response: Server-Sent Events stream
Headers:
Content-Type: text/event-stream
Cache-Control: no-store
Access-Control-Allow-Origin: *
GET /healthz
- Health Check
Returns server health status and uptime.
Response:
GET /metrics
- Prometheus Metrics
Returns metrics in Prometheus text exposition format.
Key Metrics:
mcp_hello_world_http_requests_total
- HTTP request countermcp_hello_world_handshake_total
- MCP handshake countermcp_hello_world_handshake_duration_seconds
- MCP handshake latencymcp_hello_world_uptime_seconds
- Server uptimemcp_hello_world_cold_start_total
- Cold start counter (Cloud Run)
Development
Scripts
Testing
The project has comprehensive test coverage with 38 tests covering:
- Core MCP functionality - handshake, response format, error handling
- HTTP endpoints - health checks, metrics, CORS
- Error scenarios - malformed requests, method validation
- Metrics collection - counters, histograms, gauges
- Logging - structured logs, request IDs
Run tests with coverage:
Code Quality
- ESLint for code linting with TypeScript rules
- Prettier for code formatting
- TypeScript with strict configuration
- Vitest for testing with coverage reporting
- Conventional Commits for commit messages
Deployment
Docker
- Build the image
- Run the container
Google Cloud Platform (Automated)
This project uses GCP Cloud Build for automated CI/CD. Every push to the main branch triggers:
- Automated Build Pipeline (via
cloudbuild.yaml
):- Code quality checks (TypeScript, ESLint)
- Test execution with coverage
- Docker image build and push to Artifact Registry
- SBOM generation and security scanning
- Automatic deployment to Cloud Run
- Health checks and endpoint testing
- Setup GCP Cloud Build Trigger:
- Manual Deployment (if needed):
- Get the service URL:
Environment Variables
Variable | Required | Default | Description |
---|---|---|---|
PORT | No | 8080 | Server port |
NODE_ENV | No | development | Environment (development/production) |
LOG_LEVEL | No | info/debug | Logging level |
REGION | No | unknown | Deployment region |
BUILD_SHA | No | dev | Build/commit SHA |
INSTANCE_ID | No | local | Instance identifier |
Architecture
Technology Stack
- Runtime: Node.js 20 LTS
- Framework: Fastify (high performance HTTP server)
- Language: TypeScript with strict configuration
- Logging: Pino (structured JSON logging)
- Metrics: prom-client (Prometheus metrics)
- Testing: Vitest + @vitest/coverage-v8
- Container: Multi-stage Docker build with Alpine Linux
Security
- OWASP ASVS Level 1 compliance
- CORS properly configured for MCP Inspector
- Rate limiting (100 requests/minute)
- Security headers via Helmet
- Input validation and request size limits
- Secrets management via environment variables
- Non-root container execution
- Log sanitization (redacts auth headers)
Performance
- Target latency: p95 < 300ms (excluding cold starts)
- Cold start tracking for Cloud Run deployments
- Connection pooling and keep-alive
- Efficient JSON parsing and SSE streaming
- Graceful shutdown handling
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes with tests
- Run the test suite (
npm test
) - Run linting (
npm run lint
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
Apache-2.0 License - see the LICENSE file for details.
Related Projects
- Model Context Protocol - The MCP specification
- MCP Inspector - MCP client testing tool
- Fastify - Fast and low overhead web framework
Support
- Documentation: See the
/Documentation
folder for detailed specs - Issues: Report bugs via GitHub Issues
- Community: Join the MCP community discussions
🤖 Generated with Claude Code
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A minimal reference implementation of an MCP server that responds with "Hello, World" via Streamable HTTP. Serves as a baseline for integration testing and MCP client development with production-ready features including health checks, metrics, and containerized deployment.
Related MCP Servers
- -securityFlicense-qualityA minimal TypeScript MCP server that provides a 'hello' tool using the fastMCP framework.Last updated -
- -securityFlicense-qualityA simple MCP server implementation that demonstrates streaming capabilities with tools for greetings and notifications, accessible through an interactive command-line client.Last updated -1
- -securityAlicense-qualityA server that implements the Model Context Protocol (MCP) with StreamableHTTP transport, enabling standardized interaction with model services through a RESTful API interface.Last updated -991MIT License
- -securityFlicense-qualityA minimal, containerized MCP server that exposes a Streamable HTTP transport with API key authentication, allowing secure access to MCP endpoints.Last updated -