Documentation
¶
Overview ¶
Package mcpskills serves Agent Skills over MCP (Skills extension, io.modelcontextprotocol/skills, on protocol 2026-07-28) from a server built on the official go-sdk, which does not support the extension yet. It also holds the format checks the mcp-tester uses to verify skills.
Every file of a skill directory becomes a skill://<skill-path>/<file> resource; skills/list and skills/get return complete manifests with SHA-256 digests; resources/directory/read lists directories.
caps := &mcp.ServerCapabilities{}
mcpskills.Declare(caps, true)
s := mcp.NewServer(impl, &mcp.ServerOptions{Capabilities: caps})
mcpskills.Serve(s, os.DirFS("skills"), nil)
Index ¶
- Constants
- func Declare(caps *mcp.ServerCapabilities, directoryRead bool)
- func Digest(data []byte) string
- func ParseFrontmatter(skillMD []byte) (map[string]any, error)
- func ValidDigest(d string) bool
- func ValidateFrontmatter(fm map[string]any) []string
- func ValidateName(name string) string
- type DirectoryResult
- type GetResult
- type ListParams
- type ListResult
- type Options
- type Skill
- type SkillResource
- type URIParams
Constants ¶
const ( MaxResources = 512 MaxTotalSize = 16 << 20 // 16 MiB )
Limits every conforming host supports (Skills extension, "Limits").
const DirectoryMIMEType = "inode/directory"
DirectoryMIMEType marks a directory resource.
const Extension = "io.modelcontextprotocol/skills"
Extension is the identifier of the Skills extension.
Variables ¶
This section is empty.
Functions ¶
func Declare ¶
func Declare(caps *mcp.ServerCapabilities, directoryRead bool)
Declare adds the extension (and the resources capability it requires) to the server capabilities. directoryRead announces resources/directory/read.
func ParseFrontmatter ¶
ParseFrontmatter returns the YAML frontmatter of a SKILL.md as a JSON-like map (the form the extension puts into a skill entry).
func ValidDigest ¶
ValidDigest reports whether d has the form sha256:{64 lowercase hex}.
func ValidateFrontmatter ¶
ValidateFrontmatter checks the fields the Agent Skills specification requires or constrains; it returns the problems found.
func ValidateName ¶
ValidateName returns why name violates the Agent Skills naming rules, or "".
Types ¶
type DirectoryResult ¶
type DirectoryResult struct {
mcp.ResultBase
ResultType string `json:"resultType"`
Resources []*mcp.Resource `json:"resources"`
NextCursor string `json:"nextCursor,omitempty"`
}
DirectoryResult is the result of resources/directory/read.
type GetResult ¶
type GetResult struct {
mcp.ResultBase
ResultType string `json:"resultType"`
Skill Skill `json:"skill"`
TTLMs int `json:"ttlMs"`
CacheScope string `json:"cacheScope"`
}
GetResult is the result of skills/get.
type ListParams ¶
type ListParams struct {
mcp.ParamsBase
Cursor string `json:"cursor,omitempty"`
}
ListParams are the params of skills/list.
type ListResult ¶
type ListResult struct {
mcp.ResultBase
ResultType string `json:"resultType"`
Skills []Skill `json:"skills"`
NextCursor string `json:"nextCursor,omitempty"`
TTLMs int `json:"ttlMs"`
CacheScope string `json:"cacheScope"`
}
ListResult is the result of skills/list.
type Options ¶
type Options struct {
// Scheme of the resource URIs; default "skill".
Scheme string
// TTLMs is the cache hint on skills/list and skills/get; default 300000.
TTLMs int
}
Options configure Serve.
type Skill ¶
type Skill struct {
URI string `json:"uri"`
Frontmatter map[string]any `json:"frontmatter"`
Resources []SkillResource `json:"resources"`
}
Skill is a skill entry as returned by skills/list and skills/get.
type SkillResource ¶
type SkillResource struct {
URI string `json:"uri"`
Digest string `json:"digest"`
Size int64 `json:"size"`
}
SkillResource is one file of a skill with its digest and size.