feat: Auto-connect WebMCP without agent intervention

- Add requestToken() and autoConnect() functions to request tokens directly from WebMCP server
- Add /api/webmcp-request-token endpoint to proxy token requests (for HTTPS/Traefik)
- Add webmcpHttp endpoint configuration for direct WebMCP HTTP API access
- Update App.vue to auto-connect on load with polling fallback
- Add kill-ports script to clear ports 4101, 4102, 4103, 4105 before starting
This commit is contained in:
2026-02-14 16:15:49 -06:00
parent 2766cbfd0b
commit 50f670f66c
7 changed files with 145 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
import { optionsResponse, notFoundResponse } from '../utils/cors'
import { handleHistory } from './history'
import { handleConfig, handleHealth } from './config'
import { handleWebMCPToken } from './webmcp'
import { handleWebMCPToken, handleWebMCPRequestToken } from './webmcp'
import { handleComponents, handleComponentById, handleComponentUsage } from './components'
import { handleThemes, handleActiveTheme, handleDesignTokens, handleThemeById, handleThemeExport } from './themes'
import { handleCanvas, handleCanvasById, handleToolbarCanvas, handleDefaultCanvas, handleCanvasComponents, handleCanvasComponentById } from './canvas'
@@ -38,12 +38,18 @@ export async function handleRequest(req: Request): Promise<Response> {
if (res) return res
}
// WebMCP Token
// WebMCP Token (for polling - legacy)
if (path === '/api/webmcp-token') {
const res = await handleWebMCPToken(req)
if (res) return res
}
// WebMCP Request Token (direct request to WebMCP server)
if (path === '/api/webmcp-request-token') {
const res = await handleWebMCPRequestToken(req)
if (res) return res
}
// Claude Code status (thinking/idle)
if (path === '/api/claude-status') {
const res = await handleClaudeStatus(req)