mcp-golang logo

mcp-golang

by metoro-io

mcp-golang is an unofficial implementation of the Model Context Protocol in Go, allowing you to write MCP servers and clients with minimal code. It provides type safety, custom transport options, and low boilerplate.

View on GitHub

Last updated: N/A

What is mcp-golang?

mcp-golang is a Go library that provides an implementation of the Model Context Protocol (MCP). It simplifies the creation of MCP servers and clients in Go, offering features like type-safe argument handling, custom transport options, and automatic schema generation.

How to use mcp-golang?

To use mcp-golang, install it with go get github.com/metoro-io/mcp-golang. You can then define your tool arguments as native Go structs with jsonschema tags. The library handles the generation of MCP endpoints, allowing you to focus on implementing your tools, prompts, and resources. Example server and client implementations are provided in the README.

Key features of mcp-golang

  • Type safety with native Go structs for arguments

  • Custom transport support (stdio, HTTP, Gin)

  • Low boilerplate code generation for MCP endpoints

  • Modular design for flexible usage

  • Bi-directional communication support via stdio transport

Use cases of mcp-golang

  • Building MCP servers for AI tools and services

  • Creating clients to interact with MCP-compliant servers

  • Integrating AI tools with applications using the Model Context Protocol

  • Developing custom transports for specific communication needs

FAQ from mcp-golang

What is the Model Context Protocol (MCP)?

The Model Context Protocol is a standard for communication between AI models and applications.

What transport options are supported?

mcp-golang supports stdio, HTTP, and Gin transports. Custom transports can also be implemented.

Does mcp-golang support bidirectional communication?

Yes, full bidirectional communication is supported through the stdio transport.

How do I define tool arguments?

Tool arguments are defined as native Go structs with jsonschema tags.

Where can I find more examples?

More extensive examples can be found in the examples/client directory and in the Metoro project.