2026-04-10 21:15:53 +08:00
|
|
|
/**
|
2026-04-10 21:24:50 +08:00
|
|
|
* Bookworm MCP 注入脚本 v2 — 同步 Bookworm v6.5.1 全部 22 个 portable MCP
|
|
|
|
|
* 安全合并到 ~/.claude.json (保留所有现有字段)
|
2026-04-10 21:15:53 +08:00
|
|
|
* 用法: node inject-mcp.js
|
|
|
|
|
*/
|
|
|
|
|
const fs = require("fs");
|
|
|
|
|
const path = require("path");
|
2026-04-10 21:24:50 +08:00
|
|
|
const HOME = process.env.USERPROFILE || process.env.HOME || "";
|
2026-04-10 21:15:53 +08:00
|
|
|
|
2026-04-10 21:24:50 +08:00
|
|
|
const f = path.join(HOME, ".claude.json");
|
2026-04-10 21:15:53 +08:00
|
|
|
let d = {};
|
2026-04-10 21:24:50 +08:00
|
|
|
try { d = JSON.parse(fs.readFileSync(f, "utf8")); } catch (e) {}
|
2026-04-10 21:15:53 +08:00
|
|
|
|
|
|
|
|
d.mcpServers = {
|
2026-04-10 21:24:50 +08:00
|
|
|
// ── Tier 1: npx (无需 API Key) ──
|
2026-04-10 21:15:53 +08:00
|
|
|
"context7": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "@upstash/context7-mcp@2.1.1"], type: "stdio"
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"sequential-thinking": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-sequential-thinking@2025.12.18"], type: "stdio"
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"playwright": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "@playwright/mcp@0.0.68", "--headless"], type: "stdio"
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"session-continuity": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "claude-session-continuity-mcp@1.13.0"], type: "stdio"
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
2026-04-10 21:24:50 +08:00
|
|
|
"browser-mcp": {
|
|
|
|
|
command: "npx.cmd", args: ["--yes", "@browsermcp/mcp@latest"], type: "stdio"
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
2026-04-10 21:24:50 +08:00
|
|
|
"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" }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"chrome-devtools": {
|
|
|
|
|
command: "npx.cmd",
|
2026-04-10 21:24:50 +08:00
|
|
|
args: ["--yes", "chrome-devtools-mcp@0.18.1",
|
2026-04-10 21:15:53 +08:00
|
|
|
"--executablePath", "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
|
2026-04-10 21:24:50 +08:00
|
|
|
"--viewport", "1280x720", "--proxyServer", "http://127.0.0.1:7893"],
|
2026-04-10 21:15:53 +08:00
|
|
|
type: "stdio"
|
|
|
|
|
},
|
2026-04-10 21:24:50 +08:00
|
|
|
"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 (凭证从环境变量读取) ──
|
2026-04-10 21:15:53 +08:00
|
|
|
"github": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-github"], type: "stdio",
|
|
|
|
|
env: { GITHUB_PERSONAL_ACCESS_TOKEN: process.env.GITHUB_PERSONAL_ACCESS_TOKEN || "" }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"slack": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "@modelcontextprotocol/server-slack"], type: "stdio",
|
|
|
|
|
env: { SLACK_BOT_TOKEN: process.env.SLACK_BOT_TOKEN || "", SLACK_TEAM_ID: "T0A4L1JLEER" }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"firecrawl": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "npx.cmd", args: ["--yes", "firecrawl-mcp"], type: "stdio",
|
|
|
|
|
env: { FIRECRAWL_API_KEY: process.env.FIRECRAWL_API_KEY || "" }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"mcp-image": {
|
2026-04-10 21:24:50 +08:00
|
|
|
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") }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
|
|
|
|
"google-drive": {
|
2026-04-10 21:24:50 +08:00
|
|
|
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") }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
2026-04-10 21:24:50 +08:00
|
|
|
"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" }
|
2026-04-10 21:15:53 +08:00
|
|
|
},
|
2026-04-10 21:24:50 +08:00
|
|
|
"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" },
|
2026-04-10 21:15:53 +08:00
|
|
|
"atlassian": {
|
2026-04-10 21:24:50 +08:00
|
|
|
command: "uvx", args: ["mcp-atlassian"], type: "stdio",
|
2026-04-10 21:15:53 +08:00
|
|
|
env: {
|
2026-04-10 21:24:50 +08:00
|
|
|
JIRA_URL: "https://huakoh.atlassian.net", JIRA_USERNAME: "huakoh449@gmail.com",
|
2026-04-10 21:15:53 +08:00
|
|
|
JIRA_API_TOKEN: process.env.ATLASSIAN_API_TOKEN || "",
|
2026-04-10 21:24:50 +08:00
|
|
|
CONFLUENCE_URL: "https://huakoh.atlassian.net/wiki", CONFLUENCE_USERNAME: "huakoh449@gmail.com",
|
2026-04-10 21:15:53 +08:00
|
|
|
CONFLUENCE_API_TOKEN: process.env.ATLASSIAN_API_TOKEN || ""
|
|
|
|
|
}
|
2026-04-10 21:24:50 +08:00
|
|
|
},
|
|
|
|
|
"computer-control-mcp": { command: "uvx", args: ["computer-control-mcp@latest"], type: "stdio" }
|
2026-04-10 21:15:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync(f, JSON.stringify(d, null, 2));
|
|
|
|
|
const count = Object.keys(d.mcpServers).length;
|
2026-04-10 21:24:50 +08:00
|
|
|
console.log("OK: " + count + " MCP servers -> " + f);
|