smafjal/basic-mcp-example
If you are the rightful owner of basic-mcp-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project demonstrates a simple implementation of a Model Context Protocol (MCP) server using the `fastmcp` library, providing basic arithmetic operations.
Basic MCP Example
Project Description
This project demonstrates a simple implementation of a Model Context Protocol (MCP) server using the fastmcp
library. It provides basic arithmetic operations such as addition, subtraction, multiplication, and division through an MCP server.
Features
- MCP Server: Hosts tools for arithmetic operations.
- HTTP Client: Interacts with the MCP server to perform operations.
- CLI Client: Command-line interface for performing operations.
Installation
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd basic-mcp-example
- Install dependencies:
pip install -r requirements.txt
Usage
Running the MCP Server
Start the MCP server:
python app/server.py
Using the HTTP Client
Run the HTTP client to perform operations:
python app/clients/http_client.py
Using the CLI Client
Use the CLI client to perform operations:
python app/clients/cli.py <tool> <a> <b>
Replace <tool>
with one of add
, subtract
, multiply
, or divide
, and <a>
and <b>
with numbers.
Example:
python app/clients/cli.py add 10 5
Dependencies
- Python >= 3.12
fastmcp
>= 2.10.6