How srbhptl39/mcp-superassistant works
Project type and purpose
• This is a browser-based tool: a Chrome extension (“MCP SuperAssistant”) shipped from a monorepo.
• It injects a sidebar UI into various AI chat platforms (ChatGPT, Gemini, Perplexity, Grok, AIStudio, OpenRouter) to detect and execute MCP tool calls.
• It also includes a local-proxy “MCP SuperAssistant Proxy” to forward SSE calls to real MCP servers (CORS, health checks).
File structure
• Top-level:
• chrome-extension/ → extension manifest, background & content scripts, UI code, build config (Vite).
• pages/content/ → content-script React/Vite app that renders the sidebar in AI pages, plus pre-script engine.
• packages/ → reusable TS modules (dev-utils, env, hmr, i18n, module-manager, shared UI/hooks/utils, storage, tailwind-config, vite-config, zipper).
• root config: pnpm-workspace.yaml, turbo.json, tsconfig.json, build & CI workflows (.github), husky, eslint, prettier.
Key insights from README
• Extension detects MCP calls in AI responses → injects UI via content script.
• Uses SSE to communicate with a local proxy (npx @…/proxy) → forwards to actual MCP server.
• Built with Chrome-extension-boilerplate (React + Vite), TS, pnpm + turborepo.
Main components
A. Browser / AI Platform
• ChatGPT, Gemini, Perplexity, etc. (web pages).
B. Chrome Extension
1. Content Script (pages/content build output)
• Injects Sidebar UI (React)
• Detects tool calls in DOM
• Communicates with Background via chrome.runtime messaging
2. Background Script (chrome-extension/src/background)
• Holds connection to local proxy server via SSE/HTTP
• Forwards detected tool requests → local proxy
• Receives results → relays to Content Script
C. Local Proxy Server
• “MCP SuperAssistant Proxy” (npm package)
• SSE endpoint, CORS, health-checks
D. Actual MCP Server
• External Anthropic MCP endpoint
E. Monorepo Build System
• pnpm workspace + Turbo
• Packages (shared, ui, env, hmr, i18n…) feed into extension and content script builds
• Vite config from packages/vite-config
• Tailwind config from packages/tailwind-config
Relationships & interactions
1. User loads supported AI platform → content script injects sidebar UI.
2. User triggers tool execution → content script sends “execute” message to Background.
3. Background opens SSE/HTTP to Local Proxy.
4. Proxy forwards to Actual MCP Server → gets tool execution result.
5. Proxy streams results back via SSE → Background → Content Script.
6. Content Script inserts results back into AI chat DOM.
7. Under the hood, build tools (pnpm/Turbo) compile all packages + extension.
Architectural patterns & design principles
• Chrome Extension MVC: Content Script (View + Controller) ↔ Background (Model + Service)
• Monorepo with modular packages to maximize code reuse (env, i18n, storage, UI, dev-utils).
• HMR and watch plugins (packages/hmr) for rapid dev in both content script and extension.
• Config-as-code: shared tsconfig, eslint, prettier, tailwind across packages.
• Plugin architecture for adapters to multiple AI platforms (adapterRegistry in pages/content).
Relevant technologies & libraries
• TypeScript, React, Vite
• Chrome Extension Manifest v3, SSE, chrome.runtime messaging
• pnpm workspace, Turbo monorepo
• Tailwind CSS, postcss
• Rollup (for render_prescript)
• Packages: @srbhptl39/dev-utils, env, hmr, i18n, module-manager, shared, storage, ui, vite-config, tailwind-config, zipper
Diagramming recommendations
• Use clear labels: “Content Script”, “Background Script”, “Local Proxy Server”, “MCP Server”, “AI Platform Page”.
• content→background (chrome.runtime.sendMessage)
• background→proxy (HTTP/SSE)
• proxy→MCP server (HTTP)
• proxy→background (SSE)
• background→content (chrome.runtime.sendMessage)
• content→DOM injection
• Browser-side (blue)
• Extension scripts (orange)
• Local services (green)
• External services (gray)