1. Conduid
  2. Developer Tools
  3. Frontend Router MCP
MCP server · Developer Tools

Frontend Router MCP

MCP server in Go that allows AI agents to ask questions to human users through WebSocket connections

Unclaimed last commit a year ago devtools
41Fair

Scored 5 months ago · breakdown

About Frontend Router MCP

Frontend Router MCP is an MCP server published by jcronq in the Developer Tools category: mCP server in Go that allows AI agents to ask questions to human users through WebSocket connections.

The repository has 2 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/jcronq/frontend_router_mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Frontend Router MCP

Powered by Claude · Grounded in docs

I know everything about Frontend Router MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 7 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • !No dynamic code executionSource scan found eval or shell execution. Review how tool inputs reach it before granting credentials.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

Frontend Router MCP

An MCP (Model Control Protocol) server in Go that allows AI agents to ask questions to human users through WebSocket connections. This tool bridges the gap between automated agents and human interaction by providing a real-time communication channel.

Features

  • MCP Server: Standard MCP protocol implementation using mark3labs/mcp-go
  • ask_user Tool: Allows agents to ask questions and receive human responses
  • WebSocket Server: Real-time communication with frontend clients
  • Bidirectional Communication: Questions flow from agents to users, responses flow back
  • Timeout Support: Configurable timeouts for user responses
  • Multiple Client Support: Broadcast questions to all connected clients
  • Graceful Shutdown: Clean server shutdown with proper resource cleanup

Architecture

The system consists of three main components:

  1. MCP Server (port 8081): Hosts the ask_user tool using standard MCP protocol
  2. WebSocket Server (port 8080): Handles frontend connections via WebSocket
  3. Bridge Logic: Routes questions from MCP to WebSocket clients and responses back

Message Flow

Agent → MCP Server → Bridge → WebSocket Server → Frontend Client
                                                      ↓
Agent ← MCP Server ← Bridge ← WebSocket Server ← User Response

Getting Started

Prerequisites

  • Go 1.21 or later
  • Go modules enabled

Installation

  1. Clone the repository:

    git clone https://github.com/jcronq/frontend_router_mcp.git
    cd frontend_router_mcp
    
  2. Install dependencies:

    go mod download
    
  3. Build the application:

    go build -o frontend-router-mcp ./cmd/server
    

Running the Server

Start the server with default settings:

./frontend-router-mcp

Or specify custom ports:

./frontend-router-mcp -ws-port 8080 -mcp-port 8081

The server will start:

  • WebSocket server on ws://localhost:8080/ws
  • MCP server on localhost:8081 (streaming protocol)

Command Line Options

Usage of ./frontend-router-mcp:
  -mcp-port int
        MCP server port (default 8081)
  -ws-port int
        WebSocket server port (default 8080)

Usage

MCP Client Integration

Use any MCP client to connect to the server. The ask_user tool is available with the following parameters:

  • question (required): The question to ask the user
  • timeout_seconds (optional): Maximum time to wait for response (default: 300)

Example using the mark3labs/mcp-go client:

import (
    "context"
    "github.com/mark3labs/mcp-go/mcp"
    "github.com/mark3labs/mcp-go/client"
)

// Connect to MCP server
mcpClient := client.NewHTTPClient("http://localhost:8081")
err := mcpClient.Initialize(context.Background())

// Ask a question
request := mcp.CallToolRequest{
    Name: "ask_user",
    Arguments: map[string]interface{}{
        "question": "What is your favorite color?",
        "timeout_seconds": 30,
    },
}

result, err := mcpClient.CallTool(context.Background(), request)

WebSocket Client Integration

Connect to the WebSocket server to receive questions and send responses:

Message Types

Connect Message (sent by client):

{
    "type": "connect"
}

Question Message (received from server):

{
    "type": "ask_user",
    "request_id": "unique-request-id",
    "question": "What is your favorite color?"
}

Response Message (sent by client):

{
    "type": "user_response",
    "request_id": "unique-request-id",
    "answer": "Blue"
}

JavaScript Example

const ws = new WebSocket('ws://localhost:8080/ws');

ws.onopen = function() {
    // Send connect message
    ws.send(JSON.stringify({
        type: 'connect'
    }));
};

ws.onmessage = function(event) {
    const data = JSON.parse(event.data);
    
    if (data.type === 'ask_user') {
        // Display question to user
        const answer = prompt(data.question);
        
        // Send response back
        ws.send(JSON.stringify({
            type: 'user_response',
            request_id: data.request_id,
            answer: answer
        }));
    }
};

Testing

This project includes comprehensive testing that validates the complete agent-to-human communication pipeline using both the MCP streamable HTTP protocol and WebSocket infrastructure.

Comprehensive Test Validation

The testing validates the complete end-to-end flow:

AI Agent (MCP Client) → Go MCP Server → Message Bridge → WebSocket Server → Human Client → Response

✅ Validated Components:

  • MCP streamable HTTP protocol communication
  • ask_user tool registration and execution
  • WebSocket client connections and messaging
  • Message bridge routing between MCP and WebSocket
  • Agent-to-human question delivery
  • Concurrent client handling

Test Results Summary

Component Test Type Status Evidence
Build System Compilation ✅ PASS Successfully builds frontend-router-mcp binary
MCP Protocol Streamable HTTP ✅ PASS Python MCP client connects, negotiates protocol v2025-03-26
Tool Registration ask_user Discovery ✅ PASS Tool found with correct schema and description
WebSocket Server Connection & Messaging ✅ PASS Clients connect, send/receive messages, disconnect cleanly
Message Bridge End-to-End Routing ✅ PASS Questions route from MCP → WebSocket → Human clients
Health Monitoring All Components ✅ PASS Health endpoints report all services healthy

Running the Tests

1. Quick Validation Test

# Start server
./frontend-router-mcp &

# Run comprehensive test suite
./test/run_comprehensive_test.sh

2. Manual Component Testing

Test WebSocket Connection:

cd test/ws_client && go build && ./ws-test

Test MCP Client (without WebSocket):

cd test/mcp_client && go build && ./mcp-test

3. End-to-End Flow Testing

Test with Python MCP Client:

# Terminal 1: Start server
./frontend-router-mcp

# Terminal 2: Test complete flow
cd test/python
python3 -m venv venv && source venv/bin/activate
pip install mcp websockets
python3 final_e2e_test.py

Expected Result:

✅ MCP session established!
✅ MCP initialized: protocolVersion='2025-03-26'
✅ Found ask_user tool: Ask a question to the user and receive their response
Received message: {'question': 'What is your favorite color?', 'request_id': 'req-...'}
🎉 SUCCESS! End-to-end flow validated

4. Web Interface Testing

# Start server
./frontend-router-mcp

# Open test_frontend.html in browser
open test_frontend.html

# In another terminal, test MCP functionality
cd test/python && python3 final_e2e_test.py

Test Evidence

MCP Protocol Validation:

  • ✅ Streamable HTTP transport working (HTTP 200/202 responses)
  • ✅ Protocol negotiation successful (version 2025-03-26)
  • ✅ Tool discovery working (ask_user tool found with correct schema)
  • ✅ Tool execution working (questions reach bridge layer)

WebSocket Infrastructure Validation:

  • ✅ Client connections established (Connected to WebSocket server)
  • ✅ Bidirectional messaging (Received message: {'status': 'connected'})
  • ✅ Message routing (Forwarding message type connect from client)
  • ✅ Question delivery (Received message: {'question': '...', 'request_id': '...'})

Integration Validation:

  • ✅ MCP → WebSocket bridge working
  • ✅ Multiple concurrent clients supported
  • ✅ Health monitoring covers all components
  • ✅ Complete agent-to-human communication pipeline validated

Docker Testing

Run the automated Docker test:

./test_docker.sh

This validates:

  • Docker image builds correctly
  • All services start in containers
  • Health checks pass
  • Basic functionality works in containerized environment

Unit Testing

Run the Go test suite:

go test ./...

Note: Some unit tests may have compilation dependencies that were fixed during comprehensive testing.

Test Files and Scripts

  • test/run_comprehensive_test.sh: Complete automated test suite
  • test/python/final_e2e_test.py: End-to-end MCP protocol validation
  • test/python/dummy_human.py: Automated WebSocket client for testing
  • test/mcp_client/: Go MCP client test
  • test/ws_client/: Go WebSocket client test
  • test_frontend.html: Web-based interface for manual testing
  • TEST_VALIDATION_REPORT.md: Detailed testing analysis and results

Testing Conclusions

✅ VALIDATION COMPLETE: The Frontend Router MCP is fully functional.

The comprehensive testing proves:

  1. MCP Protocol Compliance: Works with official Python MCP client using streamable HTTP
  2. WebSocket Infrastructure: Handles multiple clients, bidirectional messaging
  3. End-to-End Flow: Agent questions successfully reach human clients
  4. Production Readiness: All components work together reliably

The system is ready for integration with AI agents and frontend applications.

Docker Support

Using Docker

Build and run with Docker:

# Build the Docker image
docker build -t frontend-router-mcp .

# Run the container
docker run -p 8080:8080 -p 8081:8081 frontend-router-mcp

Using Docker Compose

For a more convenient setup, use Docker Compose:

# Start the application
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the application
docker-compose down

Health Checks

The Docker container includes health checks that verify both ports are accessible:

# Check container health
docker ps

Error Handling

The system handles various error conditions gracefully:

  • No clients connected: Returns error message to MCP client
  • Timeout: Returns timeout error after specified duration
  • Invalid messages: Logs errors and continues processing
  • Connection drops: Automatically removes disconnected clients

Troubleshooting

Common Issues

Server won't start:

  • Check if ports 8080 and 8081 are available
  • Ensure Go 1.21+ is installed
  • Run go mod download to ensure dependencies are installed

WebSocket connection fails:

  • Verify the server is running on port 8080
  • Check firewall settings
  • Ensure the WebSocket URL is correct: ws://localhost:8080/ws

MCP client can't connect:

  • Verify the server is running on port 8081
  • Check if the MCP client is using the correct protocol (streaming)
  • Ensure the client is compatible with mark3labs/mcp-go

Questions not reaching frontend:

  • Verify WebSocket client is connected
  • Check browser console for JavaScript errors
  • Ensure the client sends a "connect" message after WebSocket connection

Responses not reaching MCP:

  • Verify the response includes the correct request_id
  • Check that the response message type is user_response
  • Ensure the WebSocket connection is still active

Debug Mode

Enable verbose logging by checking the server output. The application logs:

  • Client connections and disconnections
  • Message routing between components
  • Error conditions and their causes

Testing Components

Run individual component tests:

# Test the complete system
./test_full_system.sh

# Test Docker deployment
./test_docker.sh

# Test individual components
go run test_client.go    # WebSocket client
go run test_mcp.go      # MCP client

Development

Project Structure

├── cmd/server/          # Main application entry point
├── internal/
│   ├── mcpserver/       # MCP server implementation (unused in current version)
│   ├── tools/           # MCP tool implementations
│   └── wsserver/        # WebSocket server implementation
├── pkg/messaging/       # Message types and utilities
├── test_client.go       # WebSocket client test
├── test_mcp.go         # MCP client test
└── Dockerfile          # Docker configuration

Adding New Tools

To add a new MCP tool:

  1. Create a new file in internal/tools/
  2. Implement the tool interface:
    type MyTool struct{}
    
    func (t *MyTool) Name() string { return "my_tool" }
    func (t *MyTool) Description() string { return "Description" }
    func (t *MyTool) Execute(ctx context.Context, params json.RawMessage) (interface{}, error) {
        // Implementation
        return result, nil
    }
    
  3. Register the tool in cmd/server/main.go

License

This project is licensed under the MIT License - see the LICENSE file for details.

README fetched from the repository 7 days ago. The original is authoritative.

Questions

About Frontend Router MCP

How do I install Frontend Router MCP?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Frontend Router MCP safe to use with an AI agent?

Its trust score is 41 out of 100 (fair). It passes 3 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Frontend Router MCP still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.