Cover image
Try Now
2025-04-14

Eine sicherheitsbewusste Implementierung des Modellkontextprotokolls

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

Model Context Protocol (MCP) - Go Implementation (WIP)

🚧 Work in Progress — This is an experimental implementation of the Model Context Protocol (MCP) in Go. It aims to provide a structured, extensible, and interoperable way to manage, stream, and persist model contexts across various AI/LLM runtimes.


🔍 Overview

The Model Context Protocol (MCP) defines a standard way to:

  • Represent contextual state for models (e.g. LLM session state, memory, scratchpads).
  • Serialize and deserialize context into a portable format (e.g. JSON, MessagePack, etc.).
  • Define and stream context updates (e.g. Add, Forget, Recall, Clear, Metadata, etc.).
  • Enable modular backends (file, memory, remote storage, event logs).

This Go library provides:

  • 🧠 Core context model types (Context, ContextUpdate, MemoryBlock, etc.)
  • 🔄 Encoders/decoders for standard formats (JSON, MsgPack planned)
  • ⚙️ Streaming support via Go channels and/or gRPC (WIP)
  • 💾 Storage backends (in-memory, file-based) — pluggable architecture
  • 🛠️ Utilities for merging, pruning, chunking, and diffing context

📦 Installation

Note: This package is not yet stable. API subject to change.

go get github.com/null-create/gomcp

✨ Quickstart

import (
    mcp "github.com/null-create/gomcp"
)

func main() {
    ctx := mcp.NewContext("session-123")

    ctx.AddMemoryBlock(mcp.MemoryBlock{
        Role:    "user",
        Content: "How do I build a Go server?",
    })

    serialized, _ := ctx.ToJSON()
    fmt.Println(string(serialized))
}

🧱 Core Concepts

Context

Represents a session or model runtime context. It may contain memory blocks, metadata, timestamps, etc.

MemoryBlock

The atomic unit of context — can represent messages, instructions, files, summaries, etc.

ContextUpdate

Represents a diff/change to a context. Useful for real-time or streaming updates.


🔧 Planned Features

  • Streaming context updates over gRPC/WebSocket
  • Context pruning and summarization
  • Pluggable backend support (SQLite, Redis, S3)
  • Context versioning and audit logs
  • Schema validation (JSON Schema / Protobuf)
  • Secure context signing + encryption

🧪 Project Status

This implementation is early-stage and under active development. Expect breaking changes as the protocol evolves.

Want to contribute or discuss ideas? Open an issue or start a discussion!


📂 Project Structure

/auth          # JWT implementations
/backend       # Storage plugins
/client        # MCP client implementation
/cmd           # CLI command implementations
/codec         # JSON/MsgPack (de)serialization
/context       # Context structure definitions
/docs          # Project documentation
/examples      # Example uses of the MCP API
/logger        # Logger module
/mcp           # MCP type and structure definitions
/server        # MCP server implemnentation
/transport     # Stdio transport
/validate      # Validation tool implementations

相关推荐

  • av
  • Führen Sie mühelos LLM -Backends, APIs, Frontends und Dienste mit einem Befehl aus.

  • 1Panel-dev
  • 🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • rulego
  • ⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.

  • sigoden
  • Erstellen Sie einfach LLM -Tools und -Argarten mit einfachen Bash/JavaScript/Python -Funktionen.

  • hkr04
  • Leichtes C ++ MCP (Modellkontextprotokoll) SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / diskord / telegram / slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Diffy 、 Claude 、 Gemini 、 xai 、 ppio 、 、 ulama 、 lm Studio 、阿里云百炼、火山方舟、 siliconflow 、 qwen 、 mondshot 、 chatglm 、 sillytraven 、 mcp 等 llm 的机器人 / agent | LLM-basierte Instant Messaging Bots-Plattform, unterstützt Zwietracht, Telegramm, Wechat, Lark, Dingtalk, QQ, Slack

  • dmayboroda
  • On-Premise-Konversationslappen mit konfigurierbaren Behältern

  • evilsocket
  • Das einfache Agentenentwicklungskit.

  • modelscope
  • Bauen Sie LLM-Multi-Agent-Anwendungen auf einfachere Weise auf.

    Reviews

    3.8 (4)
    Avatar
    user_PJAIMgXW
    2025-04-24

    Gomcp is an outstanding application by null-create that I highly recommend! I've been using it for a while now, and it has significantly improved my workflow. Its intuitive interface and robust features make it a must-have tool. Whether you’re a beginner or an experienced user, gomcp is sure to meet your needs efficiently. Don't miss out on this fantastic app!

    Avatar
    user_7Bc6qYtM
    2025-04-24

    I've been using gomcp for a while, and it's truly outstanding. Created by null-create, this application has streamlined my tasks efficiently. Its seamless integration and intuitive design make it a must-have tool for anyone looking to enhance productivity. Highly recommend!

    Avatar
    user_QTHFqZWz
    2025-04-24

    As a devoted user of gomcp, I cannot recommend it enough. Created by null-create, this application has truly transformed my workflow. Its intuitive interface and efficient performance make it a standout choice. Whether you're a beginner or an advanced user, gomcp caters to all. The seamless integration and robust capabilities have made my tasks easier and more enjoyable. Highly impressed!

    Avatar
    user_iN8GZQ7y
    2025-04-24

    I have been using gomcp for a while now and I absolutely love it! Created by null-create, this application truly enhances my productivity. The interface is user-friendly and the features are well-designed. It's a must-have for anyone looking to streamline their workflow. Highly recommend!