62+ Chrome Extension API tools for Model Context Protocol - Let Claude, ChatGPT, and Gemini control your browser
Full Documentation | Quick Start
@mcp-b/extension-tools exposes Chrome Extension APIs as MCP tools, enabling AI agents like Claude, ChatGPT, Gemini, Cursor, and Copilot to control browser tabs, manage bookmarks, access history, execute scripts, and more.
| Feature | Benefit |
|---|---|
| 62+ Chrome APIs | Comprehensive coverage of Chrome Extension APIs |
| AI-Ready | Built for MCP, the standard for AI tool integration |
| Granular Control | Enable only the APIs your extension needs |
| Permission Aware | Automatic permission checking and clear error messages |
| Manifest V3 | Full support for Chrome's latest extension platform |
| TypeScript | Complete type definitions for all 62+ APIs |
- AI Browser Assistants: Let AI agents manage tabs, bookmarks, and browsing history
- Automated Testing: AI-driven browser automation and testing
- Research Tools: AI can search history, manage reading lists, and organize bookmarks
- Productivity Extensions: AI helps with tab management, session saving, and workflow automation
- Enterprise Tools: AI-powered browser management and policy enforcement
This package provides a comprehensive set of tool classes that expose Chrome Extension APIs through the Model Context Protocol (MCP). Each API is wrapped in a dedicated class that handles permission checking, error handling, and tool registration.
Currently, 62 out of 74 Chrome Extension APIs have been implemented and are ready to use. See the API Implementation Status section below for a complete list of available and pending APIs.
npm install @mcp-b/extension-tools @modelcontextprotocol/sdk
# or
pnpm add @mcp-b/extension-tools @modelcontextprotocol/sdk
# or
yarn add @mcp-b/extension-tools @modelcontextprotocol/sdkThe following Chrome Extension APIs have been fully implemented and are ready to use:
AlarmsApiTools- Set and manage alarmsAudioApiTools- Audio device managementBookmarksApiTools- Manage browser bookmarksBrowsingDataApiTools- Clear browsing dataCertificateProviderApiTools- Provide certificates for TLS authenticationCommandsApiTools- Manage keyboard shortcutsContentSettingsApiTools- Manage content settingsContextMenusApiTools- Create context menu itemsCookiesApiTools- Manage browser cookiesDebuggerApiTools- Debug network and JavaScriptDeclarativeContentApiTools- Take actions based on contentDeclarativeNetRequestApiTools- Modify network requestsDesktopCaptureApiTools- Capture desktop contentDevtoolsInspectedWindowApiTools- Interact with inspected windowDevtoolsNetworkApiTools- Retrieve network informationDevtoolsPanelsApiTools- Create DevTools panelsDocumentScanApiTools- Scan documentsDomApiTools- Access DOM from extensionsDownloadsApiTools- Control file downloadsEnterpriseDeviceAttributesApiTools- Access enterprise device attributesEnterpriseHardwarePlatformApiTools- Access enterprise hardware infoEnterpriseNetworkingAttributesApiTools- Access enterprise network attributesEnterprisePlatformKeysApiTools- Enterprise platform keysExtensionApiTools- Extension utilitiesFileBrowserHandlerApiTools- Handle file browser eventsFileSystemProviderApiTools- Provide file systemsFontSettingsApiTools- Manage font settingsGcmApiTools- Google Cloud MessagingHistoryApiTools- Search and manage browsing historyI18nApiTools- Internationalization utilitiesIdentityApiTools- OAuth2 authenticationIdleApiTools- Detect idle stateInputImeApiTools- Input method editorInstanceIDApiTools- Instance ID operationsLoginStateApiTools- Read login stateManagementApiTools- Manage extensionsNotificationsApiTools- Create system notificationsOffscreenApiTools- Manage offscreen documentsOmniboxApiTools- Customize address barPageCaptureApiTools- Save pages as MHTMLPermissionsApiTools- Request optional permissionsPlatformKeysApiTools- Platform-specific keysPowerApiTools- Power managementPrintingApiTools- Print documentsPrintingMetricsApiTools- Printing metricsProxyApiTools- Manage proxy settingsReadingListApiTools- Access reading listRuntimeApiTools- Access extension runtime informationScriptingApiTools- Execute scripts and inject CSSSearchApiTools- Search via default providerSessionsApiTools- Query and restore browser sessionsSidePanelApiTools- Control side panelStorageApiTools- Access extension storage (local, sync, session)SystemCpuApiTools- Query CPU informationSystemLogApiTools- Add system log entriesSystemMemoryApiTools- Get memory informationSystemStorageApiTools- Query storage devicesTabCaptureApiTools- Capture tab media streamsTabGroupsApiTools- Manage tab groupsTabsApiTools- Create, update, query, and manage browser tabsTopSitesApiTools- Access top sitesTtsApiTools- Text-to-speech functionalityTtsEngineApiTools- Implement TTS engineUserScriptsApiTools- Execute user scriptsVpnProviderApiTools- Implement VPN clientWallpaperApiTools- Set wallpaperWebAuthenticationProxyApiTools- Web authentication proxyWebNavigationApiTools- Monitor web navigationWebRequestApiTools- Intercept and modify requestsWindowsApiTools- Control browser windows
The following Chrome Extension APIs are not yet implemented or need additional work:
AccessibilityFeaturesApiTools- Manage accessibility featuresActionApiTools- Control extension's action buttonDevtoolsPerformanceApiTools- Access performance dataDevtoolsRecorderApiTools- DevTools recorder panelDnsApiTools- DNS resolutionEventsApiTools- Common event handlingExtensionTypesApiTools- Extension type definitionsPrinterProviderApiTools- Provide printersPrivacyApiTools- Control privacy featuresProcessesApiTools- Interact with browser processesSystemDisplayApiTools- Query display informationTypesApiTools- Chrome type definitions
Create an MCP server in your Chrome extension's background script:
import { BookmarksApiTools, StorageApiTools, TabsApiTools } from '@mcp-b/extension-tools';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { WebsocketServerTransport } from '@modelcontextprotocol/sdk/server/websocket.js';
// Create MCP server
const server = new McpServer({
name: 'chrome-extension-server',
version: '1.0.0',
});
// Register individual API tools with specific methods enabled
const tabsTools = new TabsApiTools(server, {
listActiveTabs: true,
createTab: true,
updateTab: true,
closeTabs: true,
getAllTabs: true,
navigateHistory: true,
reloadTab: true,
});
tabsTools.register();
const bookmarksTools = new BookmarksApiTools(server, {
getBookmarks: true,
createBookmark: true,
updateBookmark: true,
removeBookmark: true,
});
bookmarksTools.register();
const storageTools = new StorageApiTools(server, {
getStorage: true,
setStorage: true,
removeStorage: true,
clearStorage: true,
});
storageTools.register();
// Connect to transport
const transport = new WebsocketServerTransport({
port: 3000,
});
await server.connect(transport);Connect to the server and call the registered tools:
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { WebsocketClientTransport } from '@modelcontextprotocol/sdk/client/websocket.js';
// Create and connect client
const client = new Client({
name: 'my-mcp-client',
version: '1.0.0',
});
const transport = new WebsocketClientTransport(new URL('ws://localhost:3000'));
await client.connect(transport);
// List available tools
const tools = await client.listTools();
console.log('Available tools:', tools);
// Call extension tools
// Create a new tab
const createResult = await client.callTool({
name: 'create_tab',
arguments: {
url: 'https://example.com',
active: true,
pinned: false,
},
});
// Get all tabs
const tabsResult = await client.callTool({
name: 'get_all_tabs',
arguments: {
currentWindow: true,
},
});
// Search bookmarks
const bookmarksResult = await client.callTool({
name: 'get_bookmarks',
arguments: {
query: 'example',
},
});
// Store data
const storageResult = await client.callTool({
name: 'set_storage',
arguments: {
area: 'local',
items: {
key1: 'value1',
key2: { nested: 'object' },
},
},
});
// Execute script in active tab
const scriptResult = await client.callTool({
name: 'execute_script',
arguments: {
target: { tabId: undefined }, // defaults to active tab
func: '() => document.title',
},
});Each API tool class accepts configuration options to enable specific methods:
// TabsApiTools options
interface TabsOptions {
listActiveTabs?: boolean;
createTab?: boolean;
updateTab?: boolean;
closeTabs?: boolean;
getAllTabs?: boolean;
navigateHistory?: boolean;
reloadTab?: boolean;
captureVisibleTab?: boolean;
detectLanguage?: boolean;
discardTab?: boolean;
duplicateTab?: boolean;
getTab?: boolean;
getZoom?: boolean;
setZoom?: boolean;
groupTabs?: boolean;
ungroupTabs?: boolean;
highlightTabs?: boolean;
moveTabs?: boolean;
sendMessage?: boolean;
}
// Similar options exist for other API toolsEach Chrome API requires specific permissions in your extension's manifest.json. Here are some common permissions:
{
"manifest_version": 3,
"permissions": [
"activeTab",
"alarms",
"audio",
"bookmarks",
"browsingData",
"certificateProvider",
"contentSettings",
"contextMenus",
"cookies",
"debugger",
"declarativeContent",
"declarativeNetRequest",
"desktopCapture",
"downloads",
"fontSettings",
"gcm",
"history",
"identity",
"idle",
"management",
"notifications",
"offscreen",
"pageCapture",
"permissions",
"platformKeys",
"power",
"printing",
"printingMetrics",
"proxy",
"readingList",
"scripting",
"search",
"sessions",
"sidePanel",
"storage",
"system.cpu",
"system.memory",
"system.storage",
"tabCapture",
"tabGroups",
"tabs",
"topSites",
"tts",
"ttsEngine",
"unlimitedStorage",
"vpnProvider",
"wallpaper",
"webAuthenticationProxy",
"webNavigation",
"webRequest"
],
"host_permissions": [
"<all_urls>" // Required for scripting API and some other APIs
],
"optional_permissions": [
// Add any permissions you want to request at runtime
]
}Note: Not all APIs require permissions. Some APIs like i18n, runtime, and extension are available without explicit permissions. Enterprise APIs require the extension to be force-installed via enterprise policy.
// List tabs grouped by domain
const result = await client.callTool({
name: 'list_active_tabs',
arguments: {},
});
// Update the active tab's URL
const updateResult = await client.callTool({
name: 'update_tab',
arguments: {
url: 'https://new-url.com',
active: true,
},
});
// Group multiple tabs
const groupResult = await client.callTool({
name: 'group_tabs',
arguments: {
tabIds: [1, 2, 3],
},
});// Get storage data
const data = await client.callTool({
name: 'get_storage',
arguments: {
area: 'local',
keys: ['setting1', 'setting2'],
},
});
// Clear all storage
const clearResult = await client.callTool({
name: 'clear_storage',
arguments: {
area: 'local',
},
});// Search browsing history
const historyResult = await client.callTool({
name: 'search_history',
arguments: {
text: 'github',
maxResults: 20,
startTime: Date.now() - 7 * 24 * 60 * 60 * 1000, // Last week
},
});Each API tool class extends BaseApiTools which provides:
- Automatic permission checking - Verifies API availability before registering tools
- Consistent error handling - Standardized error responses
- Tool registration helpers - Simplified tool registration process
- Response formatting - Consistent response format across all tools
export abstract class BaseApiTools {
protected abstract apiName: string;
abstract checkAvailability(): ApiAvailability;
abstract registerTools(): void;
register(): void {
const availability = this.checkAvailability();
if (availability.available) {
console.log(`Registering ${this.apiName} API tools...`);
this.registerTools();
} else {
console.warn(`${this.apiName} API not available:`, availability.message);
}
}
}All tools include comprehensive error handling and return structured error responses:
try {
const result = await client.callTool({
name: 'create_tab',
arguments: { url: 'invalid-url' },
});
} catch (error) {
// Error response will include:
// - error: true
// - content: [{ type: 'text', text: 'Error message' }]
}Here's a complete example of setting up a Chrome extension with MCP tools:
// background.js - Extension background script
import {
BookmarksApiTools,
HistoryApiTools,
ScriptingApiTools,
StorageApiTools,
TabsApiTools,
} from '@mcp-b/extension-tools';
import { ExtensionServerTransport } from '@mcp-b/transports';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
async function setupMcpServer() {
const server = new McpServer({
name: 'my-chrome-extension',
version: '1.0.0',
});
// Register multiple API tools
const apis = [
new TabsApiTools(server, {
listActiveTabs: true,
createTab: true,
updateTab: true,
closeTabs: true,
getAllTabs: true,
}),
new BookmarksApiTools(server, {
getBookmarks: true,
createBookmark: true,
}),
new StorageApiTools(server, {
getStorage: true,
setStorage: true,
}),
new HistoryApiTools(server, {
searchHistory: true,
}),
new ScriptingApiTools(server, {
executeScript: true,
insertCSS: true,
}),
];
// Register all tools
apis.forEach((api) => api.register());
// Connect transport
const transport = new ExtensionServerTransport();
await server.connect(transport);
console.log('MCP server ready with Chrome extension tools');
}
setupMcpServer();This package is written in TypeScript and includes full type definitions for all APIs and tool parameters.
Contributions are welcome! Please feel free to submit a Pull Request.
Any MCP-compatible client, including:
- Claude Desktop and Claude.ai
- Cursor IDE
- VS Code Copilot
- Gemini applications
- Windsurf, Cline, and other MCP clients
No! Each API tool class accepts configuration options. Enable only what you need:
new TabsApiTools(server, {
listActiveTabs: true, // Only enable tab listing
createTab: false, // Disable tab creation
});Yes! All tools are compatible with Chrome's Manifest V3 extension platform.
Use @mcp-b/transports for in-browser communication, or expose a WebSocket server for desktop AI agents.
The APIs target Chrome, but many also work in Firefox (via WebExtensions) and Edge (Chromium-based). Check browser compatibility for specific APIs.
| Feature | @mcp-b/extension-tools | Raw Chrome APIs | Puppeteer |
|---|---|---|---|
| MCP Protocol Support | Yes | No | No |
| Type Safety | Full TypeScript | Partial | Full |
| Permission Handling | Automatic | Manual | N/A |
| Error Formatting | Structured | Raw | Varies |
| AI Agent Ready | Yes | Manual | Manual |
@mcp-b/transports- Browser-specific MCP transports@mcp-b/global- W3C Web Model Context API polyfill@mcp-b/chrome-devtools-mcp- Connect desktop AI agents to browser@modelcontextprotocol/sdk- Official MCP SDK
MIT - see LICENSE for details