🚀 MCP (Microservice Control Protocol) Toolkit Based on gRPC
This project provides a set of practical tools based on the gRPC protocol for microservices and full - duplex communication.
🚀 Quick Start
This document introduces an MCP (Microservice Control Protocol) toolkit based on the gRPC protocol. The toolkit offers a set of utility tools for implementing microservices and full - duplex communication.
✨ Features
Tool List
The following are the available MCP tools:
- Calculator Tool
- Sleep Tool
- UUID Generation Tool
💻 Usage Examples
Calculator Tool
Function Description
The calculator tool allows users to perform numerical calculations using variables in expressions. Supported basic operations include addition, subtraction, multiplication, and division.
Basic Usage
# Run the calculator service locally
python calculator_server.py
# The client calls the calculator service for calculation
result = calculator_service.evaluate(expression="2 + 3", variables={})
print(f"Result: {result}")
Sleep Tool
Function Description
The sleep tool pauses the server's execution for a specified period.
Basic Usage
# Run the sleep service locally
python sleep_server.py
# The client calls the sleep service
response = sleep_service.sleep(time_value=5, time_unit="seconds")
print(response.message)
UUID Generation Tool
Function Description
This tool is used to generate a specified number and version of UUIDs (Universally Unique Identifiers). By default, it generates a random version 4 UUID.
Basic Usage
# Run the UUID generation service locally
python uuid_server.py
# The client calls the UUID generation service
uuids = uuid_service.generate_uuid(count=5, version="v4")
print(uuids)
📚 Documentation
Exception Handling
All tools throw corresponding exceptions when errors occur. For example:
- Calculator Tool: Throws a
ValueError
if the expression is invalid or the variables are incorrect. - Sleep Tool: Throws a
ValueError
if the time value is non - positive or the unit is invalid. - UUID Generation Tool: Throws a
ValueError
if the version is invalid or the namespace/name parameters are missing (for v3 and v5).
Please refer to the documentation of each tool for more detailed information.







