MCP Server for Chrome Extension API, enabling Claude to interact with Chrome browser extensions.
- Build and run the Docker container:
docker build -t mcp/chromeextension -f src/chromeextension/Dockerfile .
docker run -i --rm mcp/chromeextension
- Extract the extension package:
docker cp $(docker ps -q -f ancestor=mcp/chromeextension):/app/chrome-extension.zip .
- Install in Chrome:
- Open Chrome and go to
chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the extracted extension directory
- Open Chrome and go to
- Navigate to the extension directory:
cd src/chromeextension/extension
- Load in Chrome:
- Open Chrome and go to
chrome://extensions/
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the extension directory
- Open Chrome and go to
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"chromeextension": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-chrome-extension"
],
"env": {
"CHROME_EXTENSION_ID": "your-extension-id"
}
}
}
}
{
"mcpServers": {
"chromeextension": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"CHROME_EXTENSION_ID",
"mcp/chromeextension"
],
"env": {
"CHROME_EXTENSION_ID": "your-extension-id"
}
}
}
}
-
chrome_get_active_tab
- Get information about the currently active tab
- Returns: Active tab information including URL, title, and tab ID
- Uses Chrome API:
chrome.tabs.query({ active: true, currentWindow: true })
-
chrome_get_all_tabs
- Get information about all open tabs
- Returns: List of all open tabs with their information (URL, title, tab ID, etc.)
- Uses Chrome API:
chrome.tabs.query({})
- Also provides real-time tab updates through WebSocket events:
created
: When a new tab is createdupdated
: When a tab's content is updatedremoved
: When a tab is closedactivated
: When a tab becomes active
-
chrome_execute_script
- Execute DOM operations in the context of a web page
- Required inputs:
tab_id
(number): The ID of the target taboperation
(object): DOM operation details
- Operation Structure:
{ action: string; // The type of operation to perform selector?: string; // CSS selector for targeting elements value?: string | number | boolean; // Value to set attribute?: string; // Attribute name tagName?: string; // Tag name for createElement attributes?: Record<string, string | number | boolean>; // Element attributes innerText?: string; // Inner text content elementId?: string; // Element ID for appendChild message?: string; // Message for log operation }
- Supported Operations:
querySelector
: Get element information{ "action": "querySelector", "selector": "#my-element" }
setText
: Set text content{ "action": "setText", "selector": "#my-element", "value": "New text" }
createElement
: Create new element{ "action": "createElement", "tagName": "div", "attributes": { "class": "my-class", "data-custom": "value" }, "innerText": "New element" }
click
: Trigger click event on element{ "action": "click", "selector": "#my-button" }
- And more: querySelectorAll, setHTML, setAttribute, removeAttribute, addClass, removeClass, toggleClass, appendChild, removeElement, getPageInfo, getElementsInfo, log
- Returns: Result of the DOM operation
- Uses Chrome API:
chrome.scripting.executeScript()
-
chrome_inject_css
- Inject CSS into a web page
- Required inputs:
tab_id
(number): The ID of the target tabcss
(string): CSS code to inject
- Returns: Confirmation of CSS injection
- Uses Chrome API:
chrome.scripting.insertCSS()
-
chrome_get_extension_info
- Get information about installed extensions
- Optional inputs:
extension_id
(string): Specific extension ID to query
- Returns: Extension information including permissions and status
- Uses Chrome API:
chrome.management.get()
andchrome.management.getAll()
-
chrome_send_message
- Send a message to an extension's background script
- Required inputs:
extension_id
(string): Target extension IDmessage
(object): Message payload to send
- Returns: Response from the extension
- Uses Chrome API:
chrome.runtime.sendMessage()
-
chrome_get_cookies
- Get cookies for a specific domain
- Required inputs:
domain
(string): Domain to get cookies for
- Returns: List of cookies for the domain
- Uses Chrome API:
chrome.cookies.get()
andchrome.cookies.getAll()
-
chrome_capture_screenshot
- Take a screenshot of the current tab
- Optional inputs:
tab_id
(number): The ID of the target tab (defaults to active tab)format
(string): Image format ('png' or 'jpeg', defaults to 'png')quality
(number): Image quality for jpeg format (0-100)area
(object): Capture specific area {x, y, width, height}
- Returns: Base64 encoded image data
- Uses Chrome API:
chrome.tabs.captureVisibleTab()
-
Create a Chrome Extension:
- Create a new directory for your extension
- Create a
manifest.json
file with necessary permissions - Implement the required background scripts
-
Required Permissions: Your extension's manifest.json needs these permissions:
{ "permissions": [ "activeTab", "scripting", "cookies", "management", "tabs" ] }
-
Install Extension:
- Load your extension in Chrome's developer mode
- Note the extension ID for configuration
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"chromeextension": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-chrome-extension"
],
"env": {
"CHROME_EXTENSION_ID": "your-extension-id"
}
}
}
}
{
"mcpServers": {
"chromeextension": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"CHROME_EXTENSION_ID",
"mcp/chromeextension"
],
"env": {
"CHROME_EXTENSION_ID": "your-extension-id"
}
}
}
}
If you encounter issues, verify that:
- The Chrome extension is properly installed and enabled
- All required permissions are correctly specified in manifest.json
- The extension ID is correctly configured
- The browser is running and accessible
Docker build:
docker build -t mcp/chromeextension -f src/chromeextension/Dockerfile .
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.