首页 时政热点 科技头条 智能AI 安全攻防 数码硬件 开发者生态 汽车 游戏 社会热点 开源推荐 医疗健康 归档 标签 关于

GitHub 热门项目:mcp-go

摘要

GitHub项目:mcp-go 仓库地址:https://github.com/mark3labs/mcp-go Stars:8993 | 作者:mark3labs 项目描述:A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications ...

mcp com mark3labs https github MCP the and server tool
2026-08-11 1 阅读 约7分钟阅读 GitHub Trending
分享:
字号:
GitHub 项目:mcp-go 仓库地址:https://github.com/mark3labs/mcp-go 星级:8993 | 作者:mark3labs 项目描述:模型上下文协议(MCP)的 Go 实现,实现 LLM 应用程序与外部数据源和工具之间的无缝集成。 =================================================== 自述文件内容: MCP Go 徽标 [![构建](https://github.com/mark3labs/mcp-go/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mark3labs/mcp-go/actions/workflows/ci.yml) [![Go 报告卡](https://goreportcard.com/badge/github.com/mark3labs/mcp-go?cache)](https://goreportcard.com/report/github.com/mark3labs/mcp-go) [![GoDoc](https://pkg.go.dev/badge/github.com/mark3labs/mcp-go.svg)](https://pkg.go.dev/github.com/mark3labs/mcp-go) [![AgentRank](https://agentrank-ai.com/api/badge/tool/mark3labs--mcp-go)](https://agentrank-ai.com/tool/mark3labs--mcp-go/) 模型上下文协议 (MCP) 的 Go 实现,可实现 LLM 应用程序与外部数据源和工具之间的无缝集成。
[![教程](http://img.youtube.com/vi/qoaeYMrXJH0/0.jpg)](http://www.youtube.com/watch?v=qoaeYMrXJH0 "教程")
在 [Discord](https://discord.gg/RqSS2NQVsY) 上讨论 SDK
``走吧 包主 导入( “上下文” “FMMT” “github.com/mark3labs/mcp-go/mcp” “github.com/mark3labs/mcp-go/server” ) 函数主() { // 创建一个新的MCP服务器 s := 服务器.NewMCPServer( “演示🚀”, “1.0.0”, 服务器.WithToolCapability(假), ) // 添加工具 工具 := mcp.NewTool("hello_world", mcp.WithDescription("向某人问好"), mcp.WithString("姓名", mcp.Required(), mcp.Description("要问候的人的名字"), ), ) // 添加工具处理程序 s.AddTool(工具, helloHandler) // 启动stdio服务器 if err := server.ServeStdio(s);错误!=零{ fmt.Printf("服务器错误: %v\n", err) } } func helloHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { 名称, err := request.RequireString("名称") 如果错误!= nil { 返回 mcp.NewToolResultError(err.Error()), nil } return mcp.NewToolResultText(fmt.Sprintf("你好,%s!", name)), nil } ```` 就是这样! MCP Go 处理所有复杂的协议细节和服务器管理,因此您可以专注于构建出色的工具。它的目标是高水平且易于使用。 ### 主要特点: * **快速**:高级接口意味着更少的代码和更快的开发 * **简单**:使用最少的样板构建 MCP 服务器 **完整***:MCP Go 旨在提供核心 MCP 规范的完整实现 (\*强调*目标*) 🚨 🚧 🏗️ *MCP Go 正在积极开发中,MCP 规范本身也是如此。核心功能正在运行,但一些高级功能仍在开发中。* ## 目录 - [安装](#安装) - [快速入门](#快速入门) - [什么是 MCP?](#what-is-mcp) - [核心概念](#core-concepts) - [服务器](#服务器) - [资源](#resources) - [工具](#tools) - [提示](#prompts) - [示例](#examples) - [额外](#额外) - [交通](#transports) - [OAuth 保护资源我
这篇文章对您有帮助吗?

订阅66必读

每日精选科技资讯,直达你的邮箱