bookworm-boot/inject-mcp.js

105 lines
4.6 KiB
JavaScript
Raw Normal View History

/**
* Bookworm MCP 注入脚本 v2 同步 Bookworm v6.5.1 全部 22 portable MCP
* 安全合并到 ~/.claude.json ()
* 用法: node inject-mcp.js
*/
const fs = require("fs");
const path = require("path");
const HOME = process.env.USERPROFILE || process.env.HOME || "";
const f = path.join(HOME, ".claude.json");
let d = {};
try { d = JSON.parse(fs.readFileSync(f, "utf8")); } catch (e) {}
d.mcpServers = {
// ── Tier 1: npx (无需 API Key) ──
"context7": {
command: "npx.cmd", args: ["--yes", "@upstash/context7-mcp@2.1.1"], type: "stdio"
},
"sequential-thinking": {
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-sequential-thinking@2025.12.18"], type: "stdio"
},
"playwright": {
command: "npx.cmd", args: ["--yes", "@playwright/mcp@0.0.68", "--headless"], type: "stdio"
},
"session-continuity": {
command: "npx.cmd", args: ["--yes", "claude-session-continuity-mcp@1.13.0"], type: "stdio"
},
"browser-mcp": {
command: "npx.cmd", args: ["--yes", "@browsermcp/mcp@latest"], type: "stdio"
},
"desktop-commander": {
command: "npx.cmd", args: ["--yes", "@wonderwhy-er/desktop-commander@latest"], type: "stdio",
env: { PUPPETEER_SKIP_DOWNLOAD: "true", PUPPETEER_EXECUTABLE_PATH: "C:/Program Files/Google/Chrome/Application/chrome.exe" }
},
"chrome-devtools": {
command: "npx.cmd",
args: ["--yes", "chrome-devtools-mcp@0.18.1",
"--executablePath", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
"--viewport", "1280x720", "--proxyServer", "http://127.0.0.1:7893"],
type: "stdio"
},
"mobile": {
command: "npx.cmd", args: ["--yes", "@mobilenext/mobile-mcp@0.0.35"], type: "stdio",
env: { ANDROID_HOME: path.join(HOME, "android-sdk") }
},
// ── Tier 2: npx + API Key (凭证从环境变量读取) ──
"github": {
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-github"], type: "stdio",
env: { GITHUB_PERSONAL_ACCESS_TOKEN: process.env.GITHUB_PERSONAL_ACCESS_TOKEN || "" }
},
"slack": {
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-slack"], type: "stdio",
env: { SLACK_BOT_TOKEN: process.env.SLACK_BOT_TOKEN || "", SLACK_TEAM_ID: "T0A4L1JLEER" }
},
"firecrawl": {
command: "npx.cmd", args: ["--yes", "firecrawl-mcp"], type: "stdio",
env: { FIRECRAWL_API_KEY: process.env.FIRECRAWL_API_KEY || "" }
},
"mcp-image": {
command: "npx.cmd", args: ["--yes", "mcp-image"], type: "stdio",
env: { GEMINI_API_KEY: process.env.GEMINI_API_KEY || "", IMAGE_OUTPUT_DIR: path.join(HOME, "Pictures/mcp-images") }
},
"google-drive": {
command: "npx.cmd", args: ["--yes", "@piotr-agier/google-drive-mcp"], type: "stdio",
env: { GOOGLE_DRIVE_OAUTH_CREDENTIALS: path.join(HOME, ".config/google-drive-mcp/gcp-oauth.keys.json") }
},
"browserbase": {
command: "npx.cmd", args: ["--yes", "@anthropic-ai/browserbase-mcp"], type: "stdio",
env: { BROWSERBASE_API_KEY: process.env.BROWSERBASE_API_KEY || "", BROWSERBASE_PROJECT_ID: "d3dbb32f-be2f-4e3a-b9ec-68e27474763c" }
},
// ── Tier 3: npx + 代理 (需要外网访问) ──
"notebooklm": {
command: "npx.cmd", args: ["--yes", "notebooklm-mcp@latest"], type: "stdio",
env: { https_proxy: "http://127.0.0.1:7893", http_proxy: "http://127.0.0.1:7893" }
},
"cloudflare": {
command: "npx.cmd", args: ["--yes", "mcp-remote", "https://docs.mcp.cloudflare.com/sse"], type: "stdio",
env: { https_proxy: "http://127.0.0.1:7893", http_proxy: "http://127.0.0.1:7893" }
},
// ── Tier 4: HTTP (零安装, 云端托管) ──
"linear": { type: "http", url: "https://mcp.linear.app/mcp" },
"supabase": { type: "http", url: "https://mcp.supabase.com/mcp?project_ref=oepmihbtoylosbsxlmfo" },
"figma": { type: "http", url: "https://mcp.figma.com/mcp" },
// ── Tier 5: Python/uvx (需要 Python + uv) ──
"windows-mcp": { command: "uvx", args: ["--python", "3.13", "windows-mcp"], type: "stdio" },
"atlassian": {
command: "uvx", args: ["mcp-atlassian"], type: "stdio",
env: {
JIRA_URL: "https://huakoh.atlassian.net", JIRA_USERNAME: "huakoh449@gmail.com",
JIRA_API_TOKEN: process.env.ATLASSIAN_API_TOKEN || "",
CONFLUENCE_URL: "https://huakoh.atlassian.net/wiki", CONFLUENCE_USERNAME: "huakoh449@gmail.com",
CONFLUENCE_API_TOKEN: process.env.ATLASSIAN_API_TOKEN || ""
}
},
"computer-control-mcp": { command: "uvx", args: ["computer-control-mcp@latest"], type: "stdio" }
};
fs.writeFileSync(f, JSON.stringify(d, null, 2));
const count = Object.keys(d.mcpServers).length;
console.log("OK: " + count + " MCP servers -> " + f);