MM

mikkihugo/mcp_toolkit_gleam

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

6 stars 3 forks 质量 46 趋势 18NOASSERTION

Production-ready Model Context Protocol (MCP) Toolkit implementation in Gleam with comprehensive transport support, bidirectional communication, and enterprise-grade features.

概览

Production-ready Model Context Protocol (MCP) Toolkit implementation in Gleam with comprehensive transport support, bidirectional communication, and enterprise-grade features. - : Standard input/output transport - : Real-time bidirectional communication on ws://localhost:8080/mcp - : Server-to-client streaming on http://localhost:8081/mcp - : Connect any two transports with filtering and transformation - : Implements MCP 2025-06-18 with backward compatibility - : Full test coverage with birdie snapshots and gleunit - : Strong typing throughout with comprehensive error handling - : Clean separation between core protocol and transport layers - : Comprehensive error handling and logging throughout - Bidirectional communication with server-initiated requests - Resource/tool/prompt change notifications - Request/response correlation with unique IDs - Client capability tracking and message routing - Comprehensive logging and error reporting - : For optimal performance and compatibility...

README

以下为原文 README 节选,完整内容请查看原文。

MCP Toolkit Gleam

Production-ready Model Context Protocol (MCP) Toolkit implementation in Gleam with comprehensive transport support, bidirectional communication, and enterprise-grade features.

🎯 Features

Multi-Transport Support

  • stdio: Standard input/output transport
  • WebSocket: Real-time bidirectional communication on ws://localhost:8080/mcp
  • Server-Sent Events (SSE): Server-to-client streaming on http://localhost:8081/mcp
  • Transport Bridging: Connect any two transports with filtering and transformation

Production-Ready Architecture

  • Latest MCP Specification: Implements MCP 2025-06-18 with backward compatibility
  • Comprehensive Testing: Full test coverage with birdie snapshots and gleunit
  • Type Safety: Strong typing throughout with comprehensive error handling
  • Modular Design: Clean separation between core protocol and transport layers
  • Production-Ready: Comprehensive error handling and logging throughout

Enterprise Features

  • Bidirectional communication with server-initiated requests
  • Resource/tool/prompt change notifications
  • Request/response correlation with unique IDs
  • Client capability tracking and message routing
  • Comprehensive logging and error reporting

🚀 Quick Start

Prerequisites

  • Erlang/OTP 28+: For optimal performance and compatibility
  • Gleam 1.11.1+: Latest Gleam compiler with modern language features
  • Git: For version control and dependency management

Installation

gleam deps download
gleam build

Usage Examples

# Lightweight stdio transport (dependency-free)
gleam run -m mcp_stdio_server

# Full server with WebSocket support
gleam run -m mcp_full_server websocket

# Full server with Server-Sent Events
gleam run -m mcp_full_server sse

# Transport bridging between different protocols
gleam run -m mcp_full_server bridge

# Comprehensive server with all transports
gleam run -m mcp_full_server full

📁 Project Structure

src/
├── mcp_stdio_server.gleam        # Lightweight stdio executable
├── mcp_full_server.gleam         # Comprehensive server executable  
└── mcp_toolkit_gleam/
    ├── core/                   # Core protocol implementation
    │   ├── protocol.gleam      # MCP protocol types and functions
    │   ├── server.gleam        # Server implementation
    │   ├── method.gleam        # MCP method constants
    │   └── json_schema*.gleam  # JSON schema handling
    ├── transport/              # Core transports
    │   └── stdio.gleam         # Standard I/O transport
    └── transport_optional/     # HTTP/WebSocket transports
        ├── websocket.gleam     # WebSocket transport
        ├── sse.gleam          # Server-Sent Events transport
        ├── bidirectional.gleam # Bidirectional communication
        └── bridge.gleam        # Transport bridging

test/
├── mcp_toolkit_gleam/
│   ├── core/                   # Core functionality tests
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →