- Explore MCP Servers
- mcpcalculator
Mcpcalculator
What is Mcpcalculator
mcpcalculator is a Go implementation of a Model Context Protocol (MCP) server that provides calculator and greeting functionalities, adhering to the official MCP specification.
Use cases
Use cases include building applications that need to perform arithmetic operations via a server, providing personalized greetings to users, and integrating with other systems that support JSON-RPC 2.0.
How to use
To use mcpcalculator, clone the repository, navigate to the project directory, and run the server using ‘go run main.go’. You can then make JSON-RPC 2.0 requests to the server for calculations or greetings.
Key features
Key features include full JSON-RPC 2.0 implementation, MCP protocol support, tool registration and execution, resource handling, server capability negotiation, and error handling according to the specification.
Where to use
mcpcalculator can be used in software applications that require a calculator service or greeting functionality, particularly in environments that utilize the Model Context Protocol for communication.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcpcalculator
mcpcalculator is a Go implementation of a Model Context Protocol (MCP) server that provides calculator and greeting functionalities, adhering to the official MCP specification.
Use cases
Use cases include building applications that need to perform arithmetic operations via a server, providing personalized greetings to users, and integrating with other systems that support JSON-RPC 2.0.
How to use
To use mcpcalculator, clone the repository, navigate to the project directory, and run the server using ‘go run main.go’. You can then make JSON-RPC 2.0 requests to the server for calculations or greetings.
Key features
Key features include full JSON-RPC 2.0 implementation, MCP protocol support, tool registration and execution, resource handling, server capability negotiation, and error handling according to the specification.
Where to use
mcpcalculator can be used in software applications that require a calculator service or greeting functionality, particularly in environments that utilize the Model Context Protocol for communication.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Calculator
A Go implementation of a Model Context Protocol (MCP) server with calculator and greeting functionality. This implementation follows the official MCP specification.
Features
- Full JSON-RPC 2.0 implementation
- MCP protocol support
- Tool registration and execution
- Resource handling
- Server capability negotiation
- Error handling according to spec
Project Structure
mcpcalculator/ ├── mcp/ │ └── protocol/ │ ├── types.go # Protocol types and structures │ ├── server.go # MCP server implementation │ └── client.go # MCP client implementation ├── main.go # Example usage ├── go.mod # Go module file └── README.md # Documentation
Requirements
- Go 1.21 or higher
Installation
git clone https://github.com/akhidasTech/mcpcalculator.git
cd mcpcalculator
go mod download
Usage
Starting the Server
go run main.go
The server will start on port 8080.
Making Requests
Tools and resources follow the JSON-RPC 2.0 specification:
Add Tool
curl -X POST http://localhost:8080 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "add",
"params": {"a": 5, "b": 3}
}'
Greeting Resource
curl -X POST http://localhost:8080 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "greeting",
"params": {"name": "John"}
}'
Response Format
All responses follow the JSON-RPC 2.0 format:
Or for errors:
Protocol Implementation
This implementation follows the Model Context Protocol specification:
- JSON-RPC 2.0: All communication uses the JSON-RPC 2.0 protocol
- Capabilities: Server advertises its capabilities during initialization
- Tools: Implements the tool registration and execution protocol
- Resources: Implements the resource access protocol
- Error Handling: Uses standard error codes and formats
Security
This implementation follows MCP security guidelines:
- User Consent: Tools and resources require explicit invocation
- Data Privacy: No data is shared without explicit requests
- Tool Safety: Tool execution is controlled and validated
- Error Handling: Proper error reporting and handling
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










