element-inspector
Enables interactive element inspection on any website, allowing users to click elements and send detailed information (tag, classes, styles, attributes) to Claude for analysis.
README
Web Element Inspector MCP Server
A general-purpose MCP server that provides an interactive element inspector for ANY website. Perfect for analyzing web pages, debugging UI issues, examining competitors' designs, or understanding how any website is built. Click on elements and instantly send detailed information about them to Claude.
Features
- 🔍 Interactive Element Inspection: Click on any element on any website
- 🌐 Universal Support: Works with local dev servers, production sites, and external websites
- 📊 Detailed Element Data: Captures tag name, ID, classes, attributes, styles, position, and text content
- 💬 Direct Claude Integration: Send element information directly to Claude via
app.sendMessage() - 🎯 Real-time Feedback: Visual highlighting and instant status updates
- 📝 Inspection History: Keep track of all inspected elements during a session
- 🔄 Batch Operations: Send individual elements or entire history to Claude
- 🛡️ Smart Attribute Detection: Highlights important attributes like href, src, aria-label, etc.
How It Works
- Launch the Inspector: Call the
inspect-web-elementstool with any website URL - Enable Inspection: Click the "Enable Element Inspection" button
- Click Elements: Click on any element in the loaded page
- Send to Claude: Use "Send to Claude" to instantly share element data
Installation
1. Install Dependencies
cd ~/ai-agent/element-inspector-mcp
npm install
2. Build the Project
npm run build
3. Configure Claude Desktop
Add this to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"element-inspector": {
"command": "node",
"args": [
"/data/data/com.termux/files/home/ai-agent/element-inspector-mcp/dist/index.js",
"--stdio"
]
}
}
}
Usage
Basic Usage
- Start your development server (e.g.,
npm run devon port 3000) or navigate to any website - In Claude Desktop, ask: "Launch the element inspector for https://example.com"
- The inspector UI will appear in the chat
- Click "Enable Element Inspection"
- Click on any element in the loaded page
- Click "Send to Claude" to share the element information
Example Prompts
- "Launch the element inspector for my dev server at http://localhost:3000"
- "Inspect the navigation bar on https://github.com"
- "Analyze the header structure of https://example.com"
- "Click on the main CTA button on https://www.producthunt.com and tell me about its styling"
- "Examine the pricing table on https://stripe.com and send the details to me"
Advanced Usage
The inspector captures comprehensive element data:
{
"tagName": "button",
"id": "submit-btn",
"classes": ["btn", "btn-primary"],
"text": "Submit",
"attributes": {
"type": "submit",
"disabled": "false"
},
"styles": {
"display": "inline-block",
"padding": "10px 20px",
"backgroundColor": "rgb(33, 150, 243)"
},
"position": {
"x": 100,
"y": 200,
"width": 150,
"height": 40
}
}
Development
Project Structure
element-inspector-mcp/
├── src/
│ ├── mcp-app.ts # Client-side application
│ ├── index.html # HTML template
│ └── styles.css # Application styles
├── server.ts # MCP server with tool registration
├── index.ts # Entry point
├── vite.config.ts # Vite configuration
└── package.json
Building
npm run build
Running Locally (for testing)
npm run build
node dist/index.js --stdio
Technical Details
- Uses MCP Apps SDK for interactive UI
- Built with TypeScript and Vite
- Single-file bundle for easy distribution
- Safe iframe sandboxing
- CORS-aware element inspection
Use Cases
- Development: Debug UI issues in your local development environment
- Competitor Analysis: Examine how competitors structure their websites
- Learning: Study the HTML/CSS of well-designed websites
- Accessibility Testing: Check ARIA labels and semantic structure
- SEO Analysis: Examine meta tags, headings, and semantic HTML
- Design Inspiration: Capture styling details from impressive websites
- Content Strategy: Analyze how successful sites structure their content
Limitations
- CORS Restrictions: Some websites may block iframe embedding (X-Frame-Options)
- Same-Origin Policy: Cross-origin access may be limited on some sites
- Dynamic Content: Very dynamic content (SPAs) may require re-enabling inspection
- Authentication: Logged-in pages may not work in iframes
- Complex CSP Sites: Sites with strict Content Security Policies may block interaction
Troubleshooting
"Cannot access iframe content" error
This occurs when websites block iframe embedding. Solutions:
- For local development: Add CORS headers to your dev server
- For external sites: The site may have X-Frame-Options or CSP restrictions
- Workaround: Try using a CORS proxy or browser extension
- Alternative: Use browser DevTools with MCP for problematic sites
Elements not highlighting
- Ensure inspection mode is enabled (button should be green and pulsing)
- Check that the page has fully loaded
- For SPAs, try toggling inspection mode off and on
- Some sites with complex event handling may interfere
"Site may block iframe embedding" warning
This is normal for external websites. Many sites have security policies that prevent iframe embedding. This doesn't affect the inspector's functionality - it's just a warning that some sites may not load in iframes.
Tips for Best Results
- Local Development: Always use http://localhost:3000 or similar for best results
- Simple Pages: Static sites work better than complex SPAs
- Public URLs: Use public URLs rather than authenticated pages
- Stable Content: Choose pages with stable content for reliable inspection
- Large Elements: Click on larger elements for more accurate selection
Future Enhancements
- [ ] CSS selector generation and copying
- [ ] Screenshot capture integration
- [ ] Network request monitoring
- [ ] Console log inspection
- [ ] Multiple element selection
- [ ] Element tree visualization
- [ ] Export inspection data as JSON
- [ ] Integration with browser DevTools protocol
License
MIT
Contributing
Contributions welcome! Feel free to open issues or pull requests.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。