Skip to main content
Glama
blackviking1311

MCP FastMCP Demo Server

README.md
# MCP FastMCP Demo Server

This project is a simple **MCP (Model Context Protocol) server** built using **FastMCP**.  
It exposes:
- A tool (`add`)
- A dynamic resource (`greeting://{name}`)
- A prompt (`greet_user`)

The server is designed to run over **STDIO** and can be inspected using the **MCP Inspector UI**.

---

## πŸ“¦ Prerequisites

Make sure you have the following installed:

### All Platforms
- **Python 3.9+**
- **Node.js 18+**
- **npm** (comes with Node.js)

Check versions:
```bash
python --version
node --version
npm --version
```

### 🐍 Python Setup
### 1️⃣ Create a virtual environment (recommended)
**Linux / macOS**
```bash
python3 -m venv .venv
source .venv/bin/activate
```

**Windows (PowerShell)**
```bash
python -m venv .venv
.venv\Scripts\Activate.ps1
```

### 2️⃣ Install dependencies
```bash
pip install -r requirements.txt

(If using uv, make sure it’s already configured.)
```

▢️ Running the MCP Server with Inspector
The MCP Inspector will start the server and connect to it automatically using STDIO.

Linux / macOS / Windows
```bash
npx @modelcontextprotocol/inspector python server.py
```
This will:
Launch the Inspector UI Spawn python server.py and Connect via STDIO automatically.

### πŸ“ Inspector UI opens at:
http://localhost:5173 πŸ§ͺ Verifying the Connection. 

### Once connected in the Inspector UI:
**Tools**
1. add(a: int, b: int) β†’ int
2. Resources
3. greeting://{name}
4. Prompts
5. greet_user