|
| 1 | +"""The Skills extension (`io.modelcontextprotocol/skills`, SEP-2640). |
| 2 | +
|
| 3 | +SEP-2640 defines a convention for serving Agent Skills over MCP using the |
| 4 | +Resources primitive: a skill is a directory of files, conventionally exposed |
| 5 | +under the `skill://` scheme, and enumerated and fetched through two required |
| 6 | +methods (`skills/list`, `skills/get`) plus one optional one |
| 7 | +(`resources/directory/read`). See |
| 8 | +https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2640. |
| 9 | +
|
| 10 | +`Skills` is the protocol-level plumbing: request/response handling, SEP-2640 |
| 11 | +conformance validation, and capability advertisement. A server author supplies |
| 12 | +handlers that answer `skills/list`/`skills/get`/`resources/directory/read` |
| 13 | +however their catalog is stored, and serves the underlying `skill://` file |
| 14 | +content through the server's ordinary resource-registration APIs. |
| 15 | +
|
| 16 | + async def list_skills(ctx, params): |
| 17 | + return ListSkillsResult(skills=[...]) |
| 18 | +
|
| 19 | + async def get_skill(ctx, params): |
| 20 | + if params.uri != "skill://git-workflow/SKILL.md": |
| 21 | + raise MCPError(code=INVALID_PARAMS, message="unknown skill") |
| 22 | + return GetSkillResult(skill=...) |
| 23 | +
|
| 24 | + mcp = MCPServer("catalog", extensions=[Skills(list_skills=list_skills, get_skill=get_skill)]) |
| 25 | +""" |
| 26 | + |
| 27 | +from mcp.server.skills._extension import Skills |
| 28 | +from mcp.server.skills.catalog import SkillCatalog |
| 29 | +from mcp.server.skills.filesystem import FilesystemSkillProvider |
| 30 | +from mcp.server.skills.provider import SkillProvider |
| 31 | + |
| 32 | +__all__ = ["Skills", "SkillCatalog", "SkillProvider", "FilesystemSkillProvider"] |
0 commit comments