MCP ExplorerExplorer

Mcp Example Golang

@bytesizego-comon a year ago
3 MIT
FreeCommunity
AI Systems
MCP Example Server in Go with tools for greetings and Bitcoin prices.

Overview

What is Mcp Example Golang

mcp-example-golang is an example implementation of a Model Context Protocol (MCP) server written in Go, designed for use with the Cursor IDE.

Use cases

Use cases include greeting users in a chat application, providing real-time Bitcoin price updates, and serving as a foundation for developing more complex MCP tools.

How to use

To use mcp-example-golang, build the server using ‘go build -o mcp-example’, then install it in Cursor by navigating to the MCP Tools section and adding it from the directory. Once installed, you can interact with the tools via chat prompts.

Key features

Key features include a simple ‘hello’ tool for personalized greetings, a ‘bitcoin_price’ tool that fetches real-time Bitcoin prices in various currencies, a test prompt, and a test resource.

Where to use

mcp-example-golang can be used in applications that require real-time data retrieval and interactive tools, particularly in financial technology, chatbots, and educational environments.

Content

MCP Example Server for Cursor

Learn more about how to use this here

This is an example implementation of a Model Context Protocol (MCP) server in Go for use with Cursor.

Features

  • Implements a simple “hello” tool that responds with a greeting
  • Provides a “bitcoin_price” tool that fetches real-time Bitcoin prices in various currencies
  • Includes a test prompt
  • Provides a test resource

Prerequisites

  • Go 1.24 or later
  • Cursor IDE
  • Internet connection (for the Bitcoin price API)

Building the Server

go build -o mcp-example

Installing in Cursor

  1. Build the server using the command above
  2. Open Cursor settings
  3. Navigate to the “MCP Tools” section
  4. Click “Add Tool”
  5. Select “From Directory”
  6. Browse to this directory and select it
  7. Click “Install”

Usage

Once installed, you can use the MCP tools in Cursor by:

  1. Opening a chat in Cursor
  2. The “hello” tool can be triggered with prompts like “Can you greet me with a personalized message?”
  3. The “bitcoin_price” tool can be triggered with prompts like “What’s the current Bitcoin price in USD?” or “Show me the Bitcoin price in EUR”

Development

If you want to modify this example:

  1. Edit the main.go file to add or modify tools, prompts, or resources
  2. Rebuild the server using go build -o mcp-example
  3. Restart Cursor to load the changes

Structure

  • main.go - The main server implementation
  • cursor-mcp-config.json - Configuration file for Cursor
  • go.mod and go.sum - Go module files

API Usage

The Bitcoin price tool uses the free CoinGecko API to fetch real-time cryptocurrency prices. No API key is required for basic usage, but there are rate limits.

License

MIT

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers