Skip to content

Commit 8b8049f

Browse files
Add SkillCatalog and FilesystemSkillProvider for serving skills from a provider
1 parent 2af9e30 commit 8b8049f

8 files changed

Lines changed: 1269 additions & 0 deletions

File tree

‎src/mcp/server/skills/__init__.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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

Comments
 (0)