README.mdā¢2 kB
# 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.
1. 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).
2. 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.