Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ dist
**/.DS_Store
/nix/
/.mcp.json

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
38 changes: 38 additions & 0 deletions Dockerfile.standalone
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Multi-stage build for the standalone MCP Gateway with UI
FROM golang:1.24.5-alpine AS builder

# Install dependencies
RUN apk add --no-cache git

# Set working directory
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download

# Copy source code
COPY . .

# Build the standalone gateway
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o standalone-gateway ./cmd/standalone-gateway

# Final stage
FROM alpine:latest

# Install docker CLI for MCP gateway functionality
RUN apk add --no-cache docker-cli ca-certificates

# Set working directory
WORKDIR /root/

# Copy the binary from builder stage
COPY --from=builder /app/standalone-gateway .

# Expose ports
EXPOSE 3000 8811

# Run the standalone gateway
CMD ["./standalone-gateway"]
83 changes: 83 additions & 0 deletions REMOTE_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Remote MCP Gateway Setup

This setup allows you to run MCP servers on a remote machine and connect to them from Claude Desktop or VS Code on your local machine.

## Files Created

- `python_tools/remote_claude_mcp_configs.py` - Bridge script for stdio-to-network translation
- `docker-compose-remote.yaml` - Docker Compose for remote MCP Gateway
- `claude-desktop-config.json` - Claude Desktop configuration
- `test-connection.sh` - Test script to verify setup

## Setup Instructions

### 1. On Remote Machine (192.168.1.231)

1. Copy the `docker-compose-remote.yaml` file to your remote machine
2. Start the MCP Gateway:
```bash
docker compose -f docker-compose-remote.yaml up -d
```
3. Verify it's running:
```bash
docker compose -f docker-compose-remote.yaml logs gateway
```

### 2. On Local Machine

1. Test the connection:
```bash
./test-connection.sh
```

2. Update your Claude Desktop configuration:
- Location: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Copy content from `claude-desktop-config.json`

3. Restart Claude Desktop

## Troubleshooting

### Common Issues

1. **HTTP/1.1 errors**: The gateway is running in wrong transport mode
- Solution: Use `--transport=stdio` in Docker command

2. **Python syntax errors**: Using older Python version
- Solution: Use `/usr/local/bin/python3` explicitly

3. **Connection refused**: Gateway not accessible
- Check if gateway is running: `nc -z 192.168.1.231 8080`
- Check firewall settings on remote machine

### Testing Individual Components

1. **Test gateway directly**:
```bash
nc 192.168.1.231 8080
```

2. **Test Python bridge**:
```bash
python3 python_tools/remote_claude_mcp_configs.py 192.168.1.231 8080
```

3. **Check gateway logs**:
```bash
docker compose -f docker-compose-remote.yaml logs -f gateway
```

## Configuration Details

### Transport Protocol
- Gateway runs with `--transport=stdio` for bridge compatibility
- Bridge translates between stdio (Claude) and network socket (Gateway)

### Network Setup
- Gateway binds to `0.0.0.0:8080` for LAN access
- Bridge connects to specific IP (`192.168.1.231:8080`)

### Python Compatibility
- Script uses Python 2/3 compatible syntax
- No type hints for older Python versions
- Explicit error handling and formatting
205 changes: 205 additions & 0 deletions STANDALONE-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Standalone MCP Gateway with Web UI

A complete standalone Model Context Protocol (MCP) gateway with a modern web-based user interface for dynamic server management.

## 🎯 Overview

This standalone gateway provides a user-friendly web interface to manage MCP servers dynamically, generate configuration files for popular MCP clients, and deploy complete MCP solutions with Docker.

