1. Conduid
  2. Developer Tools
  3. Example Go MCP Server
MCP server · Developer Tools

Example Go MCP Server

Example implementation of a calculator MCP server in Golang

Unclaimed MIT last commit a year ago devtools
49Fair

Scored 5 months ago · breakdown

About Example Go MCP Server

Example Go MCP Server is an MCP server published by slashben in the Developer Tools category: example implementation of a calculator MCP server in Golang.

The repository has 1 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/slashben/example-go-mcp-server

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Example Go MCP Server

Powered by Claude · Grounded in docs

I know everything about Example Go MCP Server. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 7 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

Example Go MCP Server

A simple Model Context Protocol (MCP) server that provides basic mathematical operations. This project is based on the mark3labs MCP Go library and Kubescape MCP implementation pattern and demonstrates how to create custom MCP tools.

Features

The server exposes four mathematical operation tools:

  • add: Adds two numbers together
  • sub: Subtracts the second number from the first
  • mul: Multiplies two numbers together
  • div: Divides the first number by the second (with zero division protection)

Project Structure

example-go-mcp-server/
├── cmd/
│   ├── root.go          # Root command using Cobra
│   └── mcpserver.go     # MCP server command
├── internal/
│   └── mcpserver/
│       └── server.go    # Main MCP server implementation
├── main.go              # Application entry point
├── go.mod               # Go module file
└── README.md            # This file

Installation

  1. Clone the repository:
git clone <repository-url>
cd example-go-mcp-server
  1. Install dependencies:
go mod tidy
  1. Build the application:
go build -o example-go-mcp-server

Usage

Running the MCP Server

Start the MCP server:

./example-go-mcp-server mcpserver

Or run directly with Go:

go run main.go mcpserver

Available Tools

The server provides the following tools that can be called via MCP:

Addition (add)

  • Parameters:
    • a (required): First number to add
    • b (required): Second number to add
  • Example Response:
{
  "operation": "addition",
  "a": 5,
  "b": 3,
  "result": 8
}

Subtraction (sub)

  • Parameters:
    • a (required): Number to subtract from
    • b (required): Number to subtract
  • Example Response:
{
  "operation": "subtraction",
  "a": 10,
  "b": 4,
  "result": 6
}

Multiplication (mul)

  • Parameters:
    • a (required): First number to multiply
    • b (required): Second number to multiply
  • Example Response:
{
  "operation": "multiplication",
  "a": 6,
  "b": 7,
  "result": 42
}

Division (div)

  • Parameters:
    • a (required): Number to be divided (dividend)
    • b (required): Number to divide by (divisor)
  • Example Response:
{
  "operation": "division",
  "a": 15,
  "b": 3,
  "result": 5
}

Development

Adding New Tools

To add a new mathematical operation:

  1. Add a new tool definition in createMathTools() function
  2. Add a case in the CallTool() switch statement
  3. Implement the handler function (e.g., handlePow() for power operation)

Error Handling

The server includes comprehensive error handling:

  • Parameter validation
  • Type conversion safety
  • Division by zero protection
  • JSON marshaling error handling

Logging

The server logs all MCP tool inputs and responses to a single file in the temp directory:

  • Location: {temp_dir}/example-go-mcp-server/mcp_server.log
  • Format: JSON lines with timestamp, operation, input, output, and error information
  • Purpose: Debugging, monitoring, and audit trail
  • Append Mode: All new log entries are appended to the same file

Dependencies

  • github.com/mark3labs/mcp-go: MCP protocol implementation
  • github.com/spf13/cobra: CLI framework

License

This project is open source and available under the MIT License.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

References

This implementation is based on the Kubescape MCP server pattern:

README fetched from the repository 7 days ago. The original is authoritative.

Questions

About Example Go MCP Server

How do I install Example Go MCP Server?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Example Go MCP Server safe to use with an AI agent?

Its trust score is 49 out of 100 (fair). It passes 5 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Example Go MCP Server still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.