Get the FREE Ultimate OpenClaw Setup Guide →

mcp-go

Build Model Context Protocol (MCP) servers in Go

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio riza-io-mcp-go /path/to/mcp-go-fs /path/to/root/directory

How to use

MCP Go provides a Go-based implementation of the Model Context Protocol, including a server you can expose as a resource provider and a client you can use to connect to MCP servers. The example in the repository demonstrates an MCP server that exposes the contents of an io.FS as MCP resources, allowing a client to list and read files via the MCP protocol. You can run the server with standard IO (stdio) or wire it to other transports as they become available. To connect from a client (for example Claude Desktop or another MCP-enabled frontend), start the server binary and point the client to the transport you’re using (stdio or a supported transport). The repository also provides a ready-made example server configuration you can adapt, such as exposing a filesystem path as resources. This makes it straightforward to prototype how resources, prompts, and tools would be surfaced to an LLM-backed interface.

How to install

Prerequisites:

  • Go installed (Go 1.18+ recommended)
  • Git (optional, for cloning the repository)

Installation steps:

  1. Clone the MCP Go repository (or download the source): git clone https://github.com/riza-io/mcp-go.git cd mcp-go

  2. Build the server binaries locally. From the repository root, run: go build ./...

    or build a specific example binary if present, e.g., ./examples/fs

  3. Run the server. For the filesystem example shown in the docs, you would start the binary produced for the FS server and supply a root directory: ./mcp-go-fs /path/to/root/directory

  4. If you plan to connect a client, ensure the client is configured to connect over the intended transport (stdio, SSE, etc.). Refer to the MCP client documentation for wiring the transport and the server endpoint.

Notes:

  • The repository shows an example configuration using an mcpServers entry named "fs". You can adapt the command and arguments to point to your built binary and desired root directory.
  • If you’re integrating into an existing workflow, you can automate startup with your preferred process manager or containerization tooling.

Additional notes

Tips and considerations:

  • The example in the README demonstrates exposing an io.FS as MCP resources (list and read operations). You can adapt this pattern to expose prompts, tools, or other resources as MCP endpoints.
  • Transport options mentioned include stdio and Server-Sent Events (SSE) in progression; check the repository for transport support status and any integration steps for your client.
  • The project is MIT-licensed; ensure you comply with licensing when embedding or distributing the server.
  • If you run into path or permission issues when mounting a filesystem, verify the binary has the appropriate permissions to read the target directory.
  • The provided JSON configuration snippet shows how to wire a filesystem-based MCP server in a multi-server setup; you can expand the mcpServers map to expose additional resources or tools as needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers