Skip to content

monok8i/mcp-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCP Explorer

A modern, full-stack application for exploring and interacting with Model Context Protocol (MCP) servers. MCP Explorer provides a user-friendly interface to connect to MCP servers, discover available tools, and execute them with custom parameters.

πŸš€ Features

  • Easy MCP Server Connection: Connect to any MCP server via STDIO protocol
  • Tool Discovery: Automatically list all available tools from connected servers
  • Interactive Tool Execution: Execute tools with custom arguments and view results
  • Real-time Status Monitoring: Monitor connection status in real-time
  • Modern UI: Built with Next.js and React for a smooth user experience
  • REST API: Comprehensive REST API for programmatic access
  • Docker Support: Easy deployment with Docker Compose
  • CORS Enabled: Full CORS support for cross-origin requests

πŸ“‹ Table of Contents

πŸ—οΈ Architecture

MCP Explorer follows a layered architecture with clear separation of concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Next.js Frontend (React)              β”‚
β”‚           (Port 3000)                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ HTTP Requests
                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         FastAPI Backend (Python)                β”‚
β”‚         (Port 8000)                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MCP Clients   β”‚   β”‚ Connection      β”‚
β”‚  (STDIO)       β”‚   β”‚ Manager         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        └─────────────────────┬─────────────────┐
                              β”‚                 β”‚
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚  MCP Server 1  β”‚  β”‚  MCP Server 2 β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For detailed architecture information, see backend/ARCHITECTURE.md.

πŸ› οΈ Technology Stack

Backend

  • Python 3.13+: Modern Python runtime
  • FastAPI: High-performance web framework
  • Uvicorn: ASGI server
  • Pydantic: Data validation
  • MCP SDK (1.25.0+): Official Model Context Protocol library

Frontend

  • Next.js: React framework with server-side rendering
  • React 18: UI library
  • TypeScript: Type-safe JavaScript
  • Tailwind CSS: Utility-first CSS framework
  • Radix UI: Headless UI component library
  • React Hook Form: Flexible form handling

DevOps

  • Docker: Containerization
  • Docker Compose: Multi-container orchestration
  • Ruff: Python linter and formatter

πŸ“¦ Prerequisites

OR for manual setup:

  • Python 3.13+
  • Node.js 18+
  • npm or pnpm

🐳 Quick Start with Docker Compose

1. Clone the Repository

git clone https://github.com/yourusername/mcp-explorer.git
cd mcp-explorer

2. Start the Application

docker-compose up -d

This will start:

3. Verify Services Are Running

docker-compose ps

You should see:

NAME                        STATUS
mcp-explorer-frontend       Up
mcp-explorer-backend        Up

4. Access the Application

5. Stop the Application

docker-compose down

To remove volumes as well:

docker-compose down -v

πŸ”§ Manual Setup

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Create virtual environment (optional but recommended):

    python3.13 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -e .
  4. Run the development server:

    python main.py

    Or with Uvicorn directly:

    uvicorn main:app --reload --host 0.0.0.0 --port 8000

The backend will be available at http://localhost:8000

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
    # or
    pnpm install
  3. Run the development server:

    npm run dev
    # or
    pnpm dev

    The frontend will be available at http://localhost:3000

πŸ“ Project Structure

