feat(plugin): support running the MCP server on a remote host (not just localhost)

This commit is contained in:
Fernando Basello 2026-01-10 20:41:16 -03:00
parent 0657394240
commit dc3c407ac5
2 changed files with 6 additions and 1 deletions

View File

@ -42,7 +42,9 @@ function connectToMcpServer(): void {
}
try {
ws = new WebSocket("ws://localhost:4402");
// Use environment variable for MCP WebSocket URL, fallback to localhost for local development
const mcpWsUrl = import.meta.env.VITE_MCP_WS_URL || "ws://localhost:4402";
ws = new WebSocket(mcpWsUrl);
updateConnectionStatus("Connecting...", false);
ws.onopen = () => {

View File

@ -26,5 +26,8 @@ export default defineConfig({
preview: {
port: 4400,
cors: true,
allowedHosts: process.env.VITE_ALLOWED_HOSTS
? process.env.VITE_ALLOWED_HOSTS.split(",").map((h) => h.trim())
: ["localhost", "0.0.0.0"],
},
});