fix(mcp): require the panel key for panel requests

panel_request now requires a key that each MCP server generates and places
in its panel page, which keeps the tool from clients that list it to the
model without loading the panel. The key is not access control: any MCP
client can read the panel page. Routes the panel never loads (provider
settings, credential and model endpoints, the MCP endpoint and development
server internals) are refused to every caller, regardless of letter case or
encoding.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Sameh KhamisandClaude Opus 5.5 committed 2026-10-02 19:47:37 -07:00
1 parent b1a958242c
commit 3318390e3f
9 files changed
+209 -23

No files matched your search

+4 -2
View File
@@ -4,6 +4,8 @@
* the sources' relative `/api/...` paths; in a browser the page's own fetch
* does, and elsewhere a caller supplies a resolving fetch. `appUrl` is the
* address the app is served from; `app.fetch` requests the app's own paths.
* `panelKey`, when the panel is offered, is the key its page carries, which
* the panel's requests must include.
*/
import { createAlprTileSource } from '../layers/alpr/source.js';
@@ -40,12 +42,12 @@ import {
} from './places.js';
/** Construct every service Core's tools read. */
export function createToolServices({ fetchImpl, appUrl }) {
export function createToolServices({ fetchImpl, appUrl, panelKey }) {
if (typeof fetchImpl !== 'function')
throw new TypeError('A fetch implementation is required');
const requests = createApplicationRequestServices({ fetchImpl });
return {
app: { baseUrl: appUrl, fetch: fetchImpl },
app: { baseUrl: appUrl, fetch: fetchImpl, panelKey },
earthquakes: createUsgsEarthquakeSource({ fetchImpl }),
fires: createFirmsSource({ fetchImpl }),
launches: createLaunchSource({ fetchImpl }),