mcp-explorer/
β”œβ”€β”€ backend/                      # Python FastAPI application
β”‚   β”œβ”€β”€ main.py                  # Application entry point
β”‚   β”œβ”€β”€ pyproject.toml           # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile               # Backend container config
β”‚   β”œβ”€β”€ ARCHITECTURE.md          # Detailed architecture docs
β”‚   β”‚
β”‚   └── src/
β”‚       β”œβ”€β”€ factory.py           # FastAPI app factory
β”‚       β”œβ”€β”€ lifespan.py          # App lifecycle events
β”‚       β”œβ”€β”€ exceptions.py        # Global exceptions
β”‚       β”‚
β”‚       β”œβ”€β”€ api/                 # API layer
β”‚       β”‚   β”œβ”€β”€ dependencies.py  # FastAPI dependencies
β”‚       β”‚   β”œβ”€β”€ schemas.py       # Request/response models
β”‚       β”‚   └── endpoints/
β”‚       β”‚       └── stdio.py     # STDIO connection endpoints
β”‚       β”‚
β”‚       β”œβ”€β”€ mcp/                 # MCP integration
β”‚       β”‚   β”œβ”€β”€ manager.py       # Connection manager
β”‚       β”‚   β”œβ”€β”€ exceptions.py    # MCP-specific exceptions
β”‚       β”‚   β”œβ”€β”€ client/          # MCP client implementations
β”‚       β”‚   β”‚   β”œβ”€β”€ base.py      # IMCPClient protocol
β”‚       β”‚   β”‚   β”œβ”€β”€ stdio.py     # STDIO client
β”‚       β”‚   β”‚   └── http.py      # HTTP client (planned)
β”‚       β”‚   └── connection/      # Connection models
β”‚       β”‚       β”œβ”€β”€ connection.py
β”‚       β”‚       β”œβ”€β”€ config.py
β”‚       β”‚       └── type.py
β”‚       β”‚
β”‚       └── utils/               # Utilities
β”‚           └── logging/
β”‚
β”œβ”€β”€ frontend/                     # Next.js React application
β”‚   β”œβ”€β”€ package.json             # Node dependencies
β”‚   β”œβ”€β”€ Dockerfile               # Frontend container config
β”‚   β”œβ”€β”€ next.config.mjs          # Next.js configuration
β”‚   β”œβ”€β”€ tsconfig.json            # TypeScript config
β”‚   β”‚
β”‚   β”œβ”€β”€ app/                     # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ layout.tsx           # Root layout
β”‚   β”‚   β”œβ”€β”€ page.tsx             # Home page
β”‚   β”‚   └── globals.css          # Global styles
β”‚   β”‚
β”‚   β”œβ”€β”€ components/              # React components
β”‚   β”‚   β”œβ”€β”€ mcp-explorer.tsx     # Main explorer component
β”‚   β”‚   β”œβ”€β”€ connection-sidebar.tsx
β”‚   β”‚   β”œβ”€β”€ tools-panel.tsx
β”‚   β”‚   β”œβ”€β”€ results-panel.tsx
β”‚   β”‚   └── ui/                  # Radix UI components
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”‚   └── use-mcp-connection.ts # MCP connection hook
β”‚   β”‚
β”‚   β”œβ”€β”€ lib/                     # Utilities
β”‚   β”‚   β”œβ”€β”€ types.ts             # TypeScript types
β”‚   β”‚   └── utils.ts             # Helper functions
β”‚   β”‚
β”‚   └── public/                  # Static assets
β”‚
β”œβ”€β”€ test-server/                 # Example MCP test server
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ tools.py
β”‚   └── pyproject.toml
β”‚
β”œβ”€β”€ docker-compose.yml           # Docker Compose configuration
└── README.md                    # This file

πŸ“‘ API Endpoints

Root

  • GET / - API information

MCP STDIO Operations

Method Endpoint Description
POST /mcp/stdio/connect Connect to an MCP server
POST /mcp/stdio/disconnect Disconnect from server
GET /mcp/stdio/status Get connection status
GET /mcp/stdio/list-tools List available tools
POST /mcp/stdio/execute Execute a tool

Documentation

  • GET /docs - Swagger UI (interactive)
  • GET /redoc - ReDoc documentation
  • GET /openapi.json - OpenAPI schema

πŸ’» Frontend Usage

Connecting to an MCP Server

  1. Open http://localhost:3000

  2. Use the connection sidebar to create a new connection

  3. Provide server details:

    • Name: Connection identifier
    • Command: The executable (e.g., python)
    • Args: Command arguments (e.g., -m my_mcp_server)
    • Environment: Optional environment variables
  4. Click "Connect"

Executing Tools

  1. Once connected, the available tools appear in the tools panel
  2. Select a tool to see its input schema
  3. Fill in the required parameters
  4. Click "Execute"
  5. View results in the results panel

πŸš€ Development

Backend Development

  1. Start development server:

    cd backend
    python main.py
  2. Run linter/formatter:

    ruff check .
    ruff format .
  3. Access API documentation: http://localhost:8000/docs

Frontend Development

  1. Start development server:

    cd frontend
    npm run dev
  2. Build for production:

    npm run build
  3. Run linter:

    npm run lint

Code Quality

The project enforces code quality standards:

Backend (Ruff):

  • Line length: 79 characters (PEP 8)
  • Target: Python 3.13
  • Enabled rules: pycodestyle, pyflakes, pep8-naming, pydocstyle, pyupgrade, isort, flake8-bugbear, flake8-comprehensions, flake8-simplify

πŸ› Troubleshooting

Containers won't start

# Check logs
docker-compose logs

# Rebuild containers
docker-compose build --no-cache

# Start again
docker-compose up

Backend connection errors

Ensure the backend is running and accessible:

curl http://localhost:8000/

Frontend can't connect to backend

  1. Verify backend is running: http://localhost:8000
  2. Check CORS settings in backend/src/factory.py
  3. Ensure both services are on the same Docker network

MCP Server connection issues

  1. Verify the MCP server command is correct
  2. Check server logs in the results panel
  3. Ensure all required dependencies are installed

Port conflicts

If ports 3000 or 8000 are in use:

Option 1: Stop other services using those ports

lsof -i :3000  # Check port 3000
lsof -i :8000  # Check port 8000

Option 2: Modify docker-compose.yml:

services:
  frontend:
    ports:
      - "3001:3000"  # Changed to 3001
  backend:
    ports:
      - "8001:8000"  # Changed to 8001

πŸ“š Additional Resources

πŸ“ License

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

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ’‘ Future Enhancements

  • Connection persistence and history
  • Authentication and authorization
  • HTTP/SSE MCP client support
  • Connection pooling
  • Performance metrics and monitoring
  • Tool execution templates
  • Result export functionality

Happy exploring! πŸš€

About

MCP Explorer - An web application for testing and exploring your own/another MCP server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors