使用说明
MCP Server
A Model Context Protocol (MCP) server that provides mathematical tools (add, subtract, multiply, divide) accessible via the streamable-http transport.
Overview
This MCP server exposes four mathematical operations as tools:
- add: Add two integers
- sub: Subtract two integers
- mul: Multiply two integers
- div: Divide two integers
The server runs on http://localhost:8000/mcp using the streamable-http transport protocol.
Prerequisites
- Python 3.13+
Installation
uv sync
Running
uv run main.py
The server will start on http://localhost:8000/mcp and wait for MCP client connections.
Architecture
- FastMCP: Simplified MCP server framework
- streamable-http: Transport protocol for server-client communication
- Tool Definitions: Four simple math operations exposed as MCP tools
API Endpoints
The server provides a streamable-http endpoint at:
http://localhost:8000/mcp
Tools
add(a: int, b: int) -> int
Returns the sum of two integers.
sub(a: int, b: int) -> int
Returns the difference of two integers (a - b).
mul(a: int, b: int) -> int
Returns the product of two integers.
div(a: int, b: int) -> float
Returns the quotient of two integers (a / b).
Dependencies
mcp: Model Context Protocol libraryfastmcp: Simplified MCP server framework
