Package Exports
- @ams-dev/browser-inspector
- @ams-dev/browser-inspector/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ams-dev/browser-inspector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@ams-dev/browser-inspector
A Model Context Protocol (MCP) server that provides comprehensive browser automation, inspection, monitoring, and performance analysis capabilities using Puppeteer.
Features
🌐 Navigation & Inspection
- Navigate to URLs - Browse any website
- Get Page Content - Extract full HTML content
- Get Page Info - Retrieve URL and title
- Take Screenshots - Capture viewport or full page screenshots
🔍 Monitoring & Debugging
- Console Logs - Capture all console messages (errors, warnings, info, debug) with timestamps
- Network Requests - Monitor all HTTP requests with status codes, response times, and sizes
- Failed Requests - Track network failures
- Real-time Monitoring - Logs are captured as they happen
🤖 Automation
- Click Elements - Interact with page elements using CSS selectors
- Type Text - Fill forms and input fields
- Execute JavaScript - Run custom JavaScript in page context
- Wait for Elements - Wait for dynamic content to load
⚡ Performance Analysis
- Performance Metrics - Get comprehensive load time metrics including:
- DOM Content Loaded time
- Full page load time
- First Paint (FP)
- First Contentful Paint (FCP)
- Resource counts (scripts, stylesheets, images)
- Total page size
♿ Accessibility Testing
- Accessibility Audit - Automated accessibility checks including:
- Missing alt text on images
- Form controls without labels
- Missing page title
- Missing lang attribute
- Heading hierarchy issues
- Links without discernible text
- Non-semantic interactive elements
🍪 State Management
- Cookie Management - Get, set, and clear browser cookies
- LocalStorage Management - Get, set, and clear localStorage items
Installation
pnpm add @ams-dev/browser-inspectorConfiguration
Claude Code Setup
Add to your MCP configuration file:
macOS: ~/Library/Application Support/Claude Code/mcp_settings.json
Linux: ~/.config/claude-code/mcp_settings.json
Windows: %APPDATA%\\Claude Code\\mcp_settings.json
{
"mcpServers": {
"browser-inspector": {
"command": "npx",
"args": ["-y", "@ams-dev/browser-inspector"]
}
}
}Available Tools
Navigation & Content
navigate
Navigate to a URL in the browser.
{
url: string;
} // Must include protocol (https://)get_page_content
Get the full HTML content of the current page.
get_page_info
Get basic information about the current page (URL, title).
screenshot
Take a screenshot of the current page.
{ fullPage?: boolean } // Default: false (viewport only)Monitoring & Debugging
get_console_logs
Get console logs from the current page.
{
limit?: number, // Maximum number of logs to return
filter?: 'error' | 'warning' | 'info' | 'log' | 'debug'
}get_network_requests
Get network requests made by the page.
{
limit?: number, // Maximum number of requests
failedOnly?: boolean // Only return failed requests
}clear_logs
Clear all console logs and network request history.
Automation
execute_script
Execute JavaScript code in the page context.
{
script: string;
} // JavaScript code to executeclick
Click an element using a CSS selector.
{
selector: string;
} // CSS selectortype_text
Type text into an input element.
{
selector: string, // CSS selector
text: string // Text to type
}wait_for_selector
Wait for an element to appear on the page.
{
selector: string, // CSS selector
timeout?: number // Timeout in ms (default: 5000)
}Performance & Accessibility
get_performance_metrics
Get comprehensive performance metrics including:
- DOM Content Loaded and Load times
- First Paint and First Contentful Paint
- Resource counts and total size
Returns:
{
timestamp: number,
metrics: {
domContentLoaded: number,
load: number,
firstPaint?: number,
firstContentfulPaint?: number
},
resources: {
scriptCount: number,
stylesheetCount: number,
imageCount: number,
totalSize: number
}
}run_accessibility_audit
Run an automated accessibility audit on the current page.
Returns:
{
timestamp: number,
url: string,
issues: Array<{
type: 'error' | 'warning' | 'info',
rule: string,
message: string,
selector?: string,
element?: string
}>,
summary: {
errors: number,
warnings: number,
info: number
}
}State Management
manage_cookies
Manage browser cookies.
{
action: 'get' | 'set' | 'clear',
name?: string, // Required for 'set'
value?: string, // Required for 'set'
domain?: string, // Optional for 'set'
path?: string // Optional for 'set'
}manage_local_storage
Manage localStorage.
{
action: 'get' | 'set' | 'clear',
key?: string, // Required for 'set', optional for 'get'
value?: string // Required for 'set'
}Usage Examples
Performance Testing
1. Navigate to https://myapp.com
2. Get performance metrics
3. Take a screenshotAccessibility Audit
1. Navigate to https://myapp.com
2. Run accessibility audit
3. Show me all error-level issuesComplete E2E Test
1. Navigate to https://myapp.com/login
2. Type "user@example.com" into input[name="email"]
3. Type "password123" into input[name="password"]
4. Click button[type="submit"]
5. Wait for .dashboard selector
6. Get console logs and show errors
7. Get performance metrics
8. Run accessibility auditCookie Management
1. Navigate to https://example.com
2. Manage cookies with action "get"
3. Manage cookies with action "set", name "session", value "abc123"
4. Manage cookies with action "clear"Browser Behavior
- Browser launches in non-headless mode for visibility
- Viewport set to 1920x1080 by default
- Console logs and network requests automatically captured
- Each navigation clears previous logs and requests
Development
Build the package:
pnpm buildWatch mode for development:
pnpm devSecurity Considerations
- Launches a real browser with access to any website
- JavaScript execution happens in page context
- Reduced security for automation (
--no-sandbox,--disable-web-security) - Use caution with untrusted websites and arbitrary JavaScript
License
MIT