mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
Mount the local MCP server at /mcp on the development and preview servers for clients that connect by URL. The route accepts only requests from this machine that name a loopback host and, when an Origin is sent, come from a loopback origin, and drains oversized bodies so the 413 response is delivered. The provider-order regression test now pins the route between the providers and the API fallback.
25 lines
983 B
JavaScript
25 lines
983 B
JavaScript
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
import { createBrowserViteConfig } from '../../build/vite.js';
|
|
import { localProviderPlugins } from '../providers/local.js';
|
|
import { localMcpPlugin } from '../mcp/plugin.js';
|
|
import { apiNotFoundPlugin } from './api-not-found.js';
|
|
|
|
const root = fileURLToPath(new URL('../../', import.meta.url));
|
|
|
|
/** Load this checkout's configuration and attach its local provider middleware. */
|
|
export default defineConfig(({ command, mode }) => {
|
|
const loaded = loadEnv(mode, root, '');
|
|
for (const [key, value] of Object.entries(loaded)) {
|
|
if (process.env[key] === undefined) process.env[key] = value;
|
|
}
|
|
return createBrowserViteConfig({
|
|
plugins: [...localProviderPlugins(), localMcpPlugin(), apiNotFoundPlugin()],
|
|
googleApiKey: process.env.GOOGLE_MAPS_API_KEY,
|
|
cesiumToken: process.env.CESIUM_ION_TOKEN,
|
|
host: process.env.HOST,
|
|
port: process.env.PORT,
|
|
command,
|
|
});
|
|
});
|