Zero dependencies. Single binary. Go-native.

Build AI tools
in Go

A zero-dependency MCP server framework that turns any Go program into an AI-accessible service. Tools, resources, and prompts over stdio. Compile, ship, connect.

greeter/main.go
package main

import (
    "context"
    "fmt"
    "github.com/BackendStack21/go-mcp/gomcp"
)

func main() {
    srv := gomcp.NewServer("greeter", "1.0.0")

    srv.AddTool(gomcp.Tool{
        Name:        "greet",
        Description: "Greet a person by name",
        InputSchema: gomcp.InputSchema{
            Type: "object",
            Properties: map[string]gomcp.Property{
                "name": {Type: "string"},
            },
        },
        Handler: func(ctx context.Context, args map[string]any) (string, error) {
            return fmt.Sprintf("Hello, %s!", args["name"]), nil
        },
    })

    srv.Run()  // blocks, reading JSON-RPC from stdin
}
0
dependencies
8
MCP methods
<1ms
cold start
~5MB
memory

Turn any Go program into an
AI-accessible service

Register tools, resources, and prompts. The AI client discovers them automatically. All over stdin/stdout.

Database Explorer

Wrap PostgreSQL or MySQL as read-only MCP tools. The AI explores schemas, runs queries, and analyzes data — safely.

System Monitor

Expose CPU, memory, and disk as resources. The AI checks system health, diagnoses issues, and monitors trends.

Kubernetes Operator

Wrap kubectl as MCP tools. The AI describes deployments, fetches logs, and diagnoses cluster issues — without cluster admin.

API Integration

Bridge any REST API to AI. Give agents access to GitHub, Stripe, Slack — any HTTP endpoint becomes a callable tool.

Filesystem Navigator

Give AI scoped file access. Read, list, and search files — with path traversal protection built in.

Anything with Go

Go's ecosystem is the limit. gRPC services, crypto operations, image processing — if you can write it in Go, the AI can call it.

Database Explorer

Give AI agents safe, read-only SQL access. Query the schema, list tables, run SELECT statements — all scoped and auditable. The AI sees your database without touching your credentials.

srv.AddTool(gomcp.Tool{
    Name:        "db_query",
    Description: "Run a read-only SQL query",
    InputSchema: gomcp.InputSchema{
        Type: "object",
        Properties: map[string]gomcp.Property{
            "query": {Type: "string"},
        },
    },
    Handler: func(ctx context.Context,
        args map[string]any) (string, error) {
        // Validate, execute, return formatted results
        return runQuery(ctx, args["query"].(string))
    },
})

System Resources

Expose any server data as MCP resources. CPU, memory, process info, disk usage — read on demand via resources/read. The AI monitors your infrastructure without SSH access.

srv.AddResource(gomcp.Resource{
    URI:      "system://cpu",
    Name:     "CPU Usage",
    MimeType: "application/json",
    Handler: func(ctx context.Context) (string, error) {
        info := map[string]any{
            "cores":   runtime.NumCPU(),
            "percent": getCPUPercent(),
        }
        data, _ := json.Marshal(info)
        return string(data), nil
    },
})

Three primitives. Infinite possibilities.

Tools for actions. Resources for data. Prompts for templates. Register them, the framework handles the rest.

Tools

Callable functions with typed input schemas. The AI discovers them via tools/list and invokes them via tools/call. Return text results the AI can reason about.

Resources

Readable data sources identified by URI. The AI lists them via resources/list and reads them via resources/read. MIME types included.

Prompts

Pre-defined conversation templates. The AI requests them by name with arguments via prompts/get. Returns formatted messages ready for the chat.

Full MCP coverage

All eight MCP methods implemented. Not a subset. Not a work-in-progress. Complete.

MethodDescriptionStatus
initializeMCP handshake — reports server name, version, capabilities
notifications/initializedClient ready notification — consumed silently
tools/listReturns metadata for all registered tools
tools/callDispatches a call to the matching tool handler
resources/listReturns metadata for all registered resources
resources/readReads a resource by URI
prompts/listReturns metadata for all registered prompts
prompts/getBuilds a prompt from arguments

One command. Zero dependencies.

Compiles to a single static binary. Ships in any container. Connects to any MCP client.

$ go get github.com/BackendStack21/go-mcp

15 tests. 4 example servers. View on GitHub →