mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-11-29 22:41:26 +01:00
144 lines
5.8 KiB
Text
144 lines
5.8 KiB
Text
---
|
|
title: provider
|
|
sidebarTitle: provider
|
|
---
|
|
|
|
# `fastmcp.skills.provider`
|
|
|
|
|
|
Providers that serve `Skill` objects defined in code, loaded from folders, or from any source.
|
|
|
|
## Classes
|
|
|
|
### `SkillManifestProvider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L46" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Serve skills from their manifests, and read each file only when a client reads it.
|
|
|
|
Discovery needs only each skill's frontmatter and the digest and size of its
|
|
files. A provider whose files live in object storage or a database can
|
|
advertise every skill without loading any file, and fetch one file when a
|
|
client reads it.
|
|
|
|
Subclass and override `load_manifests()` and `read_file()`.
|
|
`load_manifests()` is called once per MCP request.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `required_extensions` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L79" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
required_extensions(self) -> Sequence[ServerExtension]
|
|
```
|
|
|
|
#### `load_manifests` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L84" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
load_manifests(self) -> Mapping[str, SkillManifest]
|
|
```
|
|
|
|
Return the skills to serve, keyed by the path each is served under.
|
|
|
|
|
|
#### `read_file` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L88" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
read_file(self, resource: SkillFileResource) -> bytes
|
|
```
|
|
|
|
Return the content of the skill file that a client reads.
|
|
|
|
|
|
### `SkillFileResource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
One file of a skill, read from its provider when a client reads it.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `read` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L192" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
read(self) -> ResourceResult
|
|
```
|
|
|
|
### `SkillManifestResource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L201" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
The `_manifest` file listing `Client.read_skill` uses without the Skills extension.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `read` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L206" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
read(self) -> str
|
|
```
|
|
|
|
### `SkillCatalogProvider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L216" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Serve `Skill` objects as MCP resources and Skills extension entries.
|
|
|
|
Each skill's files are served under `skill://{path}/`, where `path` defaults
|
|
to the skill's name. Pass a mapping to choose paths; the last path segment
|
|
must equal the skill's name. Every client can read the files as resources,
|
|
and the provider registers `SkillsExtension` so discovery clients can use
|
|
`skills/list` and `skills/get`.
|
|
|
|
For skills that change at runtime, such as rows in a database, subclass and
|
|
override `load_skills()`. It is called once per MCP request.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `load_skills` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L250" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
load_skills(self) -> SkillCatalog
|
|
```
|
|
|
|
Return the skills to serve. Override to load them from another source.
|
|
|
|
|
|
#### `load_manifests` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L254" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
load_manifests(self) -> Mapping[str, SkillManifest]
|
|
```
|
|
|
|
#### `read_file` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L259" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
read_file(self, resource: SkillFileResource) -> bytes
|
|
```
|
|
|
|
### `SkillsDirectoryProvider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L275" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
Serve every skill folder found below one or more root directories.
|
|
|
|
A folder containing a `SKILL.md` is a skill, served at its path relative to
|
|
the root, so `root/ops/deploy/SKILL.md` becomes `skill://ops/deploy/SKILL.md`.
|
|
Each `SKILL.md` must follow the [Agent Skills spec](https://agentskills.io/specification):
|
|
YAML frontmatter with a `description` and a `name` of lowercase letters,
|
|
digits and hyphens that matches its folder. An invalid folder raises
|
|
`ValueError` naming the fix, so a server never starts with skills missing.
|
|
Hidden folders are skipped. When a path appears under more than one root,
|
|
the first root wins.
|
|
|
|
Skills are read once, at construction. Pass `reload=True` to re-read the
|
|
folders on every request while you're editing them; if a re-read finds an
|
|
invalid folder, the error is logged and the last valid skills keep serving.
|
|
|
|
|
|
**Methods:**
|
|
|
|
#### `load_skills` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/skills/provider.py#L317" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
load_skills(self) -> SkillCatalog
|
|
```
|