Simple MCP (Model Context Protocol) server with a Flask-based web GUI
This is a simple MCP server implementation that exposes various tools through a web-based GUI. The server includes several example tools that demonstrate different functionalities:
- calculate: Perform basic mathematical operations (add, subtract, multiply, divide)
- text_analyzer: Analyze text and provide statistics (word count, character count, etc.)
- timestamp: Get current timestamp in various formats
- string_transform: Transform strings (uppercase, lowercase, reverse, title case)
- fibonacci: Generate Fibonacci sequence
- Clone this repository:
git clone https://github.com/thedcfix/MCP-Server.git
cd MCP-Server- Install dependencies:
pip install -r requirements.txt- Start the Flask server:
python app.py- Open your web browser and navigate to:
http://localhost:5000
- The GUI will display:
- Server information and statistics
- List of all available tools with their descriptions and parameters
- A test section where you can execute tools with custom parameters
The server exposes the following REST API endpoints:
GET /- Web GUI interfaceGET /api/tools- List all available toolsGET /api/server-info- Get server informationPOST /api/execute- Execute a tool with parameters
# List all tools
curl http://localhost:5000/api/tools
# Execute the calculate tool
curl -X POST http://localhost:5000/api/execute \
-H "Content-Type: application/json" \
-d '{"tool_name": "calculate", "parameters": {"operation": "add", "a": 10, "b": 5}}'
# Analyze text
curl -X POST http://localhost:5000/api/execute \
-H "Content-Type: application/json" \
-d '{"tool_name": "text_analyzer", "parameters": {"text": "Hello world!"}}'MCP-Server/
├── app.py # Flask web application
├── mcp_server.py # MCP server implementation with tools
├── templates/
│ └── index.html # Web GUI template
├── requirements.txt # Python dependencies
└── README.md # This file
To add a new tool to the MCP server:
- Open
mcp_server.py - Add a new method to handle the tool (e.g.,
_my_tool) - Register the tool in the
_register_tools()method with its metadata - The tool will automatically appear in the web GUI
MIT License