MCP ExplorerExplorer

Mcp Calculator Go

@omegaatt36on a year ago
1 MIT
FreeCommunity
AI Systems
A Go-based calculator implementing MCP for basic arithmetic operations.

Overview

What is Mcp Calculator Go

mcp-calculator-go is a simple calculator implemented in Go that adheres to the Model Context Protocol (MCP). It serves as a demonstration of how to build an MCP server using the mcp-go library.

Use cases

Use cases for mcp-calculator-go include integrating arithmetic functionalities into applications, serving as a backend service for calculation requests, and demonstrating the implementation of MCP servers.

How to use

To use mcp-calculator-go, first build the binary and configure it in your development environment. You can set it up in VS Code or Zed by specifying the command path and arguments in the respective configuration files.

Key features

Key features of mcp-calculator-go include basic arithmetic operations (addition, subtraction, multiplication, division), accurate decimal calculations using the github.com/shopspring/decimal library, a single ‘calculate’ tool with operation parameters, and the use of go-enum for generating enums.

Where to use

mcp-calculator-go can be used in software development environments where arithmetic calculations are required, particularly in applications that follow the Model Context Protocol.

Content

MCP Calculator Go

This is a simple calculator implemented in Go that conforms to the Model Context Protocol (MCP). It demonstrates how to build an MCP server using the mcp-go library.

Features

  • Performs basic arithmetic operations: addition, subtraction, multiplication, and division.
  • Uses github.com/shopspring/decimal for accurate decimal calculations.
  • Exposes a single calculate tool with operation, x, and y parameters.
  • Uses go-enum to generate enums and related helper methods.
  • Provides a Taskfile for convenient build and dependency management.

Building and Running

First you need to install the dependencies described in the task file.

go install github.com/abice/go-enum@latest
go generate ./...

or simply

task deps
task enum

To build the executable, run:

go build -o mcp-calculator-go

or

task build

How to use

  1. build mcp binary
  2. configure
  • VS Code and Client:
{
  "mcpServers": {
    "calculator-go": {
      "command": "/path/to/mcp-calculator-go",
      "args": [],
      "disabled": false,
      "autoApprove": []
    }
  }
}
  • Zed

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers