4.2.0
An agent skill is a set of instructions an agent can load when a task calls for it. The skillβs description tells the agent when to use it. Its entry file, SKILL.md, explains how to do the work and can refer to supporting files such as templates, scripts, and reference documents. Agent Skills specification
FastMCP lets an MCP server publish skills alongside its tools. For example, an issue tracker can expose a tool for assigning issues and a skill that explains how the team chooses an owner. A client can discover the skill from its description, read the procedure when a triage request comes in, and fetch the teamβs routing table only when it needs to assign an issue.
The server controls where those instructions come from. FastMCP represents a skill as a Python value. You can load one from a directory, ship one in a package, or build one from application data. A server can even publish different instructions at the same skill URI depending on who is asking.
Skill definitions
ASkill contains the files for one skill. When you construct it in Python, FastMCP renders the name and description as YAML frontmatter in SKILL.md and uses instructions as the Markdown body. For each supporting file, put its filename and contents in the files dictionary. Use that filename in the instructions so the agent can find it. Save this example as server.py to define and serve the skill in one file.
server.py
skill://issue-triage/SKILL.md and a manifest for both files. The manifest lists their URIs, sizes, and content digests so the client can verify what it reads. To run the client examples below, start the server at http://localhost:8000/mcp with fastmcp run server.py --transport http.
The description appears in discovery results, so write it for an agent deciding whether to open the skill. The instructions and supporting files are available separately. Here an agent can read the duplicate-checking procedure without also loading the routing table.
Loading a skill directory
If you already maintain an Agent Skills directory, you can serve it as written. The folder name matches the name in the entry fileβs frontmatter. The triage skill above has two files in its folder.Skill.from_directory() to read both files into one Skill. Every supporting file keeps its relative path and exact bytes.
Skill captures its contents when you construct it. Editing the source directory later affects the next load. Use Skill.from_package("my_package", "skills/issue-triage") to load a directory distributed as Python package data.
If your application already has the contents of the files, you can skip writing them to disk. Pass Skill.from_files() a Python dictionary. Each key is a filename relative to the skill folder, and its value is the text or bytes the agent should read from that file. Include the full SKILL.md, with its YAML frontmatter:
Names, frontmatter, and file limits
Names, frontmatter, and file limits
The name must match the skill directoryβs name. It can contain 1β64 lowercase letters, digits, and hyphens, with no leading, trailing, or consecutive hyphens. The description must contain 1β1,024 characters.When constructing a skill, pass additional fields such as
frontmatter={"license": "MIT"} and use str or bytes for supporting file contents. FastMCP accepts up to 512 files and 16 MiB total per skill, including SKILL.md. On the resulting object, skill.files maps paths to bytes and skill.manifest contains the frontmatter and each fileβs size and SHA-256 digest. Skill API referenceServing skills
A skill provider determines which skills a FastMCP server publishes and where each file can be read. Providers register the Skills extension automatically. Clients use the same discovery and read operations whether the provider serves a directory, builds a catalog for the current user, or retrieves files from object storage.Skill providers
UseSkillCatalogProvider when your application supplies the Skill objects. Pass a collection at startup for a fixed catalog, or override its loader for a dynamic catalog. To serve a skill maintained on disk, pass the result of Skill.from_directory("skills/issue-triage") in the catalog just as you would a skill constructed in Python.
The catalog uses each skillβs name as its default path. To group skills under a prefix, pass a dictionary of paths and skills, for example SkillCatalogProvider({"support/issue-triage": triage}). The final path segment must match the skill name.
A collection of skill directories. Use SkillsDirectoryProvider to publish every skill below one or more roots. The relative path becomes the published path, so a folder at skills/ops/deploy/ produces skill://ops/deploy/SKILL.md. When the same path appears under multiple roots, the first root wins.
reload=True to rescan on each request during development. If a skill becomes invalid mid-edit, the provider logs the error and continues serving the last valid collection.
Files in a database or object store. Subclass SkillManifestProvider when you can describe a skill without loading its files. Implement load_manifests() to return the callerβs manifests keyed by skill path, and read_file() to fetch the bytes of one requested file. This lets a client browse a large catalog while the files remain in storage. The bytes returned for each file must match the size and digest in its manifest.
Example manifest provider
Example manifest provider
This in-memory store illustrates the storage contract. In an object store, the same digest can serve as the object key so a read retrieves the version named by the manifest.
Dynamic skills
You can define a skill at runtime. OverrideSkillCatalogProvider.load_skills() to build the catalog from the current state of your application. The method returns ordinary Skill objects, so your code controls the instructions, the supporting files, and which skills are available at all.
For example, suppose your issue tracker keeps service ownership in a JSON file. This provider turns those records into the routing table an agent needs for triage. When a service changes teams, the next request picks up the new owner.
owners.json
User-specific skills
On an authenticated HTTP server, the loader can use the verified access token to select a team or workspace. In this example, every team uses the same triage procedure. Only the contents ofrouting.md depend on the caller. The agent can follow the same relative reference for every user.
ProjectSkills() on a server with an HTTP authentication provider. To vary which skills the agent can discover, change the collection you return. For example, include a release notes skill only for users whose token has the releases:write scope. The runnable example demonstrates both behaviors with two authenticated clients. Run uv run python -m examples.skills.user_specific from the repository root. Server and client example
Access control
To restrict an entire skill to a team, select it in the provider. A direct read by URI goes through the provider for that caller, just as discovery does. If the provider returns only the triage skill for Alice, it has no release notes files to serve her, even if she knows their URIs. Use resource authorization when a rule applies to individual files or across multiple providers. FastMCP checks whether the caller can read every file in the manifest before including a skill inskills/list or returning its entry from skills/get. If routing.md is restricted, the whole triage skill drops out of discovery for that caller. A direct read of routing.md is denied, while a direct read of SKILL.md still follows the entry fileβs own policy. This distinction matters if the instructions themselves are private.
The following HTTP server attaches a routing policy to a fixed skill catalog. It uses two local development tokens so you can try the policy: reader-token can read the general instructions, and router-token can also discover the complete skill and read the routing table.
auth_server.py
python auth_server.py on its own, then list the skills as each caller. Only the second command lists issue-triage.
AuthMiddleware uses the same resource check during discovery and reads. For custom middleware, implement check_resource_access. Tools mentioned in instructions authorize their calls independently. Authorization Β· Resource access checks
Mounts and proxies
A gateway can advertise skills from servers it mounts in the same process and from remote MCP backends. In either case, the URIs in a discovery entry must resolve to the advertised files through the gateway.Mounted servers
A mounted server contributes its skills to its parent. Usegateway.mount(child, namespace="team") to publish skill://issue-triage/SKILL.md at skill://team/issue-triage/SKILL.md. FastMCP rewrites supporting file URIs under the same prefix and checks the parentβs resource policies before advertising the entry. Use a mount for namespacing. Discovery skips providers with provider-level transforms and omits skills whose required files are hidden, renamed, or shadowed. Server composition
Proxied servers
A proxy forwards resource reads. Passskills=True to also advertise entries from a backend that supports the Skills extension. For example, this gateway discovers skills from a remote issue tracker under the team namespace:
Gateway configuration and discovery limits
Gateway configuration and discovery limits
For an unnamespaced backend, register
ProxyProvider(..., skills=True) directly. A custom client factory should use ProxyClient(url, mode="auto") to negotiate the protocol used by Skills. create_proxy handles protocol negotiation for you. Proxy providersA gateway advertises an entry only if it serves all the listed files from that backend to the caller. It skips entries whose manifest is the protocol literal "dynamic", because those entries have no file list to verify. A Python skill generated per request has a concrete manifest and can be proxied.Listing and lookup follow provider_error_strategy. The default, "warn", logs a failing source and keeps healthy sources available. Use "raise" to fail the operation. To limit discovery to explicitly selected providers on one server, register them first, then add SkillsExtension(providers=[...]) from fastmcp.skills.extension.Discovering and reading skills
The MCP Skills extension separates discovering a skill from reading its files. A discovery entry describes the skill and lists its files. Each file, includingSKILL.md, is an MCP resource that the client can read individually. The host application decides when to offer or activate a skill. MCP Skills extension and host support
Discover skills with the Skills extension
EnableSkillsClientExtension() on a FastMCP client and call list_skills() to retrieve the catalog for that connection. Each entry includes the URI of SKILL.md, its frontmatter, and the manifest. Use get_skill(uri) when you already know the entry URI. Both operations return metadata without downloading the files.
ClientGroup.list_skills(). Client groups
Reading skill files
To read the routing table alone, callawait client.read_resource("skill://issue-triage/routing.md"). To retrieve the entire skill, call await client.read_skill("skill://issue-triage/SKILL.md"). The latter returns the same Python Skill type you use to define a skill, so you can inspect its files, write it to disk, or publish it on another server.
With the Skills extension enabled, read_skill() gets the manifest via skills/get. The client checks the declared size and file count before downloading, verifies each file against its byte size and SHA-256 digest, and compares the downloaded frontmatter with the extension entry. A file that has changed since the manifest was retrieved fails verification. The manifest also supplies the file listing for clients browsing a skill. FastMCP 4.2 supports file reads without the optional directoryRead capability.
Install skills into a local agent
An agent that loads skills from a local directory can use copies downloaded from an MCP server. This example discovers the skills available to the client, downloads each one with verification, and writes it into Claude Codeβs skills directory. Each target folder must match the skillβs name.overwrite=True to to_directory(). This replaces the directory, including any local edits or additional files. By default an existing directory raises FileExistsError.
Clients that only call tools
For a host that exposes only tools to the model, registermcp.add_transform(ResourcesAsTools(mcp)), importing ResourcesAsTools from fastmcp.server.transforms. This exposes list_resources and read_resource as tools. The model can call them to find a SKILL.md and follow its file references even when the host has no native skills UI. Resources as tools
Migrating from the FastMCP 4.1 skills API
Migrating from the FastMCP 4.1 skills API
FastMCP 4.2 deprecates the providers in
fastmcp.server.providers.skills and the helpers in fastmcp.utilities.skills for removal in 4.3. Their warnings name the replacement. For directory providers, the warning also identifies folders that need fixing before the new provider can load them. Migrate the server to a 4.2 skill provider and enable SkillsClientExtension() on the client to use the discovery methods below.The 4.2 provider uses
SKILL.md as its entry file and exposes all supporting files as resources. The old main_file_name and supporting_files settings have no equivalents.If you used the old Skill type in a Pydantic field to validate protocol entries, change that annotation to MCPSkill. FastMCP 4.2 accepts the old spelling for compatibility. Providers take authored Skill values containing the actual file bytes.