MCP Calculator Demo

MCP Calculator Demo

A simple demonstration MCP server built with FastMCP that exposes basic calculator operations (add, subtract, multiply, divide) as tools for MCP clients like GitHub Copilot Agent mode.

Category
Visit Server

README

Day 2 MCP Calculator Demo (FastMCP) This demo contains a simple MCP server built using FastMCP. It demonstrates how to expose tools to MCP clients such as GitHub Copilot Agent mode using a modern Python setup based on uv.

Prerequisites Python 3.10 or newer VS Code No prior virtual environment setup is required.

Step 1: Install uv macOS / Linux curl -LsSf https://astral.sh/uv/install.sh | sh

Restart your terminal after installation.

Windows (PowerShell) irm https://astral.sh/uv/install.ps1 | iex

Verify installation:

uv --version

Step 2: Set Up the Python Environment Initialize the project environment (only needed once):

uv init

This creates: - pyproject.toml - .python-version - A managed virtual environment

Step 3: Install Dependencies Install FastMCP and required dependencies:

uv add fastmcp starlette

This will: - Create a virtual environment automatically - Resolve and lock dependencies - Generate uv.lock

Step 4: Activate the Environment (Optional) You do not need to activate the environment manually when using uv run.

If you want to activate it explicitly:

macOS / Linux source .venv/bin/activate

Windows (PowerShell) .venv\Scripts\activate

Step 5: Run the MCP Server Run the demo MCP server:

uv run python servers\01_calculator_stdio.py.py

You should see output indicating that the MCP server is running.

Available Tools add(a: int, b: int) -> int subtract(a: int, b: int) -> int multiply(a: int, b: int) -> int divide(a: int, b: int) -> Optional[float] Key Files 01_calculator_stdio.py – MCP server implementation pyproject.toml – Project configuration and dependencies uv.lock – Locked dependency versions .python-version – Python runtime version Workshop Notes Do not use pip install Do not create virtual environments manually Always use uv add and uv run This ensures consistent behavior across machines, CI pipelines, and cloud deployments.

MCP Inspector The MCP Inspector is a local web-based tool used to inspect MCP servers, discover tools, send test requests, and view responses.

Install MCP Inspector The MCP Inspector is distributed as an npm package.

Prerequisites:

Node.js 18 or newer npm Run MCP Inspector Start the MCP Inspector UI:

npx @modelcontextprotocol/inspector By default, the Inspector runs at:

http://localhost:6274

Connect to the MCP Server (STDIO) In MCP Inspector:

Transport: stdio Command: uv Arguments: run python <full path to your mcp server>.py Click Connect.

What You Can Do with MCP Inspector Discover available tools Inspect tool schemas Send tool invocation requests View raw MCP messages Inspect errors and responses Workshop Notes MCP Inspector is intended for local development and debugging It is not used in production deployments It helps visualize MCP message flow and tool schemas

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured