- Home
- MCP servers
- FastMCP Beginner
FastMCP Beginner
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can run lightweight MCP servers that expose tools for AI agents to call, over stdio or HTTP transports. These servers demonstrate basic tool exposure, simple web API access, and how to validate MCP functionality with an inspector tool. This guide walks you through practical usage, installation steps, and important notes so you can experiment with MCP servers in a beginner-friendly setup.
How to use
You connect to an MCP server from your AI client by selecting either a local stdio server or a web API server. For stdio, the agent communicates through standard input/output with the running script. For HTTP, the agent talks to a web API endpoint using HTTP and Server-Sent Events (SSE) for streaming updates.
How to install
Prerequisites you need on your machine before starting are a Python 3.x runtime and Node.js with npm (for running the inspector tools). Ensure you have network access if you plan to test the HTTP/SSE transport.
# Install Node.js and npm if you don\'t have them
# On macOS with Homebrew:
brew install node
# On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install -y nodejs npm
# Verify installations
node -v
npm -v
# Install the MCP inspector tool globally for testing
npm install -g @modelcontextprotocol/inspector
Additional notes and validation
The beginner setup includes two MCP server scenarios you can run locally and validate with the inspector. You can choose either a stdio-based server or an HTTP/SSE transport. Validation involves launching the inspector and confirming that exposed tools are visible and callable from your AI client.
# Scenario 1: Run a basic stdio MCP server script
npx @modelcontextprotocol/inspector python fastmcp_calc.py
# Scenario 2: Run a FastMCP web API server (HTTP + SSE)
# Start the API server locally
python fastmcp_api.py
# Validate with MCP Inspector (example endpoint from this setup)
npx @modelcontextprotocol/inspector http://localhost:8001/mcp
Notes:
- For the stdio scenario, you interact with the server via the inspector running the script that exposes tools like a calculator.
- For the HTTP/SSE scenario, you access the API at the specified local host and port, then use the inspector to verify the MCP endpoint.
## Environment and tooling considerations
No special environment variables are shown for these example configurations. If you add environment variables later, document them in your deployment so your AI agent can use the correct credentials, endpoints, or feature flags.
## Available tools
### calculator
Exposes a basic calculator tool that AI agents can invoke to perform arithmetic calculations or simple expressions.