# Task ID: 26 **Title:** Add HTTP REST server to mcplocal **Status:** done **Dependencies:** 25 ✓ **Priority:** high **Description:** Add a Fastify HTTP server to mcplocal that runs alongside the existing stdio server, providing REST endpoints for mcpctl management commands. **Details:** 1. Add Fastify dependency to mcplocal package.json: `@fastify/cors`, `fastify` 2. Create `src/mcplocal/src/http/server.ts` with Fastify app setup: ```typescript import Fastify from 'fastify'; import cors from '@fastify/cors'; export async function createHttpServer(config: HttpServerConfig) { const app = Fastify({ logger: true }); await app.register(cors, { origin: true }); // Register routes return app; } ``` 3. Create `src/mcplocal/src/http/routes/` directory structure 4. Create health check endpoint: `GET /health` 5. Create config types in `src/mcplocal/src/config.ts`: - `httpPort`: number (default 3200) - `httpHost`: string (default '127.0.0.1') - `mcpdUrl`: string (default 'http://localhost:3100') 6. Update mcplocal entry point to start both servers: - stdio server for Claude MCP protocol - HTTP server for mcpctl REST API 7. Add graceful shutdown handling for both servers **Test Strategy:** 1. Unit test: HTTP server starts on configured port 2. Unit test: Health endpoint returns 200 OK 3. Integration test: Both stdio and HTTP servers can run simultaneously 4. Test graceful shutdown stops both servers cleanly 5. Test CORS headers are present on responses 6. Manual test: curl http://localhost:3200/health