Skip to content

Commit b8b0b7f

Browse files
committed
chore(http): add health endpoint
1 parent e92b643 commit b8b0b7f

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/transports/http.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ export class HttpTransport implements Transport {
9898
req: IncomingMessage,
9999
res: ServerResponse,
100100
): Promise<void> {
101+
console.error(`[${new Date().toISOString()}] ${req.method} ${req.url}`)
102+
101103
// Handle CORS preflight
102104
if (req.method === 'OPTIONS') {
103105
res.writeHead(204, {
@@ -109,10 +111,29 @@ export class HttpTransport implements Transport {
109111
return
110112
}
111113

114+
// Health check endpoint
115+
if (req.url === '/health' && req.method === 'GET') {
116+
res.writeHead(200, { 'Content-Type': 'application/json' })
117+
res.end(JSON.stringify({ status: 'ok' }))
118+
return
119+
}
120+
121+
// Root endpoint - info page
122+
if (req.url === '/' && req.method === 'GET') {
123+
res.writeHead(200, { 'Content-Type': 'application/json' })
124+
res.end(JSON.stringify({
125+
name: 'Vuetify MCP Server',
126+
version: '0.1.1',
127+
mcp_endpoint: this.options.path,
128+
health_endpoint: '/health'
129+
}))
130+
return
131+
}
132+
112133
// Only handle requests to the MCP path
113134
if (req.url !== this.options.path) {
114135
res.writeHead(404, { 'Content-Type': 'text/plain' })
115-
res.end('Not Found')
136+
res.end(`Not Found. Try ${this.options.path} for MCP endpoint or /health for health check.`)
116137
return
117138
}
118139

0 commit comments

Comments
 (0)