MCP ExplorerExplorer

Mcp Demo Golang

@guobinqiuon a month ago
0 MIT
FreeCommunity
AI Systems
用golang开发mcp

Overview

What is Mcp Demo Golang

MCP Demo Golang is a demonstration project built in Go (Golang) that showcases various functionalities and integrations around tool interactions and protocols. It allows users to query IP location, perform calculations, and generate responses using language models (LLMs). The project serves as a practical example of how to implement and use different transport methods in Go applications.

Use cases

MCP Demo Golang has multiple use cases including IP location querying, basic arithmetic calculations, and enhanced responses through LLMs. It can be utilized by developers interested in learning how to work with microservice architectures, server-client communication, and HTTP or SSE protocols, or those wanting to integrate language models into their applications for more advanced functionality.

How to use

To use MCP Demo Golang, navigate to the project directory and compile the desired tool using the provided Go build commands. Then, run the corresponding client applications to interact with the server. Different tools are available including stdio, http, and sse methods, allowing users to see real-time responses or query processing based on their preferences.

Key features

Key features of MCP Demo Golang include support for multiple transport methods (stdio, http, sse), the ability to implement and demonstrate various protocols, and built-in functionality for querying IP locations and performing calculations. It also offers LLM integration for enhanced user interaction. The structure of the project supports easy extensibility and modification.

Where to use

MCP Demo Golang can be used in educational settings to teach developers the fundamentals of building and interacting with services in Go. It is also applicable in real-world applications for building microservices, enhancing web applications with geographic data, or embedding LLM capabilities into software solutions that require decision-making or interactive responses.

Content

MCP Demo Golang [第二课]

协议类型

  • Tools
  • Prompts
  • Resources

传输方式

  • stdio
  • http
  • sse

Tools

每个Tool可以作为一个独立的MCP Server,但也可以在一个MCP Server中包含多个Tool,每个Tool对应一个API

stdio

ip_location_query

cd mcp-demo-golang
go build -o bin/ip-location-server tools/stdio/ip_location_query/server/main.go
go run tools/stdio/ip_location_query/client/main.go

ip_location_query with LLM

cd mcp-demo-golang
go build -o bin/ip-location-server tools/stdio/ip_location_query/server/main.go
go run tools/stdio/ip_location_query/llm-client/main.go

calculator

cd mcp-demo-golang
go build -o bin/calculator-server tools/stdio/calculator/server/main.go
go run tools/stdio/calculator/client/main.go

calculator with LLM

cd mcp-demo-golang
go build -o bin/calculator-server tools/stdio/calculator/server/main.go
go run tools/stdio/calculator/llm-client/main.go

http

cd mcp-demo-golang
go run tools/http/ip_location_query/server/main.go
go run tools/http/ip_location_query/client/main.go (in another terminal)

sse

cd mcp-demo-golang
go run tools/sse/ip_location_query/server/main.go
go run tools/sse/ip_location_query/client/main.go (in another terminal)

Prompts

cd mcp-demo-golang
go build -o bin/ip-location-server prompts/stdio/ip_location_query/server/main.go
go run prompts/stdio/ip_location_query/client/main.go

Resources

cd mcp-demo-golang
go build -o bin/docs-server resources/stdio/docs/server/main.go
go run resources/stdio/docs/client/main.go

上一课
下一课

Python版

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers