MCP Example Simple Server
This is a simple example of a server built with the FastMCP framework.
Setup and Installation
These instructions will guide you through setting up the project environment and installing the necessary dependencies.
- Create and Activate a Virtual Environment First, create a Python virtual environment to isolate the project's dependencies. This is a one-time setup step.
Create the virtual environment in a directory named 'venv'
python3 -m venv venv
Activate the environment
source venv/bin/activate
Your terminal prompt should now be prefixed with (venv).
- Install Dependencies With the virtual environment active, install the required Python packages using uv (or pip) and the requirements.txt file.
Install all dependencies listed in requirements.txt
uv pip install -r requirements.txt
Running the Server You can run the server directly to ensure it starts up.
Make sure your virtual environment is still active.
Use the uv run command to start the server:
uv run server.py
You should see output indicating the server has started on http://localhost:8000. You can stop it by pressing CTRL+C.
Testing with MCP Inspector The recommended way to test and debug the server is with the official MCP Inspector. The inspector will launch your server for you and provide a web-based UI to interact with it.
Stop the server if it is currently running (press CTRL+C in its terminal).
In your terminal (with the venv still active), run the following command:
npx @modelcontextprotocol/inspector uv run server.py
This command does two things:
npx ...: Downloads and runs the MCP Inspector tool.
uv run server.py: Tells the inspector how to start your Python server.
The terminal will display a message like: 🔍 MCP Inspector is up and running at http://127.0.0.1:6274
Open that URL (http://1227.0.0.1:6274) in your web browser.
In the Inspector UI, click the "▶︎ Connect" button to connect to your server and begin testing its tools and resources.
This server cannot be installed
A basic example MCP server built with the FastMCP framework for demonstration and learning purposes. Provides a starting point for developers to understand MCP server implementation.
Related MCP Servers
- AsecurityAlicenseAqualityA starter template for building MCP servers with FastMCP, providing testing, linting, formatting, and NPM publishing setup.Last updated -10MIT License
- AsecurityAlicenseAqualityA lightweight framework for building and running Model Context Protocol (MCP) servers using FastMCP, providing tools for development, debugging, and server management.Last updated -4MIT License
- -securityFlicense-qualityA basic MCP server template built with FastMCP that provides simple tools for greeting users, performing math operations, and managing user information. Serves as a starting point for building custom MCP servers with essential functionality examples.Last updated -4
- -securityAlicense-qualityA simple MCP server built with FastMCP for experimentation and learning purposes. Includes basic web tools like article fetching and serves as a human-readable template for building custom MCP servers.Last updated -AGPL 3.0