Legacy Device Debugger MCP Server
This MCP server helps debug legacy devices behind proxies in OT environments by analyzing web interfaces and generating custom rewrite rules to fix proxy-related issues.
README
Legacy Device Debugger MCP Server
An MCP (Model Context Protocol) server specifically designed for debugging legacy devices behind proxies in OT (Operational Technology) environments. This server helps support teams identify and fix proxy-related issues independently using custom header rewrite rules, eliminating the need to escalate to development teams.
Overview
Legacy devices in OT environments often have issues working behind proxies due to hardcoded IP addresses, hostname references, and outdated web technologies. This MCP server automates the debugging process and generates appropriate rewrite rules to fix these issues.
Features
š Automated Page Analysis
- Loads device web interfaces using Playwright
- Detects network errors, console errors, and loading issues
- Identifies broken resources and problematic URL patterns
- Checks for WebSocket connection problems
š ļø Custom Header Rewrite Rules Generation
- Automatically generates proxy configuration rules
- Supports various rule types: header manipulation, body rewriting, redirects
- Handles common issues like device IP references and broken links
š Systematic Debugging Workflow
- Follows established OT debugging procedures
- Provides step-by-step analysis and recommendations
- Generates actionable results for support teams
š Network Analysis
- Performs curl-like header analysis
- Detects redirects to device IP/hostname
- Identifies CSP and other proxy-blocking headers
Installation
# Clone the repository
git clone <repository-url>
cd legacy-device-debugger-mcp
# Install dependencies
npm install
# Install Playwright browsers
npx playwright install chromium
# Build the project
npm run build
Usage
As an MCP Server
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"legacy-device-debugger": {
"command": "node",
"args": ["/absolute/path/to/legacy-device-debugger-mcp/build/index.js"]
}
}
}
Available Tools
1. analyze-device-page
Comprehensive analysis of a device's web interface.
Parameters:
deviceUrl(string): URL of the legacy device's web interfacetimeout(number, optional): Timeout in milliseconds (default: 30000)
Example:
Please analyze this legacy device: http://192.168.1.100:8080
2. curl-analysis
HTTP header analysis similar to curl commands.
Parameters:
deviceUrl(string): URL of the legacy device
Example:
Perform curl analysis on http://192.168.1.100:8080
3. generate-rewrite-rules
Generate specific rewrite rules for common issues.
Parameters:
issueType: Type of issue (device_ip_references, broken_links, image_loading, etc.)deviceUrl: Device URLproblemPattern(optional): Specific pattern causing issuestargetPath(optional): Specific path needing rewriting
Example:
Generate rewrite rules for broken_links issue on http://192.168.1.100:8080
4. debug-workflow
Complete debugging workflow following OT best practices.
Parameters:
deviceUrl: URL of the legacy devicedeviceIP(optional): Device IP address if knowndeviceHostname(optional): Device hostname if known
Example:
Run complete debug workflow for http://rtp-acl-bms:8080
Debugging Workflow
The server follows this systematic approach:
-
Enable Default Rules & Basic Analysis
- Check if web page loads at all
- Identify partial loading issues
- Detect broken images and resources
-
Network Error Detection
- Monitor 404/500 errors
- Check for connection failures
- Identify requests to device IP/hostname
-
Header Analysis
- Perform curl-like analysis
- Check response headers for problematic patterns
- Identify redirects and CSP issues
-
Generate Rewrite Rules
- Create appropriate proxy configuration
- Handle common patterns like device IP references
- Generate header manipulation rules
-
Provide Recommendations
- Actionable steps for support teams
- Escalation guidance if needed
- Direct access testing procedures
Common Use Cases
1. Device References Hardcoded IPs
Issue: Device web interface references its own IP address in resources Solution: Body rewrite rules to replace IP with external FQDN
2. Broken CSS/JS Loading
Issue: Stylesheets and scripts fail to load through proxy Solution: Header rewrite rules and resource path corrections
3. WebSocket Connection Issues
Issue: WebSocket connections bypass proxy or fail Solution: Protocol upgrade rules and hostname rewriting
4. Redirect to Device IP
Issue: Device redirects users to its internal IP Solution: Location header rewrite rules
Rewrite Rule Types
Header Rules
{
"type": "header",
"action": "add|replace|remove|append",
"headerName": "X-Forwarded-Host",
"headerValue": "{{DEVICE_EXTERNAL_FQDN}}"
}
Body Rules
{
"type": "body",
"action": "find_replace",
"pattern": "rtp-acl-bms/static/jquery.min.js",
"replacement": "{{DEVICE_EXTERNAL_FQDN}}/static/jquery.min.js"
}
Redirect Rules
{
"type": "redirect",
"action": "replace",
"pattern": "{{DEVICE_IP}}",
"replacement": "{{DEVICE_EXTERNAL_FQDN}}"
}
Development
Project Structure
āāā src/
ā āāā index.ts # Main MCP server implementation
āāā build/ # Compiled JavaScript
āāā .vscode/
ā āāā mcp.json # MCP server configuration
āāā .github/
ā āāā copilot-instructions.md
āāā README.md
Building
npm run build
Testing
# Test the server directly
npm run dev
# Test with MCP client
node build/index.js
Configuration Variables
The server uses these placeholder variables in generated rules:
{{DEVICE_EXTERNAL_FQDN}}: External FQDN for the device{{DEVICE_INTERNAL_IP}}: Internal IP address of the device{{DEVICE_IP}}: Generic device IP placeholder
Troubleshooting
Common Issues
-
Playwright Installation
npx playwright install chromium -
Permission Errors
chmod +x build/index.js -
Module Resolution Ensure
package.jsonhas"type": "module"
Debug Mode
Set environment variable for verbose logging:
DEBUG=1 node build/index.js
Contributing
- Follow the established debugging workflow patterns
- Add appropriate error handling for network operations
- Generate actionable rewrite rules in the correct format
- Include comprehensive documentation
License
ISC License - see LICENSE file for details.
Support
For issues with legacy device debugging:
- Use the complete debug workflow first
- Check generated rewrite rules
- Test with direct device access
- Escalate to DevOps team with analysis results
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.