mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-17 18:25:42 +02:00
[eric] bundles: youtube MCP drops the googleapis monolith for a one-API shim, 32.6M to 3.7M, handshake-verified
This commit is contained in:
+2588
-782586
File diff suppressed because it is too large
Load Diff
+26
-1
@@ -252,7 +252,32 @@ build_mcp_bundle_dir() {
|
||||
}
|
||||
|
||||
build_mcp_bundle_single 'reddit-mcp-buddy' 'reddit-mcp-buddy/dist/index.js' 'reddit-mcp-buddy.js'
|
||||
build_mcp_bundle_single '@kirbah/mcp-youtube' '@kirbah/mcp-youtube/dist/index.js' 'kirbah-mcp-youtube.js'
|
||||
# YouTube gets its own build: upstream imports the 526-API googleapis monolith (plus a mongodb
|
||||
# driver rider) for exactly ONE surface, google.youtube. Aliasing googleapis to a single-API shim
|
||||
# shrinks the bundle 32.6M -> 3.7M, MCP-handshake-verified identical (same serverInfo, same 8 tools).
|
||||
build_youtube_mcp_bundle() {
|
||||
local out_file="$MCP_BUNDLE_DIR/kirbah-mcp-youtube.js"
|
||||
if [[ -f "$out_file" && -z "${OPENSWARM_REBUILD_BUNDLES:-}" ]]; then
|
||||
echo "[0b] @kirbah/mcp-youtube bundle already present (set OPENSWARM_REBUILD_BUNDLES=1 to force rebuild)."
|
||||
return
|
||||
fi
|
||||
echo "[0b] Bundling @kirbah/mcp-youtube (googleapis -> @googleapis/youtube shim) ..."
|
||||
local tmp_dir; tmp_dir=$(mktemp -d)
|
||||
(
|
||||
cd "$tmp_dir"
|
||||
npm install '@kirbah/mcp-youtube' '@googleapis/youtube' --silent 2>/dev/null
|
||||
printf '%s\n' 'const { youtube } = require("@googleapis/youtube");' 'module.exports = { google: { youtube } };' > googleapis-shim.js
|
||||
local banner='const __OPENSWARM_IMPORT_META_URL__ = require("url").pathToFileURL(__filename).href;'
|
||||
npx esbuild 'node_modules/@kirbah/mcp-youtube/dist/index.js' --bundle --platform=node --format=cjs --target=node22 --legal-comments=none \
|
||||
--define:import.meta.url=__OPENSWARM_IMPORT_META_URL__ \
|
||||
"--banner:js=$banner" \
|
||||
--alias:googleapis=./googleapis-shim.js \
|
||||
--outfile="$out_file"
|
||||
)
|
||||
rm -rf "$tmp_dir"
|
||||
echo "@kirbah/mcp-youtube bundled ($(du -h "$out_file" | cut -f1))."
|
||||
}
|
||||
build_youtube_mcp_bundle
|
||||
build_mcp_bundle_dir '@notionhq/notion-mcp-server' '@notionhq/notion-mcp-server/bin/cli.mjs' \
|
||||
'notionhq-notion-mcp-server' \
|
||||
'@notionhq/notion-mcp-server/scripts/notion-openapi.json=scripts/notion-openapi.json' \
|
||||
|
||||
Reference in New Issue
Block a user