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 6 months ago model-context-protocolmcpllmmcp-servergogolangaiopen-source
67Good

Scored 3 months 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. It has been installed 0 times through Conduid.

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

Install

Install
npx 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

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

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 mirrored from the source repository 3 months ago. The original is authoritative.

Questions

About Gomcp

How do I install Gomcp?

Run npx gomcp, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is Gomcp safe to use with an AI agent?

Its trust score is 67 out of 100 (good). It passes 0 of 1 static security checks; 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 6 months ago, with 0 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.