VM

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

5 stars 4 forks 品質 60 トレンド 26Apache-2.0

MCP is a Go implementation of the Model Context Protocol — a standardized way for applications to communicate with AI models.

概要

MCP is a Go implementation of the Model Context Protocol — a standardized way for applications to communicate with AI models.

README

以下は原文 README の抜粋です。原文を見る。

MCP (Model Context Protocol) for Go

MCP is a Go implementation of the Model Context Protocol — a standardized way for applications to communicate with AI models. It allows developers to seamlessly bridge applications and AI models using a lightweight, JSON-RPC–based protocol.

This repository provides the Go MCP client/server runtime, bridge, and auth helpers. Protocol definitions and schemas live in mcp-protocol.

Official Model Context Protocol Specification

Overview

MCP (Model Context Protocol) is designed to provide a standardized communication layer between applications and AI models. The protocol simplifies the integration of AI capabilities into applications by offering a consistent interface for resource access, prompt management, model interaction, and tool invocation.

Key features:

  • JSON-RPC 2.0–based communication
  • Support for multiple transport protocols (HTTP/SSE, stdio)
  • Server-side features:
    • Resource management
    • Model prompting and completion
    • Tool invocation
    • Subscriptions for resource updates
    • Logging
    • Progress reporting
    • Request cancellation
  • Client-side features:
    • Roots
    • Sampling
    • Elicitation

Architecture

For detailed guides on custom server implementations and authentication, see docs/implementer.md and docs/authentication.md.

MCP is built around the following components:

  1. Transport: JSON-RPC over HTTP/SSE, streamable HTTP, or stdio
  2. Server: Handles incoming requests and dispatches to the protocol implementation
  3. Client: Makes requests to MCP-compatible servers
  4. Protocol Implementation (server.Handler): Provides the actual functionality behind each protocol method

High-Level Architecture

graph LR
    Client[MCP Client] -->|JSON-RPC / HTTP/SSE| Server[MCP Server]
    Server -->|Dispatches to| Handler[MCP Server]
    subgraph Auth[Authentication / Authorization]
      OAuth2[OAuth2 / OIDC]
    end
    Client -.->|Bearer Token| OAuth2
    Server -.->|Token Validation| OAuth2

Getting Started

Installation

go get github.com/viant/mcp

If you just need to connect existing tools to a remote MCP server you might prefer to use the standalone Bridge binary instead of embedding the Go package. See Bridge Guide for details.

Creating a Server

Quick Start: Default Server

DefaultHandler can be used to quickly set up an MCP server. It provides no-op stubs for all methods, allowing you to focus on implementing only the methods you need. Register handlers inline without writing a custom server type:

package main

import (
  "context"
  "encoding/json"
  "fmt"
  "github.com/viant/jsonrpc"
  "github.com/viant/mcp-protocol/schema"
GitHub で README 全文を見る

インストール

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

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →