mcp-server-go

carlossantin/mcp-server-go

3.2

If you are the rightful owner of mcp-server-go and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This project is a demonstration of a Model Context Protocol (MCP) server implemented in Go, providing fictional temperature readings with a humorous twist.

Tools
  1. crazy_temperature

    Returns fictional temperature readings for Brazilian cities.

MCP Server Go Example

This is an example implementation of a Model Context Protocol (MCP) server written in Go. This project demonstrates how to build a simple MCP server with custom tools.

āš ļø Important Disclaimer

This is a demonstration project only! The temperature readings provided by this server are NOT REAL and are purely fictional for example purposes. Do not use this for actual weather information or any production use cases.

About This Project

This MCP server provides a "crazy temperature" tool that returns humorous, fictional temperature readings for various Brazilian cities. The responses are written in local Brazilian Portuguese dialects and are meant to showcase the MCP server functionality rather than provide real weather data.

Features

  • MCP Server: Built using the mcp-go library
  • Custom Tool: Implements a temperature tool with Brazilian humor
  • SSE Server: Provides Server-Sent Events endpoint for real-time communication
  • Recovery Middleware: Includes error recovery mechanisms

Project Structure

.
ā”œā”€ā”€ go.mod              # Go module dependencies
ā”œā”€ā”€ go.sum              # Go module checksums
ā”œā”€ā”€ LICENSE             # Project license
ā”œā”€ā”€ main.go             # Main server entry point
ā”œā”€ā”€ tools/
│   └── temperature.go  # Temperature tool implementation
└── README.md           # This file

Dependencies

  • Go 1.24.1 or later
  • mcp-go: MCP (Model Context Protocol) library for Go

Installation

  1. Clone the repository:

    git clone https://github.com/carlossantin/mcp-server-go.git
    cd mcp-server-go
    
  2. Install dependencies:

    go mod tidy
    

Usage

Running the Server

Start the MCP server:

go run main.go

The server will start on port 8080 with the following endpoints:

  • SSE Endpoint: http://localhost:8080/mcp/events
  • Message Endpoint: http://localhost:8080/mcp/message

Available Tools

crazy_temperature

Returns fictional temperature readings for Brazilian cities.

Parameters:

  • city (required): Name of the city

Supported Cities:

  • Porto Alegre / POA
  • Belo Horizonte / BH
  • SĆ£o Paulo / Sampa
  • Rio de Janeiro / Rio / RJ
  • Any other city (generic response)

Example Usage:

{
  "method": "tools/call",
  "params": {
    "name": "crazy_temperature",
    "arguments": {
      "city": "Porto Alegre"
    }
  }
}

Development

Building

go build -o mcp-server-go

Running Tests

go test ./...

MCP Integration

This server can be integrated with any MCP-compatible client. The server implements the Model Context Protocol specification and provides tools that can be discovered and used by AI assistants and other MCP clients.

License

See the file for details.

Contributing

This is an example project. Feel free to fork and modify it for your own learning purposes.

Acknowledgments

  • Built with mcp-go
  • Uses the Model Context Protocol specification

Remember: This is a demonstration project only. The temperature data is completely fictional and should not be used for any real-world applications!