Skip to main content

A simple FastMCP project with basic math tools

Project description

FastMCP - Simple Math Tools

A simple Model Context Protocol (MCP) server that provides basic mathematical operations as tools.

Features

  • add: Add two numbers together
  • minus: Subtract the second number from the first number

Installation

This project uses uv for package management and just for task running. Make sure you have both installed:

# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install just if you don't have it
# On macOS with Homebrew:
brew install just
# Or with cargo:
cargo install just

Then build the project:

just build

Usage

Running the MCP Server

To start the FastMCP server:

just run

Using with MCP Clients

You can use this server with any MCP-compatible client. Here's an example configuration for mcp_config.json:

{
  "mcpServers": {
    "fastmcp": {
      "command": "uv",
      "args": ["run", "fastmcp"],
      "cwd": "/path/to/mcp-agents"
    }
  }
}

Testing the Tools

Run the test script to verify the tools work correctly:

just test

Available Tools

add

Adds two numbers together.

Parameters:

  • a (number): First number
  • b (number): Second number

Example:

{
  "name": "add",
  "arguments": {
    "a": 10,
    "b": 5
  }
}

minus

Subtracts the second number from the first number.

Parameters:

  • a (number): Number to subtract from
  • b (number): Number to subtract

Example:

{
  "name": "minus",
  "arguments": {
    "a": 10,
    "b": 3
  }
}

Development

Available Just Commands

  • just build - Install dependencies and sync the project
  • just run - Start the FastMCP server
  • just test - Run the test script
  • just format - Format code with black and isort
  • just typecheck - Run type checking with mypy
  • just dev - Install development dependencies
  • just dist - Build distribution packages
  • just clean - Clean build artifacts
  • just publish - Publish to PyPI (used in CI)

Project Structure

mcp-agents/
├── src/
│   └── fastmcp/
│       └── __init__.py          # Main MCP server implementation
├── pyproject.toml               # Project configuration and dependencies
├── justfile                     # Task runner configuration
├── mcp_config.json             # MCP client configuration example
├── test_tools.py               # Simple test script
└── README.md                   # This file

Adding New Tools

To add new tools:

  1. Add the tool definition to the handle_list_tools() function
  2. Add the tool implementation to the handle_call_tool() function
  3. Update the README with documentation for the new tool

Running Tests

just test

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amajakai14_mcp_agents-0.1.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amajakai14_mcp_agents-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file amajakai14_mcp_agents-0.1.0.tar.gz.

File metadata

File hashes

Hashes for amajakai14_mcp_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 24f01657108ce0f7b5ecec0425836faf4e13cbea06f3e5e6d23e4087b67902a6
MD5 26f531da35b8a96a36de91b381d5dce2
BLAKE2b-256 98852dce3f2efabcb64aac1b57c1be4f2075dff43bb48770ea1c84ee38d231e6

See more details on using hashes here.

File details

Details for the file amajakai14_mcp_agents-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for amajakai14_mcp_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f381a4ebc7446dda0e1fd0233b44fcd3819ab2a1dadd3c336c471976308fb2a
MD5 ad91abff06f5bcc0e0cb6bb45f4492b1
BLAKE2b-256 458e17dfff300772cc487daf4fef1506b8a97f1e36dcfcef91dd4b5f6b8d9bd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page