DEV Community

Cover image for Expert Go Assistance with the go-docs MCP Server
Michael Amachree
Michael Amachree Subscriber

Posted on

Expert Go Assistance with the go-docs MCP Server

Go (Golang) is loved for its simplicity and performance. While the language itself is concise, the ecosystem of packages is vast. Navigating pkg.go.dev to find the right package or function is a daily task for Go developers.

Introducing go-docs, a Mastra-based MCP server designed to bring that documentation expert right into your chat with your AI assistant.

GitHub repo: https://github.com/Michael-Obele/go-docs

Features

go-docs isn't just a search tool; it's designed to provide expert assistance by grounding AI responses in real-time documentation.

  • Real-Time Access: Fetches the latest documentation from pkg.go.dev.
  • Package Discovery: Helps you find the standard library packages or third-party modules you need.
  • Code Examples: Retrieves idiomatic Go examples directly from the documentation to help you write better code.

How it works (high level)

When you ask a Go question in an MCP-enabled editor, the flow looks roughly like this:

  1. You ask a question ("How do I use http.NewRequestWithContext?")
  2. Your assistant calls the go-docs tool behind the scenes.
  3. go-docs pulls the relevant page(s) from pkg.go.dev.
  4. The assistant answers using that retrieved context (so it’s much less likely to make up symbols).

That grounding step is the key difference between "helpful" and "reliable" AI assistance.

Why MCP?

The Model Context Protocol (MCP) enables a standardized way for tools like go-docs to communicate with AI models. Instead of copy-pasting code snippets or documentation into your chat, the AI allows itself to "browse" the documentation as needed to answer your questions accurately.

Practically, MCP means you can treat documentation like a first-class dependency: queryable, sourceable, and available right where you're working.

Ideal for:

  • Learning Go: Get explanations of concepts with references to the official docs.
  • Debugging: Verify function signatures and return values instantly.
  • Exploring APIs: Quickly understand how to implement a new library.

Example prompts that work well

If you want consistently good results, give the assistant enough context to look up the right thing:

  • "Show me the signature and example usage for context.WithTimeout"
  • "What does http.Client{ Timeout: ... } actually time out?"
  • "In database/sql, what's the difference between QueryContext and ExecContext?"
  • "What's the idiomatic way to handle retries with backoff in Go? Link me to the relevant packages"

Try It Out

Add go-docs to your MCP configuration and experience a smoother Go development workflow. Whether you are a seasoned Gopher or just starting out, having immediate access to accurate documentation is a game-changer.

Quick setup (Mastra Cloud)

SSE endpoint (best for editors that keep a persistent connection):

https://go-docs.mastra.cloud/api/mcp/goDocsMcpServer/sse

Example config (npx + mcp-remote):

{
  "mcpServers": {
    "go-docs": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://go-docs.mastra.cloud/api/mcp/goDocsMcpServer/sse"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

HTTP endpoint (handy for one-off calls/scripts):

https://go-docs.mastra.cloud/api/mcp/goDocsMcpServer/mcp

SSE vs HTTP (which one should you use?)

  • SSE is best when your editor keeps a persistent connection open and you want the smoothest interactive experience.
  • HTTP is convenient when you’re experimenting, building scripts, or testing connectivity without a long-lived stream.

If this helped, consider starring the repo and sharing the post.

Top comments (0)