File size: 2,505 Bytes
88c4c60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | // 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 };
|