mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
## Features - MCP stdio→SSE bridge: expose local stdio MCP plugins over SSE (api/mcp/[plugin]/sse, /message) - Dynamic Linux cert resolution + NSS DB injection (Debian/Arch/Fedora/openSUSE, Chrome/Chromium/Firefox incl. snap) (#1010) - Cowork tool: expanded settings UI & API - GitBook docs (DocsContent, DocsLayout) ## Fixes - OAuth callback postMessage scoped to expected origins (CWE-1385) (#998) - Re-enable TLS verification on DNS-bypass fetch (CWE-295) (#998) - Normalize `developer` role → `system` for OpenAI-format providers (Deepseek, Groq, …) (#1011, closes #773) - Respect `PORT` env in internal model-test fetch (#1014) - Dropdown text readability in dark theme on usage page (#997) ## Improvements - Refactor Claude CLI spoof headers into shared constant - Tool deduper utility in open-sse handlers
73 lines
2.4 KiB
JavaScript
73 lines
2.4 KiB
JavaScript
// Default remote plugins for Claude Cowork (3p managedMcpServers, HTTPS only).
|
|
const DEFAULT_PLUGINS = [
|
|
{
|
|
name: "exa",
|
|
title: "Exa",
|
|
description: "Real-time web search and code documentation",
|
|
url: "https://mcp.exa.ai/mcp",
|
|
transport: "http",
|
|
oauth: false,
|
|
toolNames: ["web_search_exa", "web_fetch_exa"],
|
|
},
|
|
{
|
|
name: "tavily",
|
|
title: "Tavily",
|
|
description: "Real-time web search optimized for LLM agents",
|
|
url: "https://mcp.tavily.com/mcp",
|
|
transport: "http",
|
|
oauth: true,
|
|
toolNames: ["tavily_search", "tavily_extract", "tavily_crawl", "tavily_map"],
|
|
},
|
|
];
|
|
|
|
// Local stdio plugins bridged via inline SSE endpoint on the app's port.
|
|
const LOCAL_STDIO_PLUGINS = [
|
|
{
|
|
name: "browsermcp",
|
|
title: "Browser MCP",
|
|
description: "Control your running Chrome (requires Chrome extension)",
|
|
extensionUrl: "https://chromewebstore.google.com/detail/browser-mcp-automate-your/bjfgambnhccakkhmkepdoekmckoijdlc",
|
|
command: "npx",
|
|
args: ["-y", "@browsermcp/mcp@latest"],
|
|
toolNames: ["browser_navigate", "browser_snapshot", "browser_click", "browser_type", "browser_screenshot", "browser_get_console_logs", "browser_wait", "browser_press_key", "browser_go_back", "browser_go_forward"],
|
|
},
|
|
];
|
|
|
|
function buildManagedMcpServers(plugins) {
|
|
const list = Array.isArray(plugins) ? plugins : [];
|
|
const out = [];
|
|
const seen = new Set();
|
|
for (const p of list) {
|
|
if (!p?.name || !p?.url || seen.has(p.name)) continue;
|
|
seen.add(p.name);
|
|
const entry = {
|
|
name: p.name,
|
|
url: p.url,
|
|
transport: p.transport || (/\/sse(\b|\/)/i.test(p.url) ? "sse" : "http"),
|
|
};
|
|
if (p.oauth) entry.oauth = true;
|
|
if (Array.isArray(p.toolNames) && p.toolNames.length > 0) {
|
|
// Strip any pre-existing "{name}-" prefixes (idempotent across re-applies),
|
|
// then emit both bare + single-prefixed variants to match runtime tool naming.
|
|
const prefix = `${p.name}-`;
|
|
const bare = new Set();
|
|
for (const raw of p.toolNames) {
|
|
if (typeof raw !== "string" || !raw) continue;
|
|
let t = raw;
|
|
while (t.startsWith(prefix)) t = t.slice(prefix.length);
|
|
bare.add(t);
|
|
}
|
|
const policy = {};
|
|
for (const t of bare) {
|
|
policy[t] = "allow";
|
|
policy[`${prefix}${t}`] = "allow";
|
|
}
|
|
entry.toolPolicy = policy;
|
|
}
|
|
out.push(entry);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
module.exports = { DEFAULT_PLUGINS, LOCAL_STDIO_PLUGINS, buildManagedMcpServers };
|