Skip to main content
Glama
MCP Tools Server

MCP Tools Server

by faizannasim

# MCP Tools Server

A simple MCP (Model Context Protocol) server built with Python and FastMCP.

This project is beginner-friendly and demonstrates how to create MCP tools, run an MCP server over HTTP, and test the tools using MCP Inspector.


✨ Features

This server currently provides the following tools:

1. Add Number

Tool: Add_number

Adds two numbers and returns their sum.

Example:

a = 10
b = 20
Result = 30

2. Random Number

Tool: random_no

Generates a random integer between the provided minimum and maximum values.

Default values:

min_val = 1
max_val = 100

Example:

min_val = 1
max_val = 50
Result = 37

3. Todo Task Management

The server also includes a simple in-memory Todo system.

Available tools:

Tool

Description

add_task

Add a new task

list_task

Get all tasks

completed_task

Mark a task as completed

delete_task

Delete a task

Example task:

{
  "id": 1,
  "title": "Learn MCP",
  "completed": false
}

Note: Todo data is stored in memory using a Python list. Data will be lost when the server is restarted.


Related MCP server: MCP Server Basic Example

šŸ“¦ MCP Resource

The server also exposes:

info://server

This resource returns basic server information such as server name, environment, host, port, operating system, runtime, and version.


āœ… Requirements

  • Python 3.10+

  • uv

  • FastMCP

  • Node.js and npx (for MCP Inspector)


šŸš€ Installation

Clone the repository:

git clone <YOUR_GITHUB_REPOSITORY_URL>
cd <YOUR_PROJECT_FOLDER>

Create and use the virtual environment with uv:

uv sync

If dependencies are not already defined, install FastMCP:

uv add fastmcp

ā–¶ļø Run the MCP Server

If your Python file is named main.py:

uv run main.py

The server runs using Streamable HTTP on:

http://127.0.0.1:8000/mcp

If you are using the Todo server example on port 8001, use:

http://127.0.0.1:8001/mcp

šŸ” Test with MCP Inspector

Start MCP Inspector in another terminal:

npx -y @modelcontextprotocol/inspector

Open the Inspector URL shown in the terminal, usually:

http://localhost:6274

Add the server manually with:

Field

Value

Transport

Streamable HTTP

URL

http://127.0.0.1:8000/mcp

Then connect to the server.

Go to the Tools tab to test:

  • Add_number

  • random_no

  • add_task

  • list_task

  • completed_task

  • delete_task

Go to the Resources tab to test:

  • info://server

šŸ“ø MCP Inspector

Example of the server connected to MCP Inspector.


šŸ“ Project Structure

A simple project can look like this:

MCP Server/
│
ā”œā”€ā”€ main.py
ā”œā”€ā”€ pyproject.toml
ā”œā”€ā”€ uv.lock
ā”œā”€ā”€ README.md
└── mcp-inspector.png

āš™ļø How It Works

The basic flow is:

MCP Inspector
      |
      | Streamable HTTP
      v
FastMCP Server
      |
      +---- Add_number
      |
      +---- random_no
      |
      +---- add_task
      |
      +---- list_task
      |
      +---- completed_task
      |
      +---- delete_task
      |
      +---- info://server

šŸŽÆ Learning Goals

This project is useful for learning:

  • What an MCP server is

  • How to create MCP tools with @mcp.tool

  • How tool arguments work

  • How to expose resources with @mcp.resource

  • How to run an MCP server using HTTP

  • How to connect an MCP server to MCP Inspector

  • How multiple tools can be exposed from one MCP server

  • Basic CRUD-style application logic with an in-memory data store


šŸ‘¤ Author

Built as a learning project while exploring MCP and FastMCP.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A simple implementation of a Model Context Protocol server that demonstrates core functionality including mathematical tools (add, subtract) and personalized greeting resources.
      98
      GPL 3.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      A demonstration implementation of a Model Context Protocol server that provides simple mathematical tools (add, subtract) and personalized greeting resources.
      -
    • F
      license
      C
      quality
      D
      maintenance
      A demonstration MCP server that provides a simple addition tool for learning how to create and deploy servers following the Model-Context-Protocol specification. Serves as a basic example for developers getting started with MCP server development.
      1
      -