1. Conduid
  2. Developer Tools
  3. Mcp4go
MCP server · Developer Tools

Mcp4go

A comprehensive Go SDK for the Model Context Protocol (MCP) - simplifying AI application development by abstracting away protocol complexities.

57Fair

Scored 12 hours ago · breakdown

About Mcp4go

Mcp4go is an MCP server published by mcp4go in the Developer Tools category: a comprehensive Go SDK for the Model Context Protocol (MCP) - simplifying AI application development by abstracting away protocol complexities.

The repository has 5 stars and 2 forks, with the last commit a year 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/mcp4go/mcp4go

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 Mcp4go

Powered by Claude · Grounded in docs

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

Security checks

Static checks derived from the repository 12 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.1.4v0.1.4 · 31 May 2025What's Changed fix(all): fix some bug by @Ccheers in https://github.com/mcp4go/mcp4go/pull/30 fix(transport): add \n in every write by @Ccheers in https://github.com/mcp4go/mcp4go/pull/31 Full Changelog:…
v0.1.3v0.1.3 · 24 May 2025What's Changed feat(schema): mark properties required by @Ccheers in https://github.com/mcp4go/mcp4go/pull/29 Full Changelog: https://github.com/mcp4go/mcp4go/compare/v0.1.2...v0.1.3
v0.1.2v0.1.2 · 18 Apr 2025What's Changed feat(handlers): add request decode function by @Ccheers in https://github.com/mcp4go/mcp4go/pull/28 Full Changelog: https://github.com/mcp4go/mcp4go/compare/v0.1.1...v0.1.2
v0.1.1v0.1.1 · 18 Apr 2025What's Changed feat(makefile): lint set to v1.64.6 by @Ccheers in https://github.com/mcp4go/mcp4go/pull/26 feat(router): add recovery func by @Ccheers in https://github.com/mcp4go/mcp4go/pull/27 Full Changelog:…
v0.1.0v0.1.0 · 12 Apr 2025What's Changed feat(example): add time example by @Ccheers in https://github.com/mcp4go/mcp4go/pull/21 feat(codecov): add codecov.yml by @Ccheers in https://github.com/mcp4go/mcp4go/pull/22 docs(README): update readme & conv chinese to…

README

MCP4Go

MCP4Go is a Go implementation of the Model Context Protocol (MCP), designed to simplify the development of AI applications by abstracting away protocol complexities.

Features

  • Complete MCP protocol implementation in pure Go
  • High-level abstractions for common MCP resources
  • Pluggable architecture for custom extensions
  • Comprehensive documentation and examples
  • Production-ready with robust error handling

Installation

MCP4Go requires Go 1.18 or later. Install it using Go modules:

go get github.com/mcp4go/mcp4go

Getting Started

To get started with MCP4Go, import the package in your Go application:

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"os/signal"
	"syscall"
	"time"

	"github.com/mcp4go/mcp4go/pkg/logger"
	"github.com/mcp4go/mcp4go/protocol"
	"github.com/mcp4go/mcp4go/server"
	"github.com/mcp4go/mcp4go/server/iface"
	"github.com/mcp4go/mcp4go/server/transport"

	_ "time/tzdata" // Load all time zones
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	_logger := logger.DefaultLog

	// Listen for interrupt signals for graceful exit
	signalCh := make(chan os.Signal, 1)
	signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM)
	go func() {
		<-signalCh
		_logger.Logf(ctx, logger.LevelWarn, "Received shutdown signal")
		cancel()
	}()

	type timeRequest struct {
		TimeZone string `json:"time_zone,omitempty" description:"time zone default is Asia/Shanghai"`
	}

	// Create standard input/output transport layer
	stdioTransport := transport.NewStdioTransport()
	// Create MCP server and configure options
	srv, cleanup, err := server.NewServer(
		stdioTransport,
		server.WithServerInfo(protocol.Implementation{
			Name:    "time-mcp",
			Version: "0.1.0",
		}),
		server.WithInstructions("Welcome to Time MCP! This server provides Time tools."),
		server.WithToolBuilder(iface.NewFunctionalToolsBuilder(
			iface.NewFunctionalToolWrapper(
				"time",
				"get current time",
				func(ctx context.Context, args timeRequest) ([]protocol.Content, error) {
					if args.TimeZone == "" {
						args.TimeZone = "Asia/Shanghai"
					}

					getTimezoneTime := func(_ context.Context, timeZone string) time.Time {
						if timeZone == "" {
							timeZone = "Asia/Shanghai"
						}
						loc, err := time.LoadLocation(timeZone)
						if err != nil {
							return time.Now()
						}
						return time.Now().In(loc)
					}

					currentTime := getTimezoneTime(ctx, args.TimeZone)

					return []protocol.Content{
						protocol.NewTextContent(fmt.Sprintf("current time is %s", currentTime), nil),
					}, nil
				}),
		)),
	)
	if err != nil {
		log.Printf("Failed to create server: %v\n", err)
		return
	}
	defer cleanup()

	// Start the server
	_logger.Logf(ctx, logger.LevelWarn, "Starting Time MCP server")
	if err := srv.Run(ctx); err != nil {
		_logger.Logf(ctx, logger.LevelError, "Server error: %v", err)
		return
	}

	_logger.Logf(ctx, logger.LevelWarn, "Server shutdown complete")
}

Protocol Implementation

MCP4Go provides a complete implementation of the Model Context Protocol with support for:

  • JSON-RPC communication
  • Resource lifecycle management
  • Prompt engineering
  • Tool definitions and invocations
  • Sampling parameters
  • Logging and diagnostics

License

This project is licensed under the MIT License

Contributing

Contributions are welcome! Please see our Contributing Guide for more information.

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

Questions

About Mcp4go

How do I install Mcp4go?

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

Is Mcp4go safe to use with an AI agent?

Its trust score is 57 out of 100 (fair). 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 Mcp4go still maintained?

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