Advanced MCP HTTP Server
Provides a web UI for exploring tools, resources, and prompts.
Integrates OpenAI GPT models for tool calling and autonomous execution based on user intent.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Advanced MCP HTTP Serverlist all files in the workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP HTTP Advanced Host-Client-Server Application
A production-ready implementation of the Model Context Protocol (MCP) over HTTP with LLM tool integration, featuring OpenAI GPT models, comprehensive security, resilience patterns, and enterprise testing.
๐ฏ Key Features
Core Capabilities
โ HTTP-based MCP - Distributed tool protocol over HTTP
โ LLM Integration - OpenAI GPT model with function calling
โ Filesystem Tools - Read/write files with security
โ Web UI - Gradio interface for exploration and testing
โ AI Agent - Autonomous tool execution based on user intent
Production Ready
โ Configuration Management - JSON config with env var substitution
โ Security - Path traversal prevention, input validation, UTF-8 enforcement
โ Resilience - Connection retry, heartbeat verification, error recovery
โ Logging - Structured logging with configurable levels
โ Testing - 75+ tests with 90%+ coverage, CI/CD pipeline
โ Documentation - Comprehensive guides for configuration and testing
Related MCP server: MCP Server
๐ฆ What's Included
๐ฏ mcp_http_server.py HTTP MCP Server (FastMCP)
๐จ mcp_http_client_app.py Web UI (Gradio) for exploration
๐ค mcp_http_host_app.py AI Agent with OpenAI integration
๐ mcp_config.py Configuration management with priority resolution
โ๏ธ mcp_config.json Production configuration
๐งช tests/ 75+ test cases with pytest
๐ .github/workflows/ci_cd.yml GitHub Actions CI/CD pipeline
๐ Documentation Guides for quick start, config, testing, and review๐ Quick Start (5 minutes)
Prerequisites
python 3.9+ # For async/await and type hints
pip package manager # For dependency installation
OpenAI API key # For GPT model accessInstallation
Clone and setup
git clone <repo> cd advanced-mcp-host-client-server-app pip install -r requirements.txtSet API key
export OPENAI_API_KEY=sk-your-key-hereStart server
python mcp_http_server.py # Server running on http://127.0.0.1:8000Start AI Host (new terminal)
python mcp_http_host_app.py http://127.0.0.1:8000 ./workspace # Access at http://127.0.0.1:7862Chat with AI
Go to
http://127.0.0.1:7862Type: "List the files in workspace"
AI calls
list_filestool automatically!
See QUICKSTART.md for detailed setup instructions.
๐ Documentation
Document | Purpose |
5-minute setup and common tasks | |
Configuration reference with examples | |
Testing guide with 75+ test cases | |
Complete technical review and architecture |
๐๏ธ Architecture
Component Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Application Suite โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
GUI Client AI Host App API Clients
(Gradio UI) (GPT + Tool Calling) (Custom clients)
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
HTTP/Streamable
โ
โโโโโโโโโโโผโโโโโโโโโโโ
โ HTTP MCP Server โ
โ (FastMCP) โ
โ โ
โ โข File Tools โ
โ โข Resources โ
โ โข Prompts โ
โ โข Analysis โ
โโโโโโโโโโโโโโโโโโโโโโ
โ
Workspace
(./workspace files)Component Responsibilities
mcp_http_server.py: Exposes filesystem and analysis tools via HTTP MCP
mcp_http_client_app.py: Web UI for exploring tools, resources, and prompts
mcp_http_host_app.py: LLM agent that calls tools autonomously
mcp_config.py: Centralized configuration with priority resolution
tests/: Comprehensive test suite for reliability
๐ Security Features
Feature | Purpose | Example |
Roots Validation | Prevent directory traversal | Blocks |
Path Checking | Block absolute paths | Rejects |
Input Validation | Sanitize parameters | Checks for special chars |
UTF-8 Encoding | Prevent encoding attacks | Enforces UTF-8 on files |
Error Safety | No path disclosure | Returns safe error messages |
โ๏ธ Configuration
Three Tiers (Priority)
1. Command-line arguments (Highest priority)
โโ python app.py --model gpt-4o
2. Configuration file
โโ mcp_config.json with "model": "gpt-4o-mini"
3. Environment variables
โโ export OPENAI_MODEL=gpt-4o-mini
4. Hardcoded defaults (Lowest priority)
โโ DEFAULT_MODEL = "gpt-4o-mini"Example mcp_config.json
{
"openai": {
"api_key": "${OPENAI_API_KEY}",
"model": "gpt-4o-mini"
},
"server": {
"host": "127.0.0.1",
"port": 8000
},
"gui": {
"host": "127.0.0.1",
"port": 7862
},
"logging": {
"level": "INFO"
}
}See CONFIG.md for complete configuration guide.
๐งช Testing
Run All Tests
pip install -r requirements-test.txt
pytest tests/ -vTest Coverage
Overall: 90%+
Config module: 95%+
Server module: 90%+
Client module: 85%+
Test Types
Unit Tests (60%): Fast, isolated component tests
Security Tests (20%): Vulnerability and attack prevention
Integration Tests (20%): Real-world scenarios
See TESTING.md for comprehensive testing guide.
๐ Resilience Features
Feature | Impact | Details |
Connection Retry | Automatic recovery | 3 attempts, 1s delay |
Heartbeat | Detects dead connections | 2s verification timeout |
History Bounded | Prevents token overflow | Max 20 messages |
Error Recovery | Graceful degradation | Logs errors, continues |
๐ Performance
Metric | Value |
Server Throughput | ~100+ requests/second |
Tool Call Latency | <50ms (local network) |
Connection Time | <1 second (with retry) |
Memory Baseline | ~100MB |
Max History | 20 messages (bounded) |
๐ Deployment
Local Development
# Terminal 1: Server
python mcp_http_server.py
# Terminal 2: GUI Client
python mcp_http_client_app.py http://localhost:8000 ./workspace
# Terminal 3: AI Host
python mcp_http_host_app.py http://localhost:8000 ./workspaceDocker
docker build -t mcp-app .
docker run -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8000:8000 -p 7862:7862 mcp-appGitHub Actions CI/CD
โ Automated testing on Python 3.9-3.11
โ Runs on Linux, macOS, Windows
โ Code quality checks (pylint, black, flake8, mypy)
โ Security checks (bandit, safety)
โ Coverage reporting
See PROJECT_REVIEW.md for deployment details.
๐ ๏ธ Tools & Technologies
Core
FastMCP 2.12.5: MCP server framework
OpenAI SDK 2.6.1: GPT model integration
Gradio 5.49.1: Web UI framework
Uvicorn 0.38.0: ASGI server
HTTPx: HTTP client
Testing
Pytest 7.4.3: Test framework
Pytest-asyncio: Async test support
Pytest-cov: Coverage reporting
Black, Pylint, Flake8, MyPy: Code quality
๐ API Reference
Server Tools
read_file(filepath: str) -> str
# Read file from workspace
write_file(filepath: str, content: str) -> str
# Write file to workspace
list_files(directory: str) -> List[str]
# List directory contents
analyze_code(code: str, focus: str = "") -> str
# Analyze code with LLMClient Methods
await client.connect()
await client.list_tools()
await client.call_tool(name, arguments)
await client.list_resources()
await client.read_resource(uri)
await client.list_prompts()
await client.get_prompt(name, arguments)๐ Security Considerations
โ Implemented
Path traversal prevention
Input validation on all parameters
UTF-8 encoding enforcement
Error message safety
Dependency security checks (CI/CD)
โ ๏ธ To Implement
API authentication
Authorization/RBAC
Rate limiting
Request signing
Data encryption at rest
See PROJECT_REVIEW.md for security details.
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Open a Pull Request
All PRs must:
โ Pass all tests
โ Maintain 90%+ coverage
โ Pass code quality checks
โ Include documentation
๐ Project Status
โ Completed
HTTP MCP server with filesystem tools
Gradio web UI for tool exploration
OpenAI integration with function calling
Configuration management system
75+ test cases with CI/CD pipeline
Comprehensive documentation
Security hardening
Resilience patterns
๐ง In Progress
Enhanced monitoring and metrics
Performance optimization
Extended logging
๐ Planned
Multi-instance load balancing
Persistent conversation storage
Database-backed file storage
Authentication/authorization
WebSocket support
Batch operations
Custom tool templates
๐ License
This project is licensed under the MIT License - see LICENSE file for details.
๐ฅ Author
Deepak Upadhyay - Engineering
๐ Acknowledgments
FastMCP team for MCP server framework
OpenAI for GPT model APIs
Gradio for web UI components
Python async/await ecosystem
๐ Support
For issues, questions, or feature requests:
Check Documentation
QUICKSTART.md - Common tasks
CONFIG.md - Configuration help
TESTING.md - Test documentation
Review Examples
Check tests/ for usage examples
Review mcp_config.json for setup
Debug Issues
Enable debug logging:
LOG_LEVEL=DEBUGCheck PROJECT_REVIEW.md for architecture
Run tests:
pytest -vto verify setup
๐ Learning Resources
Version: 1.0.0
Last Updated: 2024
Status: Production Ready โ
Made with โค๏ธ for the agentic engineering community.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Nifty's MCP server โ exposes tasks, projects, messages, and files as tools for AI agents.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseAqualityFmaintenanceAn MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.1055 PyPI97MIT
- FlicenseNot gradedqualityCmaintenanceA secure Model Context Protocol server providing HTTP endpoints for AI agent tool execution, including file system operations, shell commands, and LLM-based code generation.1-
- AlicenseNot gradedqualityDmaintenanceA secure, production-grade MCP server that provides filesystem operations, AST math evaluation, and system diagnostics for LLM agents.MIT
- AlicenseNot gradedqualityDmaintenanceA powerful MCP server that enables LLMs to safely execute code, control file systems, search the web, and integrate with services like Gmail and TMDB.MIT