mcp-server-go-ts

ronkrasn/mcp-server-go-ts

3.1

If you are the rightful owner of mcp-server-go-ts and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This project demonstrates a Model Context Protocol (MCP) server and client implementation with sampling capabilities using HTTP transport.

Tools
2
Resources
0
Prompts
0

MCP Server Implementations with Sampling Support

This repository contains two complete Model Context Protocol (MCP) implementations with sampling capabilities:

  1. Go Implementation - Using third-party mcp-go library with SSE transport
  2. TypeScript Implementation - Using official Anthropic SDK with stdio/HTTP transport

Project Structure

├── README.md                 # This file - overview of both implementations
├── go.mod                    # Go module dependencies
├── server.go                 # Go MCP server implementation
├── client.go                 # Go MCP client implementation
└── typescript-mcp/          # TypeScript implementation directory
    ├── README.md             # TypeScript-specific documentation
    ├── package.json          # Node.js dependencies
    ├── src/                  # TypeScript source files
    ├── dist/                 # Compiled JavaScript
    └── *.js                  # Demo and test files

Quick Start

Go Implementation

# Terminal 1 - Start Go server
go run server.go

# Terminal 2 - Run Go client
go run client.go

TypeScript Implementation

# Navigate to TypeScript directory
cd typescript-mcp

# Install dependencies
npm install

# Build TypeScript files
npm run build

# Run local MCP server/client
node dist/simple-test.js

# OR run remote MCP server
node dist/remote-server.js

Implementation Comparison

FeatureGo ImplementationTypeScript Implementation
TransportSSE/HTTPstdio/HTTP
SDKThird-party mcp-goOfficial Anthropic SDK
Sampling Status❌ Session registration issues✅ Working reliably
Setup ComplexityHigh (manual SSE endpoints)Low (automatic transport)
DocumentationLimitedComprehensive
MaintenanceCommunity-drivenOfficially supported

Go Implementation Status

✅ Working:

  • SSE server/client connection
  • Basic tool execution (echo)
  • MCP protocol initialization
  • Capability negotiation

❌ Issues:

  • Session sampling registration fails
  • Complex SSE setup required
  • Limited community support for sampling

TypeScript Implementation Status

✅ Fully Working:

  • Complete MCP server/client with sampling
  • Both local (stdio) and remote (HTTP) transports
  • Official SDK with proven sampling patterns
  • Comprehensive documentation and examples

Available Tools

Both implementations provide:

  • echo: Simple echo tool for testing basic connectivity
  • ask_llm: Demonstrates sampling by asking mock LLM questions
  • remote_info (TypeScript only): Returns server information for remote connections

Recommendations

For New Projects

Use the TypeScript implementation - it provides:

  • Official Anthropic support
  • Working sampling out of the box
  • Better documentation
  • More examples and community resources

For Go Projects

The Go implementation is useful for:

  • Learning MCP protocol internals
  • Understanding SSE transport challenges
  • Contributing to community Go libraries

Further Documentation

  • TypeScript Implementation: See typescript-mcp/README.md for detailed TypeScript documentation
  • Remote MCP Setup: Check typescript-mcp/CLAUDE-DESKTOP-SETUP.md for Claude Desktop integration
  • Sampling Details: Review typescript-mcp/SAMPLING-EXPLAINED.md for sampling concepts