Skip to main content
Glama

Weather MCP Server

by gmailhasan
HTTP-QUICKSTART.md2.34 kB
# HTTP MCP Server Quick Start Guide ## Starting the Server ```bash npm run build node build/index.js ``` Server runs on: `http://localhost:3000` ## Testing the Server ### 1. Health Check ```bash curl http://localhost:3000/health ``` Expected response: ```json { "status": "ok", "server": "weather-mcp-server" } ``` ### 2. Using the Provided HTTP Client ```bash node mcp-http-client.js ``` ### 3. Manual HTTP Request Initialize a session: ```bash curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": { "name": "test-client", "version": "1.0.0" } } }' ``` ## Environment Variables - `PORT` - Server port (default: 3000) Example: ```bash PORT=8080 node build/index.js ``` ## Architecture The HTTP server uses: - **Express.js** for HTTP handling - **StreamableHTTPServerTransport** from MCP SDK - **Session management** for multiple concurrent clients - **Server-Sent Events (SSE)** for streaming responses ## Endpoints | Method | Path | Description | | ------ | ------- | ---------------------- | | GET | /health | Health check | | POST | /mcp | Main MCP endpoint | | GET | /mcp | SSE streaming endpoint | | DELETE | /mcp | Close session | ## Session Management Each client connection gets a unique session ID via the `Mcp-Session-Id` header. The server maintains separate transport instances for each active session. ## Differences from Stdio Transport | Feature | Stdio | HTTP | | ---------- | -------------- | --------------------- | | Transport | stdin/stdout | HTTP/SSE | | Deployment | Local only | Local or remote | | Clients | Single process | Multiple concurrent | | Debugging | Terminal logs | HTTP logs + tools | | Scaling | Not scalable | Horizontally scalable | ## Next Steps - Deploy to a cloud service (Azure, AWS, GCP) - Add authentication/authorization - Implement rate limiting - Add CORS for browser clients - Monitor with application insights

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gmailhasan/mcpexample'

If you have feedback or need assistance with the MCP directory API, please join our Discord server