1. Conduid
  2. AI
  3. Gomcp
MCP server · AI

Gomcp

gomcp is a Go MCP server library for building applications that implement the Model Context Protocol (MCP). It provides a clean way to register tools and expose them via HTTP, SSE, or stdio, simplifying MCP server development in Go with JSON Schema support for arguments and results.

Unclaimed MIT last commit 7 months ago model-context-protocolmcpllmmcp-servergogolangaiopen-source
67Good

Scored 14 hours ago · breakdown

About Gomcp

Gomcp is an MCP server published by raykavin in the AI category: gomcp is a Go MCP server library for building applications that implement the Model Context Protocol (MCP). It provides a clean way to register tools and expose them via HTTP, SSE, or stdio, simplifying MCP server development in Go with JSON Schema support for arguments and results.

The repository has 2 stars and 0 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/raykavin/gomcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Gomcp

Powered by Claude · Grounded in docs

I know everything about Gomcp. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 14 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v0.0.1v0.0.1 · 5 Mar 2026Overview `v0.0.1` is the first public release of gomcp, a Go library for building Model Context Protocol (MCP) servers on top of `mcp-go`. Highlights Introduced the core `MCPServer` package for creating and running MCP servers. Added…

README

gomcp

Go Reference Go Version Go Report Card License

A clean Go library for building Model Context Protocol (MCP) servers on top of mcp-go.

Features

  • Three ways to register tools: inline struct, function helper, or JSON file on disk
  • Built-in argument extraction helpers (ArgString, ArgFloat, ArgBool, …)
  • Result builders (ResultText, ResultJSON, ResultError, …)
  • Both SSE (HTTP) and Stdio transports — pick at runtime

Installation

go get github.com/raykavin/gomcp

Quick start

package main

import (
	"context"

	mcpserver "github.com/raykavin/gomcp/server"
)

func main() {

	srv := mcpserver.NewMCPServer("my-agent", "1.0.0")

	// Register a tool
	srv.AddToolFunc(
		"echo",
		"Returns the input message",
		mcpserver.JSONSchema{
			Type: "object",
			Required: []string{"message"},
			Properties: map[string]mcpserver.JSONSchemaProperty{
				"message": {Type: "string", Description: "Message to echo"},
			},
		},
		func(ctx context.Context, req mcpproto.CallToolRequest) (*mcpproto.CallToolResult, error) {
			msg, errResult := mcpserver.ArgStringRequired(req, "message")
			if errResult != nil {
				return errResult, nil
			}
			return mcpserver.ResultText("echo: " + msg), nil
		},
	)

	// Start SSE transport
	srv.Start(ctx, ":8080")
}


Tool registration methods

1. AddToolFunc: inline, all fields explicit

Best for tools defined entirely in Go code.

err := srv.AddToolFunc(
    "search",                   // name
    "Search the web",           // description
    mcpserver.JSONSchema{...},  // schema
    myHandler,
)

2. AddTool: using a ToolDefinition struct

Useful when building definitions programmatically or receiving them from external sources.

def := mcpserver.ToolDefinition{
    Name:        "add",
    Description: "Adds two numbers",
    Schema:      mcpserver.JSONSchema{...},
}
err := srv.AddTool(def, myHandler)

3. AddToolFromFile: load from a JSON file on disk

Keeps tool metadata outside Go code. Ideal for config-driven agents or tools shared across projects.

err := srv.AddToolFromFile("tools/search.json", myHandler)

JSON file format:

{
  "name": "search",
  "description": "Search the web and return relevant results",
  "schema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "The search query" },
      "max_results": { "type": "number", "description": "Max results" }
    },
    "required": ["query"]
  }
}

4. AddToolFromJSON: load from raw []byte

For tools fetched from a database, remote config, etc.

data := []byte(`{...}`)
err := srv.AddToolFromJSON(data, myHandler)

Argument helpers

Inside a handler, use the helpers to safely extract typed arguments:

// String (returns error result if missing)
msg, errResult := mcpserver.ArgStringRequired(req, "message")
if errResult != nil {
    return errResult, nil
}

// Optional string
if q, ok := mcpserver.ArgString(req, "query"); ok { ... }

// Number
if n, ok := mcpserver.ArgFloat(req, "count"); ok { ... }

// Bool
if verbose, ok := mcpserver.ArgBool(req, "verbose"); ok { ... }

Result helpers

mcpserver.ResultText("plain string response")
mcpserver.ResultJSON(map[string]any{"key": "value"})
mcpserver.ResultError("something broke", err)
mcpserver.ResultErrorMsg("missing argument: query")

Transports

SSE (HTTP): default

ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
defer stop()

if err := srv.Start(ctx, ":8080"); err != nil {
    log.Fatal(err)
}

Clients connect via http://localhost:8080/sse.

Stdio: For Claude Desktop and local agents

if err := srv.StartStdio(ctx); err != nil {
    log.Fatal(err)
}

Graceful shutdown (SSE only)

srv.Shutdown(ctx)

Project structure

github.com/raykavin/gomcp/
├── server.go     # MCPServer, Start, StartStdio, Shutdown
├── tool.go       # ToolDefinition, JSONSchema, ParseToolDefinition
├── helpers.go    # ResultText/JSON/Error, ArgString/Float/Bool helpers
├── go.mod
└── example/
    ├── main.go
    └── tools/
        └── search.json

Tests

go test ./server

Contributing

Contributions to gomcp are welcome! Here are some ways you can help improve the project:

  • Report bugs and suggest features by opening issues on GitHub
  • Submit pull requests with bug fixes or new features
  • Improve documentation to help other users and developers
  • Share your custom strategies with the community

License

gomcp is distributed under the MIT License.
For complete license terms and conditions, see the LICENSE file in the repository.


Contact

For support, collaboration, or questions about gomcp:

Email: raykavin.meireles@gmail.com
GitHub: @raykavin

README fetched from the repository 14 hours ago. The original is authoritative.

Questions

About Gomcp

How do I install Gomcp?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Gomcp safe to use with an AI agent?

Its trust score is 67 out of 100 (good). It passes 5 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Gomcp still maintained?

The last commit was 7 months ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.