{"id":32790061,"url":"https://github.com/mcollard0/mcp_chrome_spy","last_synced_at":"2026-05-06T10:32:04.706Z","repository":{"id":318721259,"uuid":"1060658240","full_name":"mcollard0/mcp_chrome_spy","owner":"mcollard0","description":"MCP Server for Chrome Developer Console Log monitoring via Chrome DevTools Protocol","archived":false,"fork":false,"pushed_at":"2025-09-20T12:03:31.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-05T11:07:53.542Z","etag":null,"topics":["ai","chrome","debugging","google","mcp","mcp-server","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcollard0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-20T10:26:22.000Z","updated_at":"2025-09-20T12:05:19.000Z","dependencies_parsed_at":"2025-10-12T04:56:56.282Z","dependency_job_id":"99bc8f99-b3b8-48ce-8a32-40a3fc61e184","html_url":"https://github.com/mcollard0/mcp_chrome_spy","commit_stats":null,"previous_names":["mcollard0/mcp_chrome_spy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcollard0/mcp_chrome_spy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollard0%2Fmcp_chrome_spy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollard0%2Fmcp_chrome_spy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollard0%2Fmcp_chrome_spy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollard0%2Fmcp_chrome_spy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcollard0","download_url":"https://codeload.github.com/mcollard0/mcp_chrome_spy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcollard0%2Fmcp_chrome_spy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32689100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chrome","debugging","google","mcp","mcp-server","python"],"created_at":"2025-11-05T11:01:30.741Z","updated_at":"2026-05-06T10:32:04.688Z","avatar_url":"https://github.com/mcollard0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Chrome Spy Server\n\nAn MCP (Model Context Protocol) server that monitors Chrome developer console logs using the Chrome DevTools Protocol.\n\n## Features\n\n- **Real-time console log monitoring** via Chrome DevTools Protocol\n- **Tab selection** - Choose which Chrome tab to monitor\n- **Log filtering** - Filter by log level (verbose, info, warning, error)\n- **Incremental logging** - Option to only return new logs since last request\n- **Configurable port** - Support for custom Chrome remote debugging ports\n- **MCP integration** - Works seamlessly with MCP-compatible AI agents\n\n## Installation\n\n1. Install the required dependencies:\n```bash\npip install -r requirements.txt\n```\n\n2. Make the server executable:\n```bash\nchmod +x chrome_spy_server.py\n```\n\n## Chrome Setup\n\nBefore using the server, you need to start Chrome with remote debugging enabled:\n\n```bash\n# Linux/Mac\ngoogle-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug\n\n# Windows\nchrome.exe --remote-debugging-port=9222 --user-data-dir=c:\\temp\\chrome-debug\n```\n\n## Usage\n\n### Running the Server\n\nStart the MCP server with default settings:\n```bash\npython chrome_spy_server.py\n```\n\nOr with custom options:\n```bash\npython chrome_spy_server.py --remote-debugging-port 9223 --only-new-logs\n```\n\n### Command Line Options\n\n- `--remote-debugging-port`, `-rdp`: Chrome remote debugging port (default: 9222)\n- `--only-new-logs`: Only return new logs since last request\n\n### MCP Tools Available\n\nOnce connected to an MCP client, the following tools are available:\n\n1. **`list_chrome_tabs`** - Lists all available Chrome tabs with their IDs and URLs\n2. **`select_chrome_tab`** - Selects a specific tab to monitor by tab ID\n3. **`get_console_logs`** - Retrieves console logs from the selected tab\n   - `filter_level`: Minimum log level (verbose, info, warning, error)\n   - `limit`: Maximum number of entries to return (1-1000)\n4. **`start_log_monitoring`** - Starts real-time log monitoring\n5. **`stop_log_monitoring`** - Stops real-time log monitoring\n\n### Example Workflow\n\n1. Start Chrome with debugging enabled\n2. Start the MCP server\n3. Connect your MCP client to the server\n4. Use `list_chrome_tabs` to see available tabs\n5. Use `select_chrome_tab` with a tab ID to choose which tab to monitor\n6. Use `get_console_logs` to retrieve console logs\n7. Optionally use `start_log_monitoring` for real-time updates\n\n## Architecture\n\nThe server consists of several key components:\n\n- **ChromeSpyServer**: Main class handling MCP protocol and Chrome integration\n- **Chrome DevTools Protocol Integration**: WebSocket connection to Chrome for real-time log events\n- **Tab Management**: Discovery and selection of Chrome tabs\n- **Log Processing**: Filtering, formatting, and delivering console logs\n- **MCP Protocol Handler**: Standard MCP server implementation\n\n## Error Handling\n\nThe server includes comprehensive error handling for:\n\n- Chrome not running or not accessible\n- Network connection issues\n- WebSocket connection failures\n- Invalid tab selections\n- Log processing errors\n\n## Backup System\n\nThe server automatically creates a `backup/` directory for any necessary backups during operation.\n\n## Development\n\nThe code follows Python best practices with:\n\n- Proper async/await patterns\n- Type hints throughout\n- Comprehensive error handling\n- Clear separation of concerns\n- Following user's coding style preferences (spaces in brackets, semicolons, long lines)\n\n## Troubleshooting\n\n### Chrome Not Found\n- Ensure Chrome is running with `--remote-debugging-port=9222`\n- Check that the port matches the one specified to the server\n- Verify no firewall is blocking the connection\n\n### No Tabs Listed\n- Make sure you have actual web pages open in Chrome (not just chrome:// URLs)\n- Refresh the tab list if tabs were opened after starting the server\n\n### Connection Issues\n- Check Chrome's remote debugging is still enabled\n- Verify the WebSocket connection isn't being blocked\n- Try restarting both Chrome and the server\n\n### Console Log Collection Issues\n- **Chatty websites**: Some websites (like Microsoft.com, complex SPAs) generate hundreds of console messages per second\n- This can delay Chrome DevTools Protocol command responses\n- For testing, try simpler pages like `http://example.com` or local HTML files\n- The server includes timeout handling for very active console output\n- Consider using `--only-new-logs` flag to reduce message volume\n\n### Performance Notes\n- The server is optimized for real-world usage with busy web applications\n- Memory usage is controlled (max 1000 log entries stored)\n- WebSocket connections are properly managed and cleaned up\n- Command timeouts are set to handle very active pages (30+ seconds)\n\n## License\n\nThis project is open source and available under standard terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcollard0%2Fmcp_chrome_spy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcollard0%2Fmcp_chrome_spy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcollard0%2Fmcp_chrome_spy/lists"}