![MCP Gateway Manager UI](https://github.com/user-attachments/assets/9264cf08-62ae-4be1-b4ed-f3427b54341e)

## ✨ Key Features

🎛️ **Modern Web Interface**
- Responsive design with intuitive server management
- Real-time server status indicators
- Search and filter capabilities

🔄 **Dynamic Server Management**
- Add/remove servers on the fly
- Complete Docker MCP catalog integration
- Server configuration management

📋 **Configuration Export**
- Claude Desktop (`mcp.json`) generation
- LLM Studio configurations
- Docker Compose deployments

🌐 **Remote Operations**
- Remote gateway connections
- Cross-platform web access
- API-driven management

## 🚀 Quick Start

### Option 1: Docker Compose (Recommended)

```bash
# Clone and start
git clone https://github.com/davesbits/mcp-gateway.git
cd mcp-gateway
docker compose -f compose.standalone.yaml up -d

# Access the UI
open http://localhost:3000
```

### Option 2: Build from Source

```bash
# Prerequisites: Go 1.24+
git clone https://github.com/davesbits/mcp-gateway.git
cd mcp-gateway
go build -o standalone-gateway ./cmd/standalone-gateway
./standalone-gateway

# Access the UI
open http://localhost:3000
```

## 📖 Usage Guide

### Server Management

1. **View Servers**: Browse available MCP servers with status indicators
2. **Add Servers**: Click "Add" on inactive servers to enable them
3. **Remove Servers**: Click "Remove" on active servers to disable them
4. **Configure**: Modify server-specific configurations
5. **Search**: Use the search box to find specific servers

### Configuration Export

#### For Claude Desktop:
1. Go to "Export Config" tab
2. Click "Claude Desktop"
3. Copy the generated JSON to `~/.claude_desktop_config.json`

Example output:
```json
{
"mcpServers": {
"MCP_GATEWAY": {
"command": "docker",
"args": ["mcp", "gateway", "run", "--servers=filesystem,duckduckgo"],
"env": {}
}
}
}
```

#### For LLM Studio:
1. Click "LLM Studio" in Export Config
2. Use the SSE endpoint: `http://localhost:8811/sse`

#### For Docker Deployment:
1. Click "Docker Compose"
2. Save output as `docker-compose.yml`
3. Run: `docker compose up -d`

### Remote Gateway Management

1. Go to "Settings" tab
2. Configure remote host and protocol
3. Click "Connect to Remote"
4. Manage remote MCP gateways through the UI

## 🏗️ Architecture

```
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Web UI │ │ Standalone │ │ MCP Gateway │
│ (Port 3000) │◄───┤ Gateway │◄───┤ (Port 8811) │
│ │ │ HTTP Server │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ▼
│ ┌─────────────────┐
│ │ Docker │
│ │ MCP Servers │
│ └─────────────────┘
┌─────────────────┐
│ Configuration │
│ Management │
└─────────────────┘
```

## 🔧 API Endpoints

- `GET /api/servers` - List all available servers
- `POST /api/servers/add` - Add a server to the gateway
- `POST /api/servers/remove` - Remove a server from the gateway
- `GET /api/config` - Get gateway configuration
- `POST /api/config` - Update gateway configuration
- `GET /api/export/claude` - Export Claude Desktop configuration
- `GET /api/export/llmstudio` - Export LLM Studio configuration
- `GET /api/export/docker-compose` - Export Docker Compose configuration

## 🛠️ Development

### Building

```bash
# Build standalone gateway
go build -o standalone-gateway ./cmd/standalone-gateway

# Build Docker image
docker build -f Dockerfile.standalone -t mcp-gateway-standalone .
```

### Project Structure

```
cmd/standalone-gateway/
├── main.go # Standalone gateway server
├── ui/ # Embedded web UI files
│ ├── index.html # Main interface
│ └── app.js # JavaScript application
└── README.md # Detailed documentation

ui/ # Source UI files
├── index.html # Web interface
└── app.js # Application logic

compose.standalone.yaml # Docker Compose setup
Dockerfile.standalone # Docker build file
```

## 🌟 Sample Servers

The UI comes pre-configured with sample MCP servers:

- **filesystem**: File operations (read, write, list, create)
- **duckduckgo**: Web search capabilities
- **github**: Repository management (requires GITHUB_TOKEN)
- **postgres**: Database operations (requires connection string)
- **slack**: Messaging integration (requires SLACK_BOT_TOKEN)

## 🔒 Security

- CORS-enabled for cross-origin requests
- Docker socket access for container management
- Environment-based secret management
- Production-ready containerization

## 📚 Related Documentation

- [MCP Gateway Documentation](docs/mcp-gateway.md)
- [Dynamic Server Management](docs/feature-specs/dynamic_servers.md)
- [Docker MCP Catalog](https://hub.docker.com/mcp)
- [Model Context Protocol Specification](https://spec.modelcontextprotocol.io/)

## 🤝 Contributing

1. Fork the repository
2. Create a feature branch
3. Implement changes with tests
4. Submit a pull request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

Built with ❤️ for the MCP community
13 changes: 13 additions & 0 deletions claude-desktop-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mcpServers": {
"remote-mcp-gateway": {
"command": "/usr/local/bin/python3",
"args": [
"/Users/bits/mcp-gateway/python_tools/remote_claude_mcp_configs.py",
"192.168.1.231",
"8080"
],
"env": {}
}
}
}
Loading