前言,mcp是一个新生的协议,和http,json一样没什么区别。推荐阅读一篇介绍和实操mcp协议的文章:https://www.cnblogs.com/BNTang/p/18815937#!comments
本文介绍阅读基于mcp协议的github sdk,借此对mcp协议产生更多的了解,阅读这个项目仅仅只是因为我对go语言和github比较熟悉而已。
仓库地址如图所示:
可以看到基于的版本和仓库的重要文件。
// Package server provides MCP (Model Control Protocol) server implementations.
package server
import (
"context"
"encoding/json"
"errors"
"fmt"
"sort"
"sync"
"github.com/mark3labs/mcp-go/mcp"
)
// resourceEntry holds both a resource and its handler
type resourceEntry struct {
resource mcp.Resource
handler ResourceHandlerFunc
}
// resourceTemplateEntry holds both a template and its handler
type resourceTemplateEntry struct {
template mcp.ResourceTemplate
handler ResourceTemplateHandlerFunc
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END










暂无评论内容