MI

metoro-io/mcp-golang

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

1.2천 stars 120 forks 품질 68 트렌드 23MIT

몇 줄의 go 코드로 모델 컨텍스트 프로토콜 서버를 작성할 수 있습니다. 문서는 https://mcpgolang.com에 있습니다. [[T1]에서 작성됨]

개요

mcp-golang은 Go에서 모델 컨텍스트 프로토콜(Model Context Protocol)의 비공식 구현체입니다. 몇 줄의 코드로 MCP 서버와 클라이언트를 Golang으로 작성하세요. - 🛡️ ** - 도구 인자를 네이티브 go 구조체로 정의하고, 나머지는 mcp-golang이 처리하세요. 자동 스키마 생성, 직렬 전환, 오류 처리 등. - 🚛 - 내장 전송 도구(stdio는 완전한 기능 지원, HTTP는 상태 없는 통신)를 사용하거나 직접 작성하세요. - ⚡ - MCP-golang은 도구, 프롬프트, 리소스를 제외한 모든 MCP 엔드포인트를 자동으로 생성합니다. - 🧩 - 라이브러리는 전송, 프로토콜, 서버/클라이언트 세 가지 구성 요소로 나뉩니다. 모두 사용하거나 필요한 것을 사용하세요. - 🔄 - stdio 전송을 통한 서버 및 클라이언트 구현 모두를 완전 지원합니다. Go Get github.com/metoro-io/mcp-golang 로 설치하세요 표준 HTTP 전송이나 Gin 프레임워크를 사용하여 HTTP 기반 서버를 만들 수도 있습니다: 참고: HTTP 전송은 상태 무상태이며 알림과 같은 양방향 기능을 지원하지 않습니다.

개요(AI 번역)

mcp-golang은 Go에서 모델 컨텍스트 프로토콜(Model Context Protocol)의 비공식 구현체입니다.

몇 줄의 코드로 MCP 서버와 클라이언트를 Golang으로 작성하세요.

https://mcpgolang.com 의 문서들

하이라이트

  • 🛡️ 타입 안전 - 도구 인자를 네이티브 go 구조체로 정의하고, 나머지는 mcp-golang이 처리하세요. 자동 스키마 생성, 직렬화 해제, 오류 처리 등.
  • 🚛 커스텀 전송 - 내장 전송(완전한 기능 지원은 stdio, 상태 없는 통신은 HTTP)을 사용하거나 직접 작성하세요.
  • ⚡ 저사양 보일러플레이트 - mcp-golang은 도구, 프롬프트, 리소스를 제외한 모든 MCP 엔드포인트를 생성해 줍니다.
  • 🧩 모듈러 - 라이브러리는 전송, 프로토콜, 서버/클라이언트의 세 가지 구성 요소로 나뉩니다. 모두 사용하거나 필요한 것을 가져가세요.
  • 🔄 양방향 - stdio 전송을 통한 서버 및 클라이언트 구현 모두에 대한 완전한 지원.

예시 사용

[[T1]로 설치

서버 예시

HTTP 서버 예시

표준 HTTP 전송이나 Gin 프레임워크를 사용하여 HTTP 기반 서버를 만들 수도 있습니다:

참고: HTTP 전송은 상태 무상태이며 알림과 같은 양방향 기능을 지원하지 않습니다.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

mcp-golang

mcp-golang is an unofficial implementation of the Model Context Protocol in Go.

Write MCP servers and clients in golang with a few lines of code.

Docs at https://mcpgolang.com

Highlights

  • 🛡️Type safety - Define your tool arguments as native go structs, have mcp-golang handle the rest. Automatic schema generation, deserialization, error handling etc.
  • 🚛 Custom transports - Use the built-in transports (stdio for full feature support, HTTP for stateless communication) or write your own.
  • ⚡ Low boilerplate - mcp-golang generates all the MCP endpoints for you apart from your tools, prompts and resources.
  • 🧩 Modular - The library is split into three components: transport, protocol and server/client. Use them all or take what you need.
  • 🔄 Bi-directional - Full support for both server and client implementations through stdio transport.

Example Usage

Install with go get github.com/metoro-io/mcp-golang

Server Example

package main

import (
	"fmt"
	"github.com/metoro-io/mcp-golang"
	"github.com/metoro-io/mcp-golang/transport/stdio"
)

// Tool arguments are just structs, annotated with jsonschema tags
// More at https://mcpgolang.com/tools#schema-generation
type Content struct {
	Title       string  `json:"title" jsonschema:"required,description=The title to submit"`
	Description *string `json:"description" jsonschema:"description=The description to submit"`
}
type MyFunctionsArguments struct {
	Submitter string  `json:"submitter" jsonschema:"required,description=The name of the thing calling this tool (openai, google, claude, etc)"`
	Content   Content `json:"content" jsonschema:"required,description=The content of the message"`
}

func main() {
	done := make(chan struct{})

	server := mcp_golang.NewServer(stdio.NewStdioServerTransport())
GitHub에서 전체 README 보기

설치

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

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "golang-mcp-server": { "command": "<your path to golang MCP server go executable>", "args": [], "env": {} } } }