fastmcp-server

swissmarley/fastmcp-server

3.2

If you are the rightful owner of fastmcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

FastMCP-Server is a local web GUI and MCP server for experimenting with FastMCP-based tools, providing a Flask-based interface for managing server functions and integrations.

Tools
4
Resources
0
Prompts
0

FastMCP-Server

A small, local web GUI and MCP (Model-Connected-Plugin) server for experimenting with FastMCP-based tools. Provides a Flask-based web interface to start/stop the MCP server, view and manage available functions, and configure integrations for LLM clients such as Claude and Cursor.


Features

  • Start/stop a local MCP server from a web UI.
  • List built-in and custom functions available to the MCP server.
  • Add or remove simple custom functions at runtime via the web API.
  • Example built-in tools: weather lookup, safe calculation, file operations, server status.
  • Integration guidance for LLM clients (Claude, Cursor).

Repository Structure

  • mcp_server.py — MCP server implementation using fastmcp and a small set of built-in tools.
  • web_server.py — Flask + Flask-SocketIO app that provides the web GUI and REST API.
  • templates/index.html — Web UI HTML.
  • static/script.js & static/styles.css — Frontend assets.
  • requirements.txt — Python dependencies (if present).

Requirements

  • Python 3.8 or newer.
  • Recommended virtual environment (venv, conda, etc.).
  • Basic packages used in this project (install via requirements.txt if provided):
pip install -r requirements.txt
# or, if you don't have a requirements file present:
pip install flask flask-cors flask-socketio pydantic
# and any package that provides `fastmcp` if it's published, or install locally.

Note: The project imports fastmcp. If you do not have a package named fastmcp, ensure you install or provide it in your environment.


Quick Start

  1. Create and activate a virtual environment (optional but recommended):
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Start the web GUI (runs on port 5001 by default):
python3 web_server.py
  1. From the web UI (http://localhost:5001) you can start the MCP server by clicking "Start" or use the API endpoint below.

Running the MCP Server Manually

The web_server.py can start/stop the MCP server as a subprocess. To run the MCP server directly in a terminal (for debugging), you can run:

python3 -c "import asyncio; from mcp_server import mcp_server; asyncio.run(mcp_server.run())"

This will run the MCP server (the internal code calls FastMCP.run(transport='stdio') by default). The web GUI expects the MCP server endpoint to be reachable as described in setup instructions.


REST API

The web_server.py provides a small REST API to control the MCP server and manage functions. All endpoints are prefixed with /api and served by the Flask app on port 5001 by default.

  • GET /api/server/status — Returns current server running status, available functions, and config.
  • POST /api/server/start — Start the MCP server (returns JSON with success and running).
  • POST /api/server/stop — Stop the MCP server (returns JSON with success and running).
  • GET /api/functions — Returns list of functions (built-in + custom).
  • POST /api/functions — Add a custom function. Expect JSON with name, description, parameters (optional), and code (string containing function definition).
  • DELETE /api/functions/<function_name> — Remove a custom function.
  • GET /api/config — Get server configuration (name, description, version).
  • POST /api/config — Update server configuration (JSON: name, description, version).
  • GET /api/llm-config — Returns sample setup instructions for clients (Claude, Cursor).

Example: check server status with curl

curl http://localhost:5001/api/server/status

Web UI

Open http://localhost:5001 in your browser. The provided index.html and static assets present a simple interface to:

  • Start / Stop the MCP server.
  • View the list of available functions.
  • Add and remove custom functions via the API.

The UI interacts with the REST API defined above.


Adding Custom Functions

Use the POST /api/functions endpoint to add a new custom function. The server expects JSON with at least the following keys:

  • name — function name (string)
  • description — short description (string)
  • parameters — dict of parameter names/types (optional)
  • code — a string containing valid Python code that defines a function with the given name

The server executes the provided code in a restricted environment and registers the function with FastMCP if the named function is defined in the executed code. Custom functions are stored in-memory for the running process.

Security note: executing arbitrary code is dangerous. This project attempts to restrict builtins when adding custom functions, but this is not a full sandbox. Do not run untrusted code on production or sensitive systems.


LLM Integration Notes

The endpoint GET /api/llm-config returns example instructions to configure clients such as Claude or Cursor to connect to this MCP server. Those examples are illustrative — update paths, commands, and environment variables to match your local setup.


License

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