π The fast, Pythonic way to build MCP servers and clients.
Retire alpha-only skills code and redirect experimental providers (#6279)
nate nowacka514cf960430
diff --git a/docs/.mintlify/skills/fastmcp-server/SKILL.md b/docs/.mintlify/skills/fastmcp-server/SKILL.mdindex 7b71de3f1..cbe2a46aa 100644--- a/docs/.mintlify/skills/fastmcp-server/SKILL.md+++ b/docs/.mintlify/skills/fastmcp-server/SKILL.md@@ -56,14 +56,14 @@ and hosting choices to determine configuration.When clients need a repeatable workflow across the server's capabilities,consider shipping a skill alongside those capabilities. Put task selection,operation sequencing, and recovery guidance in the skill; keep tool descriptions-focused on their individual contracts. Read the version-matched Skills Provider-and Experimental Skills Extension docs from the index before implementing it.-`SkillsDirectoryProvider` exposes skill files as resources; the experimental-extension adds `skills/list` and `skills/get` discovery. Check the installed-release and target host's support before selecting either interface. Discovery-does not activate a skill: verify that the host reads and uses it in the intended-workflow. The experimental extension currently requires directly registered-providers and does not support mounted or transformed skill sources.+focused on their individual contracts. Read the version-matched Skills docs from+the index before implementing it. `SkillsDirectoryProvider` and+`SkillCatalogProvider` serve skill files as resources and also answer the+experimental Skills extension's `skills/list` and `skills/get`. Check the+installed release and target host's support before relying on discovery.+Discovery does not activate a skill: verify that the host reads and uses it in+the intended workflow. Providers added with transforms are not discoverable;+mount a server instead.Verify the server through FastMCP's `Client`, which can connect directly to aserver instance for in-process testing. Check a representative operation, itsdiff --git a/docs/clients/client.mdx b/docs/clients/client.mdxindex 92cdde5e6..01547c312 100644--- a/docs/clients/client.mdx+++ b/docs/clients/client.mdx@@ -60,7 +60,7 @@ Pass your server instance to `Client(server)` in a test to exercise tool discove### Discovering and Downloading Skills-An agent can also use the client to retrieve instructions and supporting files from servers that expose skills as resources. The [skills client utilities](/servers/skills#install-skills-into-a-local-agent) provide `list_skill_summaries()` for discovery, `get_skill_manifest()` for inspecting files, and `download_skill()` or `sync_skills()` for saving them locally.+An agent can also use the client to retrieve a server's skills. `list_skills()` discovers them, `read_skill()` fetches and verifies every file of one, and `skill.to_directory()` [installs it into a local agent](/servers/skills#install-skills-into-a-local-agent).## Choosing a Transportdiff --git a/docs/getting-started/upgrading/from-fastmcp-3.mdx b/docs/getting-started/upgrading/from-fastmcp-3.mdxindex 0d08f7bb6..598451237 100644--- a/docs/getting-started/upgrading/from-fastmcp-3.mdx+++ b/docs/getting-started/upgrading/from-fastmcp-3.mdx@@ -260,7 +260,7 @@ The proxy, OpenAPI, and app integrations moved to their permanent homes, and the| `OpenAISamplingHandler` from `fastmcp.experimental.sampling.handlers` | `fastmcp.client.sampling.handlers.openai` || `AuthCheck` / `AuthContext` / `require_scopes` / `require_roles` / `restrict_tag` / `run_auth_checks` from `fastmcp.server.auth.authorization` | `fastmcp.server.auth` || `run_auth_checks_with_shortfall` / `scope_requirements` from `fastmcp.server.auth.authorization` | `fastmcp.utilities.authorization` |-| `SkillsProvider` | `SkillsDirectoryProvider` from `fastmcp.server.providers.skills` |+| `SkillsProvider` | `SkillsDirectoryProvider` from `fastmcp.skills.provider` || `TaskConfig` from `fastmcp.server.tasks` | `fastmcp.utilities.tasks` || `CurrentDocket` / `CurrentWorker` from `fastmcp.dependencies` | `fastmcp_tasks.dependencies` || `fastmcp.server.sampling` (and `SamplingTool`) | removed with [server-side sampling](#protocol-version-support) |diff --git a/docs/servers/skills.mdx b/docs/servers/skills.mdxindex 6c835ac49..db880d3b1 100644--- a/docs/servers/skills.mdx+++ b/docs/servers/skills.mdx@@ -156,21 +156,24 @@ A skill you read is the same value as one you build, so you can hand it to a `Sk### Install skills into a local agent-Most agents still only read skills from disk. `sync_skills()` reads every skill a server lists and writes each one into a local folder, verified the same way:+Most agents still only read skills from disk. List a server's skills, read each one, and write it into the agent's folder:```pythonfrom pathlib import Pathfrom fastmcp import Client-from fastmcp.utilities.skills import sync_skills+from fastmcp.skills import SkillsClientExtension-async with Client("http://localhost:8000/mcp") as client:- await sync_skills(client, Path.home() / ".claude" / "skills", overwrite=True)-```+target = Path.home() / ".claude" / "skills"+client = Client("http://localhost:8000/mcp", extensions=[SkillsClientExtension()])-Downloads now require valid `SKILL.md` frontmatter with a `name` matching the skill's URI and a `description`; add these fields to older resource-only skills before downloading them. Digest or size mismatches raise an error before writing. `overwrite=True` replaces the existing skill folder, including removing locally added files.+async with client:+ for entry in await client.list_skills():+ skill = await client.read_skill(entry.uri)+ skill.to_directory(target / skill.name, overwrite=True)+```-If a folder uses a custom main filename, create a standard `SKILL.md` with those fields and update affected relative references before exporting it as a skill. Existing resource providers can still serve the original documents through `resources/read`.+Every file is verified before anything is written. `overwrite=True` replaces an existing skill folder, including any files added to it locally.## Current limitsdiff --git a/examples/skills/README.md b/examples/skills/README.mdindex 2b6a57254..0d3afb12a 100644--- a/examples/skills/README.md+++ b/examples/skills/README.md@@ -15,9 +15,8 @@ Skills extension, verifies each complete skill and exports it to a temporarydirectory. The temporary copies are removed when the example exits. No localagent's skills folder is changed.-The last connection uses resource-only discovery with `list_skill_summaries()`.-`read_skill()` downloads the same content through the `_manifest` fallback, so-this also works when the connection does not negotiate Skills.+The last connection doesn't negotiate Skills. `read_skill()` downloads the same+content through the `_manifest` resource instead.To launch the server over stdio for another MCP client:diff --git a/examples/skills/client.py b/examples/skills/client.pyindex 7eaad8401..856f7bf41 100644--- a/examples/skills/client.py+++ b/examples/skills/client.py@@ -7,7 +7,6 @@ from tempfile import TemporaryDirectoryfrom examples.skills.server import mcpfrom fastmcp import Clientfrom fastmcp.skills import SkillsClientExtension-from fastmcp.utilities.skills import list_skill_summariesasync def main() -> None:@@ -21,9 +20,8 @@ async def main() -> None:print(f"Exported {folder.name} to a temporary directory")async with Client(mcp) as client:- summaries = await list_skill_summaries(client)- skill = await client.read_skill(summaries[0].uri)- print(f"Resource-only discovery and download: {skill.name}")+ skill = await client.read_skill("skill://code-review/SKILL.md")+ print(f"Read without the Skills extension: {skill.name}")if __name__ == "__main__":diff --git a/fastmcp_slim/fastmcp/server/providers/__init__.py b/fastmcp_slim/fastmcp/server/providers/__init__.pyindex f138404f2..8cac9e782 100644--- a/fastmcp_slim/fastmcp/server/providers/__init__.py+++ b/fastmcp_slim/fastmcp/server/providers/__init__.py@@ -32,13 +32,15 @@ from fastmcp.server.providers.base import Providerfrom fastmcp.server.providers.fastmcp_provider import FastMCPProviderfrom fastmcp.server.providers.filesystem import FileSystemProviderfrom fastmcp.server.providers.local_provider import LocalProvider-from fastmcp.server.providers.skills import (- ClaudeSkillsProvider,- SkillProvider,- SkillsDirectoryProvider,-)if TYPE_CHECKING:+ from fastmcp.server.providers.skills import (+ ClaudeSkillsProvider as ClaudeSkillsProvider,+ )+ from fastmcp.server.providers.skills import SkillProvider as SkillProvider+ from fastmcp.server.providers.skills import (+ SkillsDirectoryProvider as SkillsDirectoryProvider,+ )from fastmcp.server.providers.openapi import OpenAPIProvider as OpenAPIProviderfrom fastmcp.server.providers.proxy import ProxyProvider as ProxyProvider@@ -66,4 +68,9 @@ def __getattr__(name: str) -> object:from fastmcp.server.providers.openapi import OpenAPIProviderreturn OpenAPIProvider+ if name in ("SkillProvider", "SkillsDirectoryProvider", "ClaudeSkillsProvider"):+ # Imported lazily so `fastmcp.server.providers` stays light.+ from fastmcp.server.providers import skills++ return getattr(skills, name)raise AttributeError(f"module {__name__!r} has no attribute {name!r}")diff --git a/fastmcp_slim/fastmcp/server/providers/skills/_common.py b/fastmcp_slim/fastmcp/server/providers/skills/_common.pyindex e64c85a57..798a9658e 100644--- a/fastmcp_slim/fastmcp/server/providers/skills/_common.py+++ b/fastmcp_slim/fastmcp/server/providers/skills/_common.py@@ -31,14 +31,10 @@ class SkillInfo:main_file: str # Name of main file (e.g., "SKILL.md")files: list[SkillFileInfo] = field(default_factory=list)frontmatter: dict[str, Any] = field(default_factory=dict)- preserve_bytes: bool = False@propertydef uri_prefix(self) -> str:- from urllib.parse import quote-- name = quote(self.name, safe="/") if self.preserve_bytes else self.name- return f"skill://{name}/"+ return f"skill://{self.name}/"def _parse_frontmatter_line_based(frontmatter_text: str) -> dict[str, Any]:diff --git a/fastmcp_slim/fastmcp/server/providers/skills/directory_provider.py b/fastmcp_slim/fastmcp/server/providers/skills/directory_provider.pyindex a8d29d9ec..cc48ea2c2 100644--- a/fastmcp_slim/fastmcp/server/providers/skills/directory_provider.py+++ b/fastmcp_slim/fastmcp/server/providers/skills/directory_provider.py@@ -2,38 +2,21 @@from __future__ import annotations-from collections import Counter+import warningsfrom collections.abc import Sequencefrom pathlib import Path-from typing import TYPE_CHECKING, Any, Literal-from urllib.parse import quote, unquote+from typing import Any, Literal-import yaml-from anyio.to_thread import run_sync-from mcp.server.context import ServerRequestContext-from mcp.shared.path_security import PathEscapeError, safe_join+from mcp.shared.path_security import PathEscapeError-from fastmcp.exceptions import AuthorizationError+from fastmcp._warnings import FastMCPDeprecationWarningfrom fastmcp.resources.base import Resourcefrom fastmcp.resources.template import ResourceTemplate-from fastmcp.server.dependencies import get_contextfrom fastmcp.server.providers.aggregate import AggregateProvider-from fastmcp.server.providers.skills._common import SkillInfo, scan_skill_files-from fastmcp.server.providers.skills.skill_provider import (- SkillFileResource,- SkillFileTemplate,- SkillProvider,- SkillResource,-)-from fastmcp.skills._resources import is_skill_file-from fastmcp.skills._snapshot import Snapshot, snapshot-from fastmcp.skills.models import MCPSkill+from fastmcp.server.providers.skills.skill_provider import SkillProviderfrom fastmcp.utilities.logging import get_loggerfrom fastmcp.utilities.versions import VersionSpec-if TYPE_CHECKING:- from fastmcp.server.extensions import ServerExtension-logger = get_logger(__name__)@@ -48,13 +31,14 @@ class SkillsDirectoryProvider(AggregateProvider):Args:roots: Root directory(ies) containing skill folders. Can be a single pathor a sequence of paths.- experimental_skills: Opt into experimental SEP-2640 discovery, strict- manifests, nested skills, and live byte-preserving reads. Defaults to False.reload: If True, re-discover skills on each request. Defaults to False.main_file_name: Name of the main skill file. Defaults to "SKILL.md".supporting_files: How supporting files are exposed in child SkillProviders:- "template": Accessed via ResourceTemplate, hidden from list_resources().- "resources": Each file exposed as individual Resource in list_resources().+ experimental_skills: Returns the replacement provider instead, with a+ deprecation warning. The replacement fails at startup on folders+ that are not valid Agent Skills.Example:```python@@ -75,6 +59,19 @@ class SkillsDirectoryProvider(AggregateProvider):```"""+ def __new__(cls, *args: Any, **kwargs: Any) -> Any:+ if not kwargs.get("experimental_skills"):+ return super().__new__(cls)+ if cls is not SkillsDirectoryProvider:+ # A subclass may carry overrides (such as access checks) that the+ # replacement would silently drop, so refuse instead.+ raise TypeError(+ f"`experimental_skills=True` is no longer supported on subclasses "+ f"such as `{cls.__name__}`. Build on "+ "`fastmcp.skills.provider.SkillsDirectoryProvider` instead."+ )+ return _experimental_replacement(*args, **kwargs)+def __init__(self,roots: str | Path | Sequence[str | Path],@@ -89,20 +86,12 @@ class SkillsDirectoryProvider(AggregateProvider):if isinstance(roots, (str, Path)):roots = [roots]- self._experimental_skills = experimental_skills- if experimental_skills and main_file_name != "SKILL.md":- raise ValueError("experimental_skills requires main_file_name='SKILL.md'")- self._roots = [- Path(r).absolute() if experimental_skills else Path(r).resolve()- for r in roots- ]+ self._roots = [Path(r).resolve() for r in roots]self._reload = reloadself._main_file_name = main_file_nameself._supporting_files = supporting_filesself._discovered = False-- if not experimental_skills:- self._discover_skills()+ self._discover_skills()def _discover_skills(self) -> None:"""Scan root directories and create SkillProvider per valid skill folder."""@@ -173,30 +162,22 @@ class SkillsDirectoryProvider(AggregateProvider):# Override list methods to support reloadasync def _list_resources(self) -> Sequence[Resource]:- if self._experimental_skills:- return await self._protocol_list_resources()await self._ensure_discovered()return await super()._list_resources()async def _list_resource_templates(self) -> Sequence[ResourceTemplate]:- if self._experimental_skills:- return await self._protocol_list_resource_templates()await self._ensure_discovered()return await super()._list_resource_templates()async def _get_resource(self, uri: str, version: VersionSpec | None = None) -> Resource | None:- if self._experimental_skills:- return await self._protocol_get_resource(uri, version)await self._ensure_discovered()return await super()._get_resource(uri, version)async def _get_resource_template(self, uri: str, version: VersionSpec | None = None) -> ResourceTemplate | None:- if self._experimental_skills:- return await self._protocol_get_resource_template(uri, version)await self._ensure_discovered()return await super()._get_resource_template(uri, version)@@ -207,258 +188,34 @@ class SkillsDirectoryProvider(AggregateProvider):f"reload={self._reload}, skills={len(self.providers)})")- def _candidate_directories(self) -> list[tuple[str, Path]]:- candidates: list[tuple[str, Path]] = []- for root in self._roots:- if root.is_symlink():- logger.warning("Ignoring symlink Skills root: %s", root)- continue- if not root.is_dir():- continue- for main in sorted(root.rglob("SKILL.md")):- directory = main.parent- if not main.is_file() or directory == root:- continue- if any(- p.is_symlink()- for p in (directory, *directory.parents)- if p == root or root in p.parents- ):- continue- candidates.append((directory.relative_to(root).as_posix(), directory))- return candidates-- def _directories(self) -> list[tuple[str, Path]]:- candidates = self._candidate_directories()- counts = Counter(name for name, _ in candidates)- for name, count in counts.items():- if count > 1:- logger.warning("Omitting duplicate skill path: %s", name)- return [(name, path) for name, path in candidates if counts[name] == 1]-- def _snapshots(self) -> list[Snapshot]:- snapshots: list[Snapshot] = []- for name, path in self._directories():- try:- snapshots.append(snapshot(path, name))- except (OSError, ValueError, yaml.YAMLError, RecursionError) as exc:- logger.warning("Omitting invalid skill %s: %s", path, exc)- return snapshots-- def _resource_provider(- self, root: Path, name: str, relative: str | None = None- ) -> SkillProvider:- # Ordinary resources do not require valid skill frontmatter or UTF-8.- # Only listings and synthetic manifests need a complete file inventory.- info = SkillInfo(- name=name,- description=f"Skill: {name}",- path=root,- main_file="SKILL.md",- files=[- file- for file in scan_skill_files(root)- if is_skill_file(root, file.path)- ]- if relative is None or relative == "_manifest"- else [],- preserve_bytes=True,- )- return SkillProvider(- root, supporting_files=self._supporting_files, _skill_info=info- )-- async def _protocol_list_resources(self) -> Sequence[Resource]:- resources: dict[str, Resource] = {}- for name, root in await run_sync(self._directories):- try:- provider = await run_sync(self._resource_provider, root, name)- except (OSError, ValueError):- continue- for resource in await provider.list_resources():- resources[str(resource.uri)] = resource- return list(resources.values())-- def _directories_for_name(self, name: str) -> list[Path]:- directories = []- for root in self._roots:- try:- directory = safe_join(root, name)- except (PathEscapeError, OSError, RuntimeError):- continue- lexical = root / name- if any(- path.is_symlink()- for path in (lexical, *lexical.parents)- if path == root or root in path.parents- ):- continue- if (directory / "SKILL.md").is_file():- directories.append(lexical)- return directories-- def _uri_parts(self, uri: str) -> list[str] | None:- if not uri.startswith("skill://"):- return None- encoded = uri[len("skill://") :]- decoded = unquote(encoded)- parts = decoded.split("/")- if (- quote(decoded, safe="/") != encoded- or len(parts) < 2- or any(part in {"", ".", ".."} for part in parts)- or "\\" in decoded- ):- return None- return parts-- def _resolve_file(self, uri: str) -> tuple[Path, str] | None:- parts = self._uri_parts(uri)- if parts is None:- return None- for length in range(len(parts) - 1, 0, -1):- directories = self._directories_for_name("/".join(parts[:length]))- if len(directories) > 1:- return None- if directories:- return directories[0], "/".join(parts[length:])- return None-- async def _protocol_get_resource(- self, uri: str, version: VersionSpec | None = None- ) -> Resource | None:- resolved = self._resolve_file(uri)- if resolved is None:- return None- root, relative = resolved- if (- relative not in {"SKILL.md", "_manifest"}- and self._supporting_files != "resources"- ):- return None- if relative != "_manifest" and not await run_sync(- is_skill_file, root, relative- ):- return None- parts = self._uri_parts(uri)- assert parts is not None- name = "/".join(parts[: -len(relative.split("/"))])- if relative == "_manifest":- provider = await run_sync(self._resource_provider, root, name, relative)- else:- provider = self._resource_provider(root, name, relative)- return await provider.get_resource(uri, version)-- async def _protocol_list_resource_templates(self) -> Sequence[ResourceTemplate]:- if self._supporting_files != "template":- return []- templates: list[ResourceTemplate] = []- for name, root in await run_sync(self._directories):- provider = self._resource_provider(root, name, "SKILL.md")- templates.extend(await provider.list_resource_templates())- return templates-- async def _protocol_get_resource_template(- self, uri: str, version: VersionSpec | None = None- ) -> ResourceTemplate | None:- if self._supporting_files != "template":- return None- resolved = self._resolve_file(uri)- if resolved is None:- return None- root, relative = resolved- if relative in {"SKILL.md", "_manifest"}:- return None- if not await run_sync(is_skill_file, root, relative):- return None- parts = self._uri_parts(uri)- assert parts is not None- name = "/".join(parts[: -len(relative.split("/"))])- provider = self._resource_provider(root, name, relative)- return await provider.get_resource_template(uri, version)-- async def _visible_entry(self, snap: Snapshot) -> MCPSkill | None:- server = get_context().fastmcp- for uri, path in snap.files:- component: Resource | ResourceTemplate | None = await server.get_resource(- uri- )- if component is not None:- if isinstance(component, SkillResource) and not component.is_manifest:- backing = component.skill_info.path / component.skill_info.main_file- elif isinstance(component, SkillFileResource):- backing = component.skill_info.path / component.file_path- else:- return None- if backing != path or not component.skill_info.preserve_bytes:- return None- else:- component = await server.get_resource_template(uri)- if not isinstance(component, SkillFileTemplate):- return None- params = component.matches(uri)- if params is None or component.skill_info.path / params["path"] != path:- return None- try:- await server._check_resource_access(uri)- except AuthorizationError:- return None- return snap.entry-- async def _list_skill_entries(- self, context: ServerRequestContext[Any, Any]- ) -> Sequence[MCPSkill]:- entries = []- for snap in await run_sync(self._snapshots):- entry = await self._visible_entry(snap)- if entry is not None:- entries.append(entry)- return entries-- async def _get_skill_entry(- self, uri: str, context: ServerRequestContext[Any, Any]- ) -> MCPSkill | None:- parts = self._uri_parts(uri)- if parts is None or parts[-1] != "SKILL.md":- return None- name = "/".join(parts[:-1])- directories = self._directories_for_name(name)- if len(directories) != 1:- return None- try:- snap = await run_sync(snapshot, directories[0], name)- except (OSError, ValueError, yaml.YAMLError, RecursionError) as exc:- logger.warning("Omitting invalid skill %s: %s", directories[0], exc)- return None- return await self._visible_entry(snap)-- def _owns_skill_resource(self, uri: str) -> bool:- parts = self._uri_parts(uri)- return parts is not None and any(- self._directories_for_name("/".join(parts[:length]))- for length in range(len(parts) - 1, 0, -1)- )- def required_extensions(self) -> Sequence[ServerExtension]:- if not self._experimental_skills:- return ()- from fastmcp.skills.extension import SkillsExtension-- return (SkillsExtension(),)-- def _validate_skill_source(self) -> None:- if not self._experimental_skills:- raise ValueError("Skills discovery requires experimental_skills=True")-- async def _skill_uris(self, uri: str | None = None) -> Sequence[str]:- self._validate_skill_source()- if uri is None:- candidates = await run_sync(self._candidate_directories)- return [- f"skill://{quote(name, safe='/')}/SKILL.md" for name, _ in candidates- ]- parts = self._uri_parts(uri)- if parts is None or parts[-1] != "SKILL.md":- return []- directories = self._directories_for_name("/".join(parts[:-1]))- return [uri] * len(directories)+def _experimental_replacement(+ roots: str | Path | Sequence[str | Path],+ reload: bool = False,+ main_file_name: str = "SKILL.md",+ supporting_files: Literal["template", "resources"] = "template",+ *,+ experimental_skills: bool,+) -> Any:+ # `experimental_skills` was documented as changeable without a+ # deprecation period; it now means the replacement provider.+ from fastmcp.skills.provider import (+ SkillsDirectoryProvider as AgentSkillsDirectoryProvider,+ )++ if main_file_name != "SKILL.md":+ raise ValueError("experimental_skills requires main_file_name='SKILL.md'")+ paths = [roots] if isinstance(roots, (str, Path)) else list(roots)+ shown = [str(path) for path in paths]+ reload_arg = ", reload=True" if reload else ""+ warnings.warn(+ "`experimental_skills=True` is deprecated and will be removed in "+ "FastMCP 4.3, and this call now returns the replacement provider. "+ "Replace it with `from fastmcp.skills.provider import "+ f"SkillsDirectoryProvider` and `SkillsDirectoryProvider({shown!r}"+ f"{reload_arg})`. Registering `SkillsExtension` is no longer needed.",+ FastMCPDeprecationWarning,+ # Frames: this function, `__new__`, then the caller.+ stacklevel=3,+ )+ return AgentSkillsDirectoryProvider(paths, reload=reload)diff --git a/fastmcp_slim/fastmcp/server/providers/skills/skill_provider.py b/fastmcp_slim/fastmcp/server/providers/skills/skill_provider.pyindex ea3dd72d8..5aa20ec36 100644--- a/fastmcp_slim/fastmcp/server/providers/skills/skill_provider.py+++ b/fastmcp_slim/fastmcp/server/providers/skills/skill_provider.py@@ -9,8 +9,7 @@ from pathlib import Pathfrom typing import Any, Literal, castfrom urllib.parse import quote, unquote-from anyio.to_thread import run_sync-from mcp.shared.path_security import PathEscapeError, safe_join+from mcp.shared.path_security import PathEscapeErrorfrom pydantic import AnyUrlfrom fastmcp.resources.base import Resource, ResourceResult@@ -22,7 +21,6 @@ from fastmcp.server.providers.skills._common import (resolve_within,scan_skill_files,)-from fastmcp.skills._resources import read_filefrom fastmcp.utilities.logging import get_loggerfrom fastmcp.utilities.versions import VersionSpec@@ -72,10 +70,6 @@ class SkillResource(Resource):if self.is_manifest:return self._generate_manifest()else:- if self.skill_info.preserve_bytes:- return await run_sync(- read_file, self.skill_info.path, self.skill_info.main_file- )main_file_path = resolve_within(self.skill_info.path, self.skill_info.main_file)@@ -101,9 +95,6 @@ class SkillFileTemplate(ResourceTemplate):async def read(self, arguments: dict[str, Any]) -> str | bytes | ResourceResult:"""Read a file from the skill directory."""file_path = arguments.get("path", "")- if self.skill_info.preserve_bytes:- return await run_sync(read_file, self.skill_info.path, file_path)-full_path = _resolve_supporting_file(self.skill_info.path, file_path)if not full_path.exists():@@ -163,8 +154,6 @@ class SkillFileResource(Resource):async def read(self) -> str | bytes | ResourceResult:"""Read the file content."""- if self.skill_info.preserve_bytes:- return await run_sync(read_file, self.skill_info.path, self.file_path)full_path = _resolve_supporting_file(self.skill_info.path, self.file_path)if not full_path.exists():@@ -217,20 +206,15 @@ class SkillProvider(Provider):skill_path: str | Path,main_file_name: str = "SKILL.md",supporting_files: Literal["template", "resources"] = "template",- *,- _skill_info: SkillInfo | None = None,) -> None:super().__init__()- self._skill_path = (- _skill_info.path if _skill_info is not None else Path(skill_path).resolve()- )+ self._skill_path = Path(skill_path).resolve()self._main_file_name = main_file_nameself._supporting_files = supporting_files- self._skill_info = _skill_info+ self._skill_info: SkillInfo | None = None# Load at init to catch errors early- if self._skill_info is None:- self._load_skill()+ self._load_skill()def _load_skill(self) -> None:"""Load and parse the skill directory."""@@ -375,8 +359,6 @@ class SkillProvider(Provider):)elif self._supporting_files == "resources":known = any(file_info.path == file_path for file_info in skill.files)- if skill.preserve_bytes:- known = safe_join(skill.path, file_path).is_file()if known:mime_type, _ = mimetypes.guess_type(file_path)return SkillFileResource(diff --git a/fastmcp_slim/fastmcp/skills/_composition.py b/fastmcp_slim/fastmcp/skills/_composition.pyindex a33742231..4e011147b 100644--- a/fastmcp_slim/fastmcp/skills/_composition.py+++ b/fastmcp_slim/fastmcp/skills/_composition.py@@ -79,9 +79,6 @@ class _MountedSkills:uri = reversed_urireturn uri- def _validate_skill_source(self) -> None:- return None-def _owns_skill_resource(self, uri: str) -> bool:child_uri = self._to_child(uri)return child_uri is not None and self._extension._requires_live_resource(diff --git a/fastmcp_slim/fastmcp/skills/_proxy.py b/fastmcp_slim/fastmcp/skills/_proxy.pyindex 4a3386b9b..6dc96d2a3 100644--- a/fastmcp_slim/fastmcp/skills/_proxy.py+++ b/fastmcp_slim/fastmcp/skills/_proxy.py@@ -47,9 +47,6 @@ class _ProxiedSkills:def __init__(self, provider: ProxyProvider) -> None:self._provider = provider- def _validate_skill_source(self) -> None:- return None-def _owns_skill_resource(self, uri: str) -> bool:return uri.startswith("skill://")diff --git a/fastmcp_slim/fastmcp/skills/_resources.py b/fastmcp_slim/fastmcp/skills/_resources.pydeleted file mode 100644index fa82af1d6..000000000--- a/fastmcp_slim/fastmcp/skills/_resources.py+++ /dev/null@@ -1,44 +0,0 @@-"""Byte-preserving resource reads for strict filesystem skills."""--from __future__ import annotations--import mimetypes-from contextlib import suppress-from pathlib import Path--from mcp.shared.path_security import PathEscapeError, safe_join--from fastmcp.resources.base import ResourceContent, ResourceResult---def _has_symlink(root: Path, relative_path: str) -> bool:- lexical_path = root / relative_path- return root.is_symlink() or any(- ancestor.is_symlink()- for ancestor in (lexical_path, *lexical_path.parents)- if ancestor == root or root in ancestor.parents- )---def is_skill_file(root: Path, relative_path: str) -> bool:- """Whether `read_file` would serve this path."""- try:- path = safe_join(root, relative_path)- except (PathEscapeError, OSError, RuntimeError):- return False- return not _has_symlink(root, relative_path) and path.is_file()---def read_file(root: Path, relative_path: str) -> ResourceResult:- path = safe_join(root, relative_path)- if _has_symlink(root, relative_path):- raise ValueError("skill files must not be symlinks")- if not path.is_file():- raise ValueError("skill resource must be a regular file")- content = path.read_bytes()- mime_type = mimetypes.guess_type(path.name)[0] or "application/octet-stream"- value: str | bytes = content- if mime_type.startswith("text/"):- with suppress(UnicodeDecodeError):- value = content.decode("utf-8")- return ResourceResult([ResourceContent(value, mime_type=mime_type)])diff --git a/fastmcp_slim/fastmcp/skills/_snapshot.py b/fastmcp_slim/fastmcp/skills/_snapshot.pyindex 2db083ff3..888f81013 100644--- a/fastmcp_slim/fastmcp/skills/_snapshot.py+++ b/fastmcp_slim/fastmcp/skills/_snapshot.py@@ -1,20 +1,16 @@-"""Strict filesystem snapshots for experimental Skills publication."""+"""Strict `SKILL.md` frontmatter parsing and skill folder scanning."""from __future__ import annotationsimport mathimport re-from dataclasses import dataclassfrom pathlib import Pathfrom typing import Any-from urllib.parse import quoteimport yaml-from mcp.shared.path_security import safe_joinfrom yaml.nodes import MappingNode-from fastmcp.skills.models import MCPSkill, SkillFrontmatter-from fastmcp.skills.skill import Skill, _validate_limits+from fastmcp.skills.models import SkillFrontmatterfrom fastmcp.utilities.logging import get_loggerlogger = get_logger(__name__)@@ -101,29 +97,3 @@ def scan_files(root: Path) -> list[Path]:f"skill contains a non-regular file: {path.relative_to(root)}")return files---@dataclass(frozen=True)-class Snapshot:- entry: MCPSkill- files: tuple[tuple[str, Path], ...]---def snapshot(root: Path, skill_path: str) -> Snapshot:- paths = scan_files(root)- main = root / "SKILL.md"- if main not in paths:- raise ValueError("skill must contain SKILL.md")- _validate_limits(len(paths), sum(path.stat().st_size for path in paths))- contents: dict[str, bytes] = {}- files: list[tuple[str, Path]] = []- for path in paths:- relative = path.relative_to(root).as_posix()- safe_join(root, relative)- contents[relative] = path.read_bytes()- uri = f"skill://{quote(skill_path, safe='/')}/{quote(relative, safe='/')}"- files.append((uri, path))- if scan_files(root) != paths:- raise ValueError("skill files changed while building the manifest")- entry = Skill.from_files(contents).to_mcp_skill(skill_path)- return Snapshot(entry=entry, files=tuple(files))diff --git a/fastmcp_slim/fastmcp/skills/_source.py b/fastmcp_slim/fastmcp/skills/_source.pyindex c7a46b907..85dfe5330 100644--- a/fastmcp_slim/fastmcp/skills/_source.py+++ b/fastmcp_slim/fastmcp/skills/_source.py@@ -22,10 +22,6 @@ class _SkillSource(Protocol):self, uri: str, context: ServerRequestContext[Any, Any]) -> MCPSkill | None: ...- def _validate_skill_source(self) -> None:- """Reject sources that have not opted into protocol publication."""- ...-async def _skill_uris(self, uri: str | None = None) -> Sequence[str]:"""Return identities before authorization/validation, preserving duplicates."""...diff --git a/fastmcp_slim/fastmcp/skills/extension.py b/fastmcp_slim/fastmcp/skills/extension.pyindex ba5615566..70af7b0ce 100644--- a/fastmcp_slim/fastmcp/skills/extension.py+++ b/fastmcp_slim/fastmcp/skills/extension.py@@ -92,8 +92,6 @@ class SkillsExtension(ServerExtension):"use SkillCatalogProvider to publish Skill objects")- provider._validate_skill_source()-@propertydef _sources(self) -> tuple[_SkillSource, ...]:if self._providers is not None:@@ -119,10 +117,6 @@ class SkillsExtension(ServerExtension):if source is not None:sources.append(source)elif isinstance(provider, _SkillSource) and not provider.transforms:- try:- provider._validate_skill_source()- except ValueError:- continuesources.append(provider)return tuple(sources)diff --git a/fastmcp_slim/fastmcp/skills/provider.py b/fastmcp_slim/fastmcp/skills/provider.pyindex 60846a2cb..3c7f16630 100644--- a/fastmcp_slim/fastmcp/skills/provider.py+++ b/fastmcp_slim/fastmcp/skills/provider.py@@ -55,7 +55,7 @@ class SkillFileResource(Resource):class SkillManifestResource(Resource):- """The resource-mode `_manifest` listing used by `sync_skills` and `download_skill`."""+ """The `_manifest` file listing `Client.read_skill` uses without the Skills extension."""model_config = ConfigDict(arbitrary_types_allowed=True)@@ -165,9 +165,6 @@ class SkillCatalogProvider(Provider):return _locate(uri, self._static) is not Nonereturn uri.startswith("skill://")- def _validate_skill_source(self) -> None:- return None-async def _skill_uris(self, uri: str | None = None) -> Sequence[str]:uris = [_skill_md_uri(path) for path in await self._catalog()]return uris if uri is None else [u for u in uris if u == uri]diff --git a/fastmcp_slim/fastmcp/utilities/skills.py b/fastmcp_slim/fastmcp/utilities/skills.pyindex e91d36232..6e197fda2 100644--- a/fastmcp_slim/fastmcp/utilities/skills.py+++ b/fastmcp_slim/fastmcp/utilities/skills.py@@ -2,22 +2,17 @@from __future__ import annotations+import base64import json-import warningsfrom dataclasses import dataclassfrom pathlib import Pathfrom typing import TYPE_CHECKINGimport mcp_types-from fastmcp._warnings import FastMCPDeprecationWarning-from fastmcp.utilities.logging import get_logger-if TYPE_CHECKING:from fastmcp.client import Client-logger = get_logger(__name__)-@dataclassclass SkillSummary:@@ -45,13 +40,11 @@ class SkillManifest:files: list[SkillFile]-async def list_skill_summaries(client: Client) -> list[SkillSummary]:- """List the skills a server publishes as resources.+async def list_skills(client: Client) -> list[SkillSummary]:+ """List all available skills from an MCP server.Discovers skills by finding resources with URIs matching the- `skill://{name}/SKILL.md` pattern, so it works with any server that- serves skills as resources. For the Skills extension's `skills/list`,- use `Client.list_skills()` with `SkillsClientExtension` instead.+ `skill://{name}/SKILL.md` pattern.Args:client: Connected FastMCP client@@ -62,10 +55,10 @@ async def list_skill_summaries(client: Client) -> list[SkillSummary]:Example:```pythonfrom fastmcp import Client- from fastmcp.utilities.skills import list_skill_summaries+ from fastmcp.utilities.skills import list_skillsasync with Client("http://skills-server/mcp") as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)for skill in skills:print(f"{skill.name}: {skill.description}")```@@ -91,22 +84,6 @@ async def list_skill_summaries(client: Client) -> list[SkillSummary]:return skills-async def list_skills(client: Client) -> list[SkillSummary]:- """Deprecated alias for `list_skill_summaries`.-- The name collided with `Client.list_skills()`, which sends the Skills- extension's `skills/list` request and returns different results.- """- warnings.warn(- "`fastmcp.utilities.skills.list_skills` is deprecated; use "- "`list_skill_summaries`. For Skills extension discovery, use "- "`Client.list_skills()` with `SkillsClientExtension`.",- FastMCPDeprecationWarning,- stacklevel=2,- )- return await list_skill_summaries(client)--async def get_skill_manifest(client: Client, skill_name: str) -> SkillManifest:"""Get the manifest for a specific skill.@@ -154,27 +131,22 @@ async def download_skill(*,overwrite: bool = False,) -> Path:- """Read a skill from the server and write it to a local directory.+ """Download a skill and all its files to a local directory.- Creates a subdirectory named after the skill containing all files. A- skill served at a nested path, such as a mounted server's `ops/deploy`,- is installed as `deploy`, since agents look for skill folders one level- deep. Every file is checked against the server's manifest before it is- written; see `Client.read_skill`.+ Creates a subdirectory named after the skill containing all files.Args:client: Connected FastMCP client- skill_name: Name or path of the skill to download+ skill_name: Name of the skill to downloadtarget_dir: Directory where skill folder will be created- overwrite: If True, replace an existing skill directory. If False+ overwrite: If True, overwrite existing skill directory. If False(default), raise FileExistsError if directory exists.Returns:Path to the downloaded skill directoryRaises:- ValueError: If the skill cannot be found, fails verification, or is- not a valid skill+ ValueError: If skill cannot be found or downloadedFileExistsError: If skill directory exists and overwrite=FalseExample:@@ -192,23 +164,56 @@ async def download_skill(```"""target_dir = Path(target_dir).expanduser().resolve()- segments = skill_name.split("/")- skill_dir = (target_dir / segments[-1]).resolve()+ skill_dir = (target_dir / skill_name).resolve()- # Security: reject relative segments and ensure skill_dir stays within target_dir- if any(segment in ("", ".", "..") for segment in segments) or (- not skill_dir.is_relative_to(target_dir)- ):+ # Security: ensure skill_dir stays within target_dir+ if not skill_dir.is_relative_to(target_dir):raise ValueError(f"Skill name {skill_name!r} would escape the target directory")+ # Check if directory existsif skill_dir.exists() and not overwrite:raise FileExistsError(f"Skill directory already exists: {skill_dir}. ""Use overwrite=True to replace.")- skill = await client.read_skill(f"skill://{skill_name}/SKILL.md")- return skill.to_directory(skill_dir, overwrite=overwrite)+ # Get manifest to know what files to download+ manifest = await get_skill_manifest(client, skill_name)++ # Create skill directory+ skill_dir.mkdir(parents=True, exist_ok=True)++ # Download each file+ for file_info in manifest.files:+ # Security: reject absolute paths and paths that escape skill_dir+ if Path(file_info.path).is_absolute():+ continue+ file_path = (skill_dir / file_info.path).resolve()+ if not file_path.is_relative_to(skill_dir):+ continue++ file_uri = f"skill://{skill_name}/{file_info.path}"+ result = await client.read_resource(file_uri)++ if not result:+ continue++ content = result[0]++ # Create parent directories if needed+ file_path.parent.mkdir(parents=True, exist_ok=True)++ # Write content+ if isinstance(content, mcp_types.TextResourceContents):+ # newline="" writes the served text as is, without CRLF translation.+ file_path.write_text(content.text, encoding="utf-8", newline="")+ elif isinstance(content, mcp_types.BlobResourceContents):+ file_path.write_bytes(base64.b64decode(content.blob))+ else:+ # Skip unknown content types+ continue++ return skill_dirasync def sync_skills(@@ -219,10 +224,6 @@ async def sync_skills() -> list[Path]:"""Download all available skills from a server.- Each skill is installed in a folder named after it. When two skills share- a name, such as `ops/deploy` and `web/deploy`, only the first is- installed.-Args:client: Connected FastMCP clienttarget_dir: Directory where skill folders will be created@@ -241,20 +242,10 @@ async def sync_skills(print(f"Downloaded {len(paths)} skills")```"""- skills = await list_skill_summaries(client)+ skills = await list_skills(client)downloaded = []- installed_names: set[str] = set()for skill in skills:- folder_name = skill.name.rsplit("/", 1)[-1]- if folder_name in installed_names:- logger.warning(- "Skipping skill %r: a skill named %r was already installed",- skill.name,- folder_name,- )- continue- installed_names.add(folder_name)try:path = await download_skill(client, skill.name, target_dir, overwrite=overwritediff --git a/skills/fastmcp-server/SKILL.md b/skills/fastmcp-server/SKILL.mdindex 7b71de3f1..cbe2a46aa 100644--- a/skills/fastmcp-server/SKILL.md+++ b/skills/fastmcp-server/SKILL.md@@ -56,14 +56,14 @@ and hosting choices to determine configuration.When clients need a repeatable workflow across the server's capabilities,consider shipping a skill alongside those capabilities. Put task selection,operation sequencing, and recovery guidance in the skill; keep tool descriptions-focused on their individual contracts. Read the version-matched Skills Provider-and Experimental Skills Extension docs from the index before implementing it.-`SkillsDirectoryProvider` exposes skill files as resources; the experimental-extension adds `skills/list` and `skills/get` discovery. Check the installed-release and target host's support before selecting either interface. Discovery-does not activate a skill: verify that the host reads and uses it in the intended-workflow. The experimental extension currently requires directly registered-providers and does not support mounted or transformed skill sources.+focused on their individual contracts. Read the version-matched Skills docs from+the index before implementing it. `SkillsDirectoryProvider` and+`SkillCatalogProvider` serve skill files as resources and also answer the+experimental Skills extension's `skills/list` and `skills/get`. Check the+installed release and target host's support before relying on discovery.+Discovery does not activate a skill: verify that the host reads and uses it in+the intended workflow. Providers added with transforms are not discoverable;+mount a server instead.Verify the server through FastMCP's `Client`, which can connect directly to aserver instance for in-process testing. Check a representative operation, itsdiff --git a/tests/experimental/skills/README.md b/tests/experimental/skills/README.mddeleted file mode 100644index 43edee649..000000000--- a/tests/experimental/skills/README.md+++ /dev/null@@ -1,45 +0,0 @@-# Experimental Skills validation--This experiment targets the stable Skills extension at-`modelcontextprotocol/ext-skills@e083f6d` and builds on FastMCP PR #5057.-It opts the existing `SkillsDirectoryProvider` into filesystem publication and-standard discovery through `experimental_skills=True` and the single-`SkillsExtension`. It does not implement-host activation or the optional directory-read method.--The October 16 review includes the upstream schema correction adding optional-`_meta` to skill entries. The additional directory-read cache requirements do not-apply because this implementation does not advertise directory reads.--The upstream conformance runner at-`modelcontextprotocol/conformance@c37eec888e1c6ff140af79987a40008548b7cc5f`-was run against an HTTP server with a real CRLF `SKILL.md` and supporting file:--```sh-node dist/index.js server --url http://127.0.0.1:18764/mcp \- --scenario sep-2640-skills-enumeration --spec-version 2026-07-28 --force-node dist/index.js server --url http://127.0.0.1:18764/mcp \- --scenario sep-2640-skills-manifest --spec-version 2026-07-28 --force-node dist/index.js server --url http://127.0.0.1:18764/mcp \- --scenario sep-2640-skills-directory --spec-version 2026-07-28 --force-```--Enumeration passed 32 checks. Manifest validation passed four checks with two-SHOULD-level warnings: resources retain their existing names (such as-`review/SKILL.md`) and FastMCP's standard `_meta.fastmcp` metadata instead of-switching to frontmatter names and the Skills-specific metadata prefix. The directory-scenario passed wire validation and skipped optional directory checks because-`directoryRead` is not advertised.--Local protocol tests cover both supporting-file publication modes, nested-skills, binary data, component and global middleware authorization, shared access-policies, additive legacy resources, URI aliases, resource shadowing, duplicate-identities, malformed frontmatter, cache refresh, and nonregular files. Snapshot-tests also verify duplicate YAML keys, recursive aliases, JSON-incompatible-values, raw byte digests, symlinks, and unreadable path rejection.--Lookup scaling tests instrument real filesystem operations in both publication-modes. Listing visits the collection twice and scans each skill twice, independent-of its number of supporting files. A single lookup scans and hashes only the-requested skill, and a resource read performs no recursive scans. The tests also-verify that a newly added skill is immediately addressable.diff --git a/tests/experimental/skills/__init__.py b/tests/experimental/skills/__init__.pydeleted file mode 100644index 09ddb4386..000000000--- a/tests/experimental/skills/__init__.py+++ /dev/null@@ -1 +0,0 @@-"""Tests for experimental filesystem skills."""diff --git a/tests/experimental/skills/test_lookup_scaling.py b/tests/experimental/skills/test_lookup_scaling.pydeleted file mode 100644index a3d09484b..000000000--- a/tests/experimental/skills/test_lookup_scaling.py+++ /dev/null@@ -1,78 +0,0 @@-from __future__ import annotations--from pathlib import Path-from typing import Literal--import pytest--from fastmcp import Client, FastMCP-from fastmcp.server.providers.skills import SkillsDirectoryProvider-from fastmcp.skills import SkillsClientExtension-from fastmcp.skills.extension import SkillsExtension--[email protected]("mode", ["template", "resources"])-async def test_discovery_work_scales_with_requested_files(- tmp_path: Path,- monkeypatch: pytest.MonkeyPatch,- mode: Literal["template", "resources"],-):- for index in range(20):- directory = tmp_path / f"skill-{index}"- directory.mkdir()- (directory / "SKILL.md").write_text(- f"---\nname: skill-{index}\ndescription: Test skill\n---\n"- )- for file_index in range(4):- (directory / f"file-{file_index}.txt").write_text("supporting file")-- scans: list[Path] = []- reads: list[Path] = []- original_rglob = Path.rglob- original_read_bytes = Path.read_bytes-- def counted_rglob(path, *args, **kwargs):- scans.append(path)- return original_rglob(path, *args, **kwargs)-- def counted_read_bytes(path):- reads.append(path)- return original_read_bytes(path)-- provider = SkillsDirectoryProvider(- tmp_path, experimental_skills=True, supporting_files=mode- )- server = FastMCP("Skills", providers=[provider])- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- with monkeypatch.context() as instrumentation:- instrumentation.setattr(Path, "rglob", counted_rglob)- instrumentation.setattr(Path, "read_bytes", counted_read_bytes)- entries = await client.list_skills()- assert len(entries) == 20- assert len(scans) <= 2 + 2 * len(entries)- assert len(reads) == 100-- scans.clear()- reads.clear()- entry = await client.get_skill("skill://skill-0/SKILL.md")- assert entry.uri == "skill://skill-0/SKILL.md"- assert len(scans) <= 2- assert len(reads) == 5- assert all(path.parent == tmp_path / "skill-0" for path in reads)-- scans.clear()- contents = await client.read_resource("skill://skill-0/file-0.txt")- assert contents[0].text == "supporting file"- assert scans == []-- added = tmp_path / "added"- added.mkdir()- (added / "SKILL.md").write_text(- "---\nname: added\ndescription: Added live\n---\n"- )- assert (- await client.get_skill("skill://added/SKILL.md")- ).frontmatter.name == "added"diff --git a/tests/experimental/skills/test_opt_in.py b/tests/experimental/skills/test_opt_in.pydeleted file mode 100644index bbdc896ac..000000000--- a/tests/experimental/skills/test_opt_in.py+++ /dev/null@@ -1,74 +0,0 @@-from pathlib import Path-from typing import Any--import pytest--from fastmcp import Client, FastMCP-from fastmcp.server.providers.skills import SkillsDirectoryProvider-from fastmcp.skills import SkillsClientExtension-from fastmcp.skills.extension import SkillsExtension--[email protected]("explicit_default", [False, True])-async def test_default_provider_keeps_legacy_publication(- tmp_path: Path, explicit_default: bool-):- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_bytes(b"# No frontmatter\r\nLoose instructions\r\n")- kwargs: dict[str, Any] = {"experimental_skills": False} if explicit_default else {}- provider = SkillsDirectoryProvider(tmp_path, **kwargs)- server = FastMCP("Legacy skills", providers=[provider])- async with Client(server) as client:- resources = await client.list_resources()- assert {str(resource.uri) for resource in resources} == {- "skill://review/SKILL.md",- "skill://review/_manifest",- }- contents = await client.read_resource("skill://review/SKILL.md")- assert contents[0].text == "# No frontmatter\r\nLoose instructions\r\n"- assert client.server_capabilities is not None- assert "io.modelcontextprotocol/skills" not in (- client.server_capabilities.extensions or {}- )- with pytest.raises(ValueError, match="experimental_skills=True"):- server.add_extension(SkillsExtension(providers=[provider]))---def test_experimental_mode_requires_standard_main_file(tmp_path: Path):- with pytest.raises(ValueError, match="main_file_name"):- SkillsDirectoryProvider(- tmp_path, main_file_name="README.md", experimental_skills=True- )---async def test_experimental_discovery_is_additive_to_resources(tmp_path: Path):- directory = tmp_path / "review"- directory.mkdir()- (directory / "SKILL.md").write_bytes(b"# Permissive existing skill\n")- (directory / "notes.txt").write_text("supporting content")- provider = SkillsDirectoryProvider(tmp_path, experimental_skills=True)- server = FastMCP("Skills", providers=[provider])- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert {str(resource.uri) for resource in await client.list_resources()} == {- "skill://review/SKILL.md",- "skill://review/_manifest",- }- assert (await client.read_resource("skill://review/SKILL.md"))[- 0- ].text == "# Permissive existing skill\n"- assert (await client.read_resource("skill://review/notes.txt"))[- 0- ].text == "supporting content"- assert (- "notes.txt"- in (await client.read_resource("skill://review/_manifest"))[0].text- )- assert await client.list_skills() == []- (directory / "SKILL.md").write_text(- "---\nname: review\ndescription: Review code\n---\n"- )- assert len(await client.list_skills()) == 1diff --git a/tests/experimental/skills/test_provider.py b/tests/experimental/skills/test_provider.pydeleted file mode 100644index 007161204..000000000--- a/tests/experimental/skills/test_provider.py+++ /dev/null@@ -1,349 +0,0 @@-from __future__ import annotations--import base64-import hashlib-import sys-from pathlib import Path-from typing import Literal--import pytest-from mcp.shared.exceptions import MCPError-from mcp_types import INVALID_PARAMS, BlobResourceContents, TextResourceContents--from fastmcp import Client, FastMCP-from fastmcp.exceptions import AuthorizationError-from fastmcp.server.middleware import Middleware-from fastmcp.server.middleware.caching import ResponseCachingMiddleware-from fastmcp.server.providers.skills import SkillsDirectoryProvider-from fastmcp.skills import SkillsClientExtension-from fastmcp.skills.extension import SkillsExtension--[email protected]("mode", ["template", "resources"])-async def test_filesystem_skills_round_trip(- tmp_path: Path, mode: Literal["template", "resources"]-):- root = tmp_path / "team" / "review"- root.mkdir(parents=True)- (root / "SKILL.md").write_bytes(- b"---\r\nname: review\r\ndescription: Review changes\r\n---\r\n# Review\r\n"- )- (root / "notes.md").write_bytes(b"line one\r\nline two\r\n")- (root / "image.bin").write_bytes(b"\x00\xff\r\n")- nested = root / "child"- nested.mkdir()- (nested / "SKILL.md").write_text(- "---\nname: child\ndescription: Child skill\n---\n"- )- provider = SkillsDirectoryProvider(- tmp_path, experimental_skills=True, supporting_files=mode- )- server = FastMCP("Skills")- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- entries = await client.list_skills()- assert [entry.uri for entry in entries] == [- "skill://team/review/SKILL.md",- "skill://team/review/child/SKILL.md",- ]- for entry in entries:- assert await client.get_skill(entry.uri) == entry- assert isinstance(entry.resources, list)- for record in entry.resources:- contents = await client.read_resource(record.uri)- assert len(contents) == 1- content = contents[0]- if isinstance(content, TextResourceContents):- data = content.text.encode()- else:- assert isinstance(content, BlobResourceContents)- data = base64.b64decode(content.blob)- assert len(data) == record.size- assert f"sha256:{hashlib.sha256(data).hexdigest()}" == record.digest---async def test_shadowed_supporting_file_hides_entire_skill(tmp_path: Path):- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review code\n---\n")- (root / "notes.md").write_text("original")- provider = SkillsDirectoryProvider(tmp_path, experimental_skills=True)- server = FastMCP("Skills")- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))-- @server.resource("skill://review/notes.md")- def shadow() -> str:- return "different bytes"-- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert await client.list_skills() == []- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://review/SKILL.md")---async def test_cache_does_not_hide_file_changes(tmp_path: Path):- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review code\n---\n")- notes = root / "notes.md"- notes.write_text("before")- provider = SkillsDirectoryProvider(tmp_path, experimental_skills=True)- server = FastMCP("Skills", middleware=[ResponseCachingMiddleware()])- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- before = await client.read_resource("skill://review/notes.md")- assert before[0].text == "before"- notes.write_text("after")- entry = await client.get_skill("skill://review/SKILL.md")- after = await client.read_resource("skill://review/notes.md")- assert after[0].text == "after"- assert isinstance(entry.resources, list)- record = next(- record for record in entry.resources if record.uri.endswith("notes.md")- )- assert record.digest == f"sha256:{hashlib.sha256(b'after').hexdigest()}"--[email protected]("mode", ["template", "resources"])-async def test_denied_supporting_component_hides_skill(- tmp_path: Path, mode: Literal["template", "resources"]-):- class RestrictedProvider(SkillsDirectoryProvider):- async def _get_resource(self, uri, version=None):- resource = await super()._get_resource(uri, version)- if resource is not None and uri.endswith("notes.md"):- resource.auth = lambda context: False- return resource-- async def _get_resource_template(self, uri, version=None):- template = await super()._get_resource_template(uri, version)- if template is not None:- template.auth = lambda context: False- return template-- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review code\n---\n")- (root / "notes.md").write_text("private")- provider = RestrictedProvider(- tmp_path, experimental_skills=True, supporting_files=mode- )- server = FastMCP("Skills")- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert await client.list_skills() == []- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://review/SKILL.md")---async def test_duplicate_and_malformed_skills_leave_unrelated_entries(tmp_path: Path):- roots = [tmp_path / "one", tmp_path / "two"]- for root in roots:- directory = root / "review"- directory.mkdir(parents=True)- (directory / "SKILL.md").write_text(- "---\nname: review\ndescription: Review code\n---\n"- )- good = roots[0] / "other"- good.mkdir()- (good / "SKILL.md").write_text(- "---\nname: other\ndescription: Another skill\n---\n"- )- bad = roots[0] / "invalid"- bad.mkdir()- (bad / "SKILL.md").write_bytes(b"\xff")- provider = SkillsDirectoryProvider(roots, experimental_skills=True)- server = FastMCP("Skills")- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert [entry.uri for entry in await client.list_skills()] == [- "skill://other/SKILL.md"- ]---async def test_denied_main_cannot_fall_back_to_template(tmp_path: Path):- class RestrictedProvider(SkillsDirectoryProvider):- async def _get_resource(self, uri, version=None):- resource = await super()._get_resource(uri, version)- if resource is not None:- resource.auth = lambda context: False- return resource-- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text(- "---\nname: review\ndescription: Private skill\n---\nsecret"- )- provider = RestrictedProvider(tmp_path, experimental_skills=True)- server = FastMCP("Skills")- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert await client.list_skills() == []- with pytest.raises(MCPError):- await client.get_skill("skill://review/SKILL.md")- for uri in (- "skill://review/SKILL.md",- "skill://review/SK%49LL.md",- "skill://review/%53KILL.md",- "skill://review/./SKILL.md",- "skill://review//SKILL.md",- "skill://review/child/../SKILL.md",- ):- with pytest.raises(MCPError):- await client.read_resource(uri)--[email protected]("local_duplicate", [False, True])-async def test_duplicate_identities_across_providers_are_omitted(- tmp_path: Path, local_duplicate: bool-):- providers = []- for name in ("one", "two"):- root = tmp_path / name / "review"- root.mkdir(parents=True)- (root / "SKILL.md").write_text(f"---\nname: review\ndescription: {name}\n---\n")- providers.append(SkillsDirectoryProvider(root.parent, experimental_skills=True))- if local_duplicate:- providers[0] = SkillsDirectoryProvider(- [tmp_path / "one", tmp_path / "one"], experimental_skills=True- )- server = FastMCP("Skills")- for provider in providers:- server.add_provider(provider)- server.add_extension(SkillsExtension(providers=providers))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- assert await client.list_skills() == []- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://review/SKILL.md")--[email protected]("mode", ["template", "resources"])[email protected]("deny_main", [False, True])-async def test_global_resource_authorization_hides_skill(- tmp_path: Path, mode: Literal["template", "resources"], deny_main: bool-):- from fastmcp.server.middleware.authorization import AuthMiddleware-- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text(- "---\nname: review\ndescription: Private instructions\n---\n"- )- (root / "notes.md").write_text("private supporting file")- denied = {"review/SKILL.md"} if deny_main else {"review/notes.md", "review_files"}- provider = SkillsDirectoryProvider(- tmp_path, supporting_files=mode, experimental_skills=True- )- server = FastMCP(- "Skills",- providers=[provider],- middleware=[AuthMiddleware(auth=lambda ctx: ctx.component.name not in denied)],- )- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- with pytest.raises(MCPError):- await client.read_resource(- "skill://review/SKILL.md" if deny_main else "skill://review/notes.md"- )- assert await client.list_skills() == []- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://review/SKILL.md")- denied.clear()- assert len(await client.list_skills()) == 1- assert (- await client.get_skill("skill://review/SKILL.md")- ).frontmatter.name == "review"--[email protected]("mode", ["template", "resources"])-async def test_shared_access_policy_controls_reads_and_skill_metadata(- tmp_path: Path, mode-):- blocked = {"skill://review/notes.md"}-- class ResourcePolicy(Middleware):- async def check_resource_access(self, context):- if str(context.message.uri) in blocked:- raise AuthorizationError("Private supporting file")-- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review code\n---\n")- (root / "notes.md").write_text("private")- provider = SkillsDirectoryProvider(- tmp_path, experimental_skills=True, supporting_files=mode- )- server = FastMCP("Skills", providers=[provider], middleware=[ResourcePolicy()])- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- with pytest.raises(MCPError, match="Private supporting file"):- await client.read_resource("skill://review/notes.md")- assert await client.list_skills() == []- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://review/SKILL.md")- blocked.clear()- assert (await client.read_resource("skill://review/notes.md"))[- 0- ].text == "private"- assert len(await client.list_skills()) == 1- assert (- await client.get_skill("skill://review/SKILL.md")- ).frontmatter.name == "review"---async def test_unserved_supporting_file_is_invalid_params(tmp_path: Path):- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review\n---\n")- server = FastMCP("Skills")- server.add_provider(SkillsDirectoryProvider(tmp_path, experimental_skills=True))- async with Client(server) as client:- with pytest.raises(MCPError) as error:- await client.read_resource("skill://review/missing.txt")- assert error.value.error.code == INVALID_PARAMS--[email protected](sys.platform == "win32", reason="Symlinks need privileges")-async def test_symlinked_supporting_file_is_not_listed(tmp_path: Path):- root = tmp_path / "skills" / "review"- root.mkdir(parents=True)- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review\n---\n")- (root / "notes.txt").write_text("notes")- (root / "link.txt").symlink_to(root / "notes.txt")- server = FastMCP("Skills")- server.add_provider(- SkillsDirectoryProvider(- tmp_path / "skills", experimental_skills=True, supporting_files="resources"- )- )- async with Client(server) as client:- uris = {str(resource.uri) for resource in await client.list_resources()}- assert "skill://review/notes.txt" in uris- assert "skill://review/link.txt" not in uris- with pytest.raises(MCPError) as error:- await client.read_resource("skill://review/link.txt")- assert error.value.error.code == INVALID_PARAMSdiff --git a/tests/experimental/skills/test_resource_fallback.py b/tests/experimental/skills/test_resource_fallback.pydeleted file mode 100644index 281c5e09f..000000000--- a/tests/experimental/skills/test_resource_fallback.py+++ /dev/null@@ -1,80 +0,0 @@-import base64-import hashlib-import json-from pathlib import Path-from typing import Literal--import pytest-from mcp.shared.exceptions import MCPError-from mcp_types import BlobResourceContents, TextResourceContents--from fastmcp import Client, FastMCP-from fastmcp.server.providers.skills import SkillsDirectoryProvider-from fastmcp.skills import SkillsClientExtension-from fastmcp.skills.extension import SkillsExtension--[email protected]("mode", ["template", "resources"])- "main",- [- b"\xff\xfeNot UTF-8",- b"---\nname: invalid\ndescription: [one, two]\n---\nBody\n",- b"---\nname: invalid\ndescription: {nested: value}\n---\nBody\n",- ],- ids=["invalid-utf8", "list-description", "mapping-description"],-)-async def test_invalid_skill_remains_an_ordinary_resource(- tmp_path: Path, mode: Literal["template", "resources"], main: bytes-):- invalid = tmp_path / "invalid"- invalid.mkdir()- files = {"SKILL.md": main, "notes.txt": b"supporting\r\nbytes\n"}- for name, data in files.items():- (invalid / name).write_bytes(data)- valid = tmp_path / "valid"- valid.mkdir()- (valid / "SKILL.md").write_bytes(- b"---\nname: valid\ndescription: Valid neighbor\n---\n"- )- provider = SkillsDirectoryProvider(- tmp_path, experimental_skills=True, supporting_files=mode- )- server = FastMCP("Skills", providers=[provider])- server.add_extension(SkillsExtension(providers=[provider]))- async with Client(- server, mode="auto", extensions=[SkillsClientExtension()]- ) as client:- resources = {str(r.uri): r for r in await client.list_resources()}- assert "skill://invalid/SKILL.md" in resources- assert "skill://invalid/_manifest" in resources- assert "skill://valid/SKILL.md" in resources- assert isinstance(resources["skill://invalid/SKILL.md"].description, str)- if mode == "resources":- assert "skill://invalid/notes.txt" in resources- for name, expected in files.items():- content = (await client.read_resource(f"skill://invalid/{name}"))[0]- if isinstance(content, TextResourceContents):- actual = content.text.encode()- else:- assert isinstance(content, BlobResourceContents)- actual = base64.b64decode(content.blob)- assert actual == expected- manifest = (await client.read_resource("skill://invalid/_manifest"))[0]- assert isinstance(manifest, TextResourceContents)- manifest_data = json.loads(manifest.text)- manifest_data["files"].sort(key=lambda entry: entry["path"])- assert manifest_data == {- "skill": "invalid",- "files": [- {- "path": name,- "size": len(data),- "hash": f"sha256:{hashlib.sha256(data).hexdigest()}",- }- for name, data in sorted(files.items())- ],- }- assert [s.uri for s in await client.list_skills()] == ["skill://valid/SKILL.md"]- with pytest.raises(MCPError, match="Unknown skill URI"):- await client.get_skill("skill://invalid/SKILL.md")diff --git a/tests/experimental/skills/test_resources.py b/tests/experimental/skills/test_resources.pydeleted file mode 100644index 89bfdb3b7..000000000--- a/tests/experimental/skills/test_resources.py+++ /dev/null@@ -1,15 +0,0 @@-from __future__ import annotations--import os-from pathlib import Path--import pytest--from fastmcp.skills._resources import read_file--[email protected](not hasattr(os, "mkfifo"), reason="requires named pipes")-def test_fifo_is_rejected_without_blocking(tmp_path: Path):- os.mkfifo(tmp_path / "pipe")- with pytest.raises(ValueError, match="regular file"):- read_file(tmp_path, "pipe")diff --git a/tests/experimental/skills/test_snapshot.py b/tests/experimental/skills/test_snapshot.pydeleted file mode 100644index 994ff6b6a..000000000--- a/tests/experimental/skills/test_snapshot.py+++ /dev/null@@ -1,133 +0,0 @@-from __future__ import annotations--import hashlib-import sys-from pathlib import Path--import pytest--from fastmcp.skills import skill as skill_module-from fastmcp.skills._snapshot import parse_frontmatter, snapshot---def test_snapshot_preserves_raw_bytes_and_frontmatter(tmp_path: Path):- root = tmp_path / "review"- root.mkdir()- main = b"---\r\nname: review\r\ndescription: Review code\r\ncustom:\r\n enabled: true\r\n count: 2\r\n values: [null, 1.5, text]\r\n---\r\n# Review\r\n"- (root / "SKILL.md").write_bytes(main)- binary = b"\x00\xff\r\n"- (root / "data.bin").write_bytes(binary)- entry = snapshot(root, "team/review").entry- assert entry.frontmatter.root["custom"] == {- "enabled": True,- "count": 2,- "values": [None, 1.5, "text"],- }- assert isinstance(entry.resources, list)- assert sorted((r.uri, r.size, r.digest) for r in entry.resources) == [- (- f"skill://team/review/{name}",- len(content),- f"sha256:{hashlib.sha256(content).hexdigest()}",- )- for name, content in [("SKILL.md", main), ("data.bin", binary)]- ]---def test_snapshot_retains_backing_paths_for_encoded_nested_files(tmp_path: Path):- (tmp_path / "SKILL.md").write_bytes(- b"---\r\nname: review\r\ndescription: Review code\r\n---\r\n"- )- (tmp_path / "refs").mkdir()- supporting = tmp_path / "refs" / "100% #notes.md"- supporting.write_bytes(b"\x00\xff\r\n")-- snap = snapshot(tmp_path, "team/review")-- assert dict(snap.files) == {- "skill://team/review/SKILL.md": tmp_path / "SKILL.md",- "skill://team/review/refs/100%25%20%23notes.md": supporting,- }- assert isinstance(snap.entry.resources, list)- for resource in snap.entry.resources:- content = dict(snap.files)[resource.uri].read_bytes()- assert resource.size == len(content)- assert resource.digest == f"sha256:{hashlib.sha256(content).hexdigest()}"--- "extra",- [- "name: review",- "custom: {a: 1, a: 2}",- "custom: {1: value}",- "custom: 2026-10-12",- "custom: .nan",- "custom: .inf",- "custom: !!binary SGVsbG8=",- "custom: !!set {a: null}",- "custom: &cycle [*cycle]",- "custom: {a: &x 1, b: *x}",- "metadata: [author, version]",- ],-)-def test_rejects_lossy_or_invalid_frontmatter(extra: str):- data = f"---\nname: review\ndescription: Review code\n{extra}\n---\n".encode()- with pytest.raises(ValueError):- parse_frontmatter(data)---def test_snapshot_rejects_name_mismatch(tmp_path: Path):- (tmp_path / "SKILL.md").write_text(- "---\nname: review\ndescription: Review code\n---\n"- )- with pytest.raises(ValueError, match="must equal"):- snapshot(tmp_path, "other")--[email protected]("directory", [False, True])-def test_snapshot_rejects_symlinks(tmp_path: Path, directory: bool):- root = tmp_path / "review"- root.mkdir()- (root / "SKILL.md").write_text("---\nname: review\ndescription: Review code\n---\n")- target = tmp_path / "outside"- if directory:- target.mkdir()- else:- target.write_text("outside")- (root / "linked").symlink_to(target, target_is_directory=directory)- with pytest.raises(ValueError, match="symlink"):- snapshot(root, "review")--- sys.platform == "win32", reason="Colon paths are NTFS streams on Windows"-)-def test_rejects_paths_not_supported_by_resource_reader(tmp_path: Path):- (tmp_path / "SKILL.md").write_text(- "---\nname: review\ndescription: Review code\n---\n"- )- (tmp_path / "C:notes.md").write_text("unreadable")- with pytest.raises(ValueError):- snapshot(tmp_path, "review")---def test_frontmatter_tolerates_utf8_bom():- data = "\ufeff---\nname: review\ndescription: Review code\n---\n".encode()- assert parse_frontmatter(data).root["name"] == "review"--- ("limit", "value"),- [("MAX_SKILL_FILES", 1), ("MAX_SKILL_BYTES", 64)],-)-def test_snapshot_rejects_skills_over_spec_limits(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch, limit: str, value: int-):- (tmp_path / "SKILL.md").write_text(- "---\nname: review\ndescription: Review code\n---\n"- )- (tmp_path / "notes.md").write_bytes(b"x" * 64)- monkeypatch.setattr(skill_module, limit, value)- with pytest.raises(ValueError, match="skill"):- snapshot(tmp_path, "review")diff --git a/tests/server/providers/proxy/test_skills.py b/tests/server/providers/proxy/test_skills.pyindex 424229036..87a760845 100644--- a/tests/server/providers/proxy/test_skills.py+++ b/tests/server/providers/proxy/test_skills.py@@ -16,7 +16,6 @@ from fastmcp.server.middleware.authorization import AuthMiddlewarefrom fastmcp.server.middleware.caching import ResponseCachingMiddlewarefrom fastmcp.server.providers.aggregate import ProviderErrorStrategyfrom fastmcp.server.providers.proxy import ProxyClient, ProxyProvider-from fastmcp.server.providers.skills import SkillsDirectoryProviderfrom fastmcp.skills import Skill, SkillsClientExtensionfrom fastmcp.skills._constants import SKILLS_EXTENSION_IDfrom fastmcp.skills.extension import SkillsExtension@@ -81,19 +80,18 @@ async def test_forwards_backend_skills_without_reading_files() -> None:assert "# Review" in content.text-async def test_files_behind_a_backend_template_are_checked_without_reads(- tmp_path: Path,-) -> None:- folder = tmp_path / "review"- folder.mkdir()- (folder / "SKILL.md").write_bytes(- b"---\nname: review\ndescription: Review changes\n---\n# Review\n"- )- (folder / "notes.md").write_bytes(b"Read the diff first.\n")- upstream = FastMCP(- "backend",- providers=[SkillsDirectoryProvider(tmp_path, experimental_skills=True)],- )+async def test_files_behind_a_backend_template_are_checked_without_reads() -> None:+ class UnlistedNotes(SkillCatalogProvider):+ async def _list_resources(self):+ resources = await super()._list_resources()+ return [r for r in resources if not str(r.uri).endswith("/notes.md")]++ upstream = FastMCP("backend", providers=[UnlistedNotes([REVIEW])])++ @upstream.resource("skill://review/{path*}")+ def review_file(path: str) -> str:+ return REVIEW.files[path].decode()+reads = Reads()upstream.add_middleware(reads)diff --git a/tests/skills/test_composition.py b/tests/skills/test_composition.pyindex 83f745915..196c03742 100644--- a/tests/skills/test_composition.py+++ b/tests/skills/test_composition.py@@ -10,10 +10,9 @@ from mcp_types import BlobResourceContents, TextResourceContentsfrom fastmcp import Client, FastMCPfrom fastmcp.server.middleware.authorization import AuthMiddleware-from fastmcp.server.providers.skills import SkillsDirectoryProviderfrom fastmcp.server.transforms import Namespacefrom fastmcp.skills import MCPSkill, Skill, SkillsClientExtension-from fastmcp.skills.provider import SkillCatalogProvider+from fastmcp.skills.provider import SkillCatalogProvider, SkillsDirectoryProviderREVIEW = Skill(name="review",@@ -88,9 +87,7 @@ async def test_mounted_folder_skills_are_listed(tmp_path: Path):(folder / "refs" / "checklist.md").write_bytes(b"- tests\n")folders = FastMCP("Folders",- providers=[- SkillsDirectoryProvider(tmp_path / "skills", experimental_skills=True)- ],+ providers=[SkillsDirectoryProvider(tmp_path / "skills")],)parent = FastMCP("Parent")parent.mount(folders, namespace="ops")@@ -144,7 +141,7 @@ async def test_server_transforms_disable_discovery_without_failing_mount():assert len(await client.list_resources()) == 3-async def test_hidden_parent_resource_hides_mounted_template_file(tmp_path: Path):+async def test_hidden_parent_resource_hides_mounted_folder_file(tmp_path: Path):folder = tmp_path / "skills" / "deploy"folder.mkdir(parents=True)(folder / "SKILL.md").write_bytes(@@ -153,9 +150,7 @@ async def test_hidden_parent_resource_hides_mounted_template_file(tmp_path: Path(folder / "notes.md").write_bytes(b"- tests\n")folders = FastMCP("Folders",- providers=[- SkillsDirectoryProvider(tmp_path / "skills", experimental_skills=True)- ],+ providers=[SkillsDirectoryProvider(tmp_path / "skills")],)parent = FastMCP("Parent")diff --git a/tests/skills/test_deprecated_paths.py b/tests/skills/test_deprecated_paths.pynew file mode 100644index 000000000..fa46b8de3--- /dev/null+++ b/tests/skills/test_deprecated_paths.py@@ -0,0 +1,65 @@+"""`experimental_skills=True` now means the new provider; alpha-only helpers are gone."""++from __future__ import annotations++from pathlib import Path++import pytest++from fastmcp import Client, FastMCP+from fastmcp._warnings import FastMCPDeprecationWarning+from fastmcp.skills import Skill, SkillsClientExtension+from fastmcp.skills.extension import SkillsExtension+from fastmcp.skills.provider import SkillsDirectoryProvider++REVIEW = Skill(name="review", description="Review changes", instructions="# Review\n")+++async def test_experimental_skills_returns_the_replacement(tmp_path: Path):+ from fastmcp.server.providers.skills import (+ SkillsDirectoryProvider as OldDirectoryProvider,+ )++ REVIEW.to_directory(tmp_path / "review")+ # The 4.1 experimental setup, verbatim from its docs.+ mcp = FastMCP("Skills")+ with pytest.warns(FastMCPDeprecationWarning, match="experimental_skills") as record:+ skills = OldDirectoryProvider(tmp_path, experimental_skills=True)+ assert record[0].filename == __file__+ assert f"SkillsDirectoryProvider([{str(tmp_path)!r}])" in str(record[0].message)+ mcp.add_provider(skills)+ mcp.add_extension(SkillsExtension(providers=[skills]))++ assert isinstance(skills, SkillsDirectoryProvider)+ async with Client(mcp, extensions=[SkillsClientExtension()]) as client:+ (entry,) = await client.list_skills()+ assert entry.uri == "skill://review/SKILL.md"+++def test_experimental_skills_still_rejects_custom_main_file(tmp_path: Path):+ from fastmcp.server.providers.skills import (+ SkillsDirectoryProvider as OldDirectoryProvider,+ )++ with pytest.raises(ValueError, match="SKILL.md"):+ OldDirectoryProvider(+ tmp_path, main_file_name="README.md", experimental_skills=True+ )+++def test_alpha_only_helper_is_gone():+ import fastmcp.utilities.skills as helpers++ assert not hasattr(helpers, "list_skill_summaries")+++def test_experimental_skills_refuses_subclasses(tmp_path: Path):+ from fastmcp.server.providers.skills import (+ SkillsDirectoryProvider as OldDirectoryProvider,+ )++ class GuardedProvider(OldDirectoryProvider):+ pass++ with pytest.raises(TypeError, match="GuardedProvider"):+ GuardedProvider(tmp_path, experimental_skills=True)diff --git a/tests/skills/test_extension.py b/tests/skills/test_extension.pyindex fe6e75e2c..bb85ae327 100644--- a/tests/skills/test_extension.py+++ b/tests/skills/test_extension.py@@ -65,9 +65,6 @@ class MemorySkillProvider(Provider):}self.contexts: list[ServerRequestContext[Any, Any]] = []- def _validate_skill_source(self) -> None:- pass-async def _skill_uris(self, uri: str | None = None) -> Sequence[str]:return [key for key in self.addressable if uri is None or key == uri]diff --git a/tests/skills/test_frontmatter.py b/tests/skills/test_frontmatter.pynew file mode 100644index 000000000..dfe3fdd7d--- /dev/null+++ b/tests/skills/test_frontmatter.py@@ -0,0 +1,27 @@+from __future__ import annotations++import pytest++from fastmcp.skills._snapshot import parse_frontmatter+++ "extra",+ [+ "name: review",+ "custom: {a: 1, a: 2}",+ "custom: {1: value}",+ "custom: 2026-10-12",+ "custom: .nan",+ "custom: .inf",+ "custom: !!binary SGVsbG8=",+ "custom: !!set {a: null}",+ "custom: &cycle [*cycle]",+ "custom: {a: &x 1, b: *x}",+ "metadata: [author, version]",+ ],+)+def test_rejects_lossy_or_invalid_frontmatter(extra: str):+ data = f"---\nname: review\ndescription: Review code\n{extra}\n---\n".encode()+ with pytest.raises(ValueError):+ parse_frontmatter(data)diff --git a/tests/skills/test_provider.py b/tests/skills/test_provider.pyindex a54f3523c..97f06b5a0 100644--- a/tests/skills/test_provider.py+++ b/tests/skills/test_provider.py@@ -20,7 +20,6 @@ from fastmcp.skills import Skill, SkillsClientExtensionfrom fastmcp.skills.extension import SkillsExtensionfrom fastmcp.skills.models import MCPSkillfrom fastmcp.skills.provider import SkillCatalogProvider-from fastmcp.utilities.skills import list_skill_summaries, sync_skillsREVIEW = Skill(name="review",@@ -82,24 +81,16 @@ async def test_resources_work_without_the_extension():)manifest = json.loads(await read_bytes(client, "skill://review/_manifest"))assert {f["path"] for f in manifest["files"]} == set(REVIEW.files)- summaries = await list_skill_summaries(client)- assert [(s.name, s.description) for s in summaries] == [- ("review", "Review changes")- ]-async def test_sync_skills_installs_code_defined_skills(tmp_path: Path):+async def test_listed_skills_install_into_a_local_folder(tmp_path: Path):server = FastMCP("Skills", providers=[SkillCatalogProvider([REVIEW, DEPLOY])])- async with Client(server) as client:- await sync_skills(client, tmp_path)- # download_skill writes text files in text mode, so compare file sets and- # binary bytes rather than exact text bytes (Windows translates newlines).+ async with skills_client(server) as client:+ for entry in await client.list_skills():+ skill = await client.read_skill(entry.uri)+ skill.to_directory(tmp_path / skill.name)for skill in (REVIEW, DEPLOY):- installed = Skill.from_directory(tmp_path / skill.name)- assert installed.frontmatter == skill.frontmatter- assert set(installed.files) == set(skill.files)- review = Skill.from_directory(tmp_path / "review")- assert review.files["refs/logo.bin"] == REVIEW.files["refs/logo.bin"]+ assert Skill.from_directory(tmp_path / skill.name) == skillasync def test_load_skills_is_called_once_per_request():diff --git a/tests/skills/test_read_skill.py b/tests/skills/test_read_skill.pyindex 965847902..aed3b1e87 100644--- a/tests/skills/test_read_skill.py+++ b/tests/skills/test_read_skill.py@@ -14,12 +14,11 @@ from mcp.shared.exceptions import MCPErrorfrom mcp_types import INTERNAL_ERRORfrom fastmcp import Client, ClientGroup, FastMCP-from fastmcp.server.providers.skills import SkillProvider, SkillsDirectoryProviderfrom fastmcp.skills import Skill, SkillsClientExtensionfrom fastmcp.skills._constants import MAX_SKILL_BYTES, MAX_SKILL_FILESfrom fastmcp.skills.extension import SkillsExtensionfrom fastmcp.skills.models import MCPSkill, SkillFrontmatter, SkillResource-from fastmcp.skills.provider import SkillCatalogProvider+from fastmcp.skills.provider import SkillCatalogProvider, SkillsDirectoryProviderREVIEW = Skill(name="review",@@ -103,7 +102,7 @@ async def test_read_skill_handles_nested_paths_and_encoded_names():assert skill == quoted-async def test_read_skill_reads_from_a_legacy_folder_provider(tmp_path: Path):+async def test_read_skill_reads_from_a_folder_provider(tmp_path: Path):folder = tmp_path / "review"folder.mkdir()(folder / "SKILL.md").write_bytes(REVIEW.files["SKILL.md"])@@ -111,16 +110,11 @@ async def test_read_skill_reads_from_a_legacy_folder_provider(tmp_path: Path):(folder / "refs").mkdir()(folder / "refs" / "logo.bin").write_bytes(b"\x00\xff\r\n")- for provider in (- SkillProvider(folder),- SkillProvider(folder, supporting_files="resources"),- SkillsDirectoryProvider(tmp_path),- SkillsDirectoryProvider(tmp_path, experimental_skills=True),- ):- server = FastMCP("Skills", providers=[provider])- async with Client(server) as client:+ server = FastMCP("Skills", providers=[SkillsDirectoryProvider(tmp_path)])+ for client in (skills_client(server), Client(server)):+ async with client:skill = await client.read_skill("skill://review/SKILL.md")- assert skill == REVIEW, provider+ assert skill == REVIEWasync def test_read_skill_rejects_a_file_that_does_not_match_its_digest():diff --git a/tests/test_upgrade_from_v3.py b/tests/test_upgrade_from_v3.pyindex 2f076d055..cb5554631 100644--- a/tests/test_upgrade_from_v3.py+++ b/tests/test_upgrade_from_v3.py@@ -231,7 +231,7 @@ REMOVED_NAMES = [# old misspelled names renamed to Cacheable* (no alias) codespell:ignore("fastmcp.server.middleware.caching", "CachableToolResult"), # codespell:ignore("fastmcp.server.middleware.caching", "CachablePromptResult"), # codespell:ignore- # 3.0-era rename alias -> SkillsDirectoryProvider+ # 3.0-era rename alias -> fastmcp.skills.provider.SkillsDirectoryProvider("fastmcp.server.providers.skills", "SkillsProvider"),("fastmcp.server.providers", "SkillsProvider"),]diff --git a/tests/utilities/test_skills.py b/tests/utilities/test_skills.pyindex c0f285907..90c6f5726 100644--- a/tests/utilities/test_skills.py+++ b/tests/utilities/test_skills.py@@ -3,6 +3,7 @@from __future__ import annotationsimport base64+import jsonfrom pathlib import Pathfrom typing import cast@@ -10,7 +11,6 @@ import pytestfrom mcp_types import BlobResourceContents, TextResourceContentsfrom fastmcp import Client, FastMCP-from fastmcp._warnings import FastMCPDeprecationWarningfrom fastmcp.server.providers.skills import SkillsDirectoryProviderfrom fastmcp.utilities.skills import (SkillFile,@@ -18,7 +18,6 @@ from fastmcp.utilities.skills import (SkillSummary,download_skill,get_skill_manifest,- list_skill_summaries,list_skills,sync_skills,)@@ -54,11 +53,11 @@ def skills_dir(tmp_path: Path) -> Path:skills = tmp_path / "skills"skills.mkdir()+ # Create pdf-processing skillpdf_skill = skills / "pdf-processing"pdf_skill.mkdir()(pdf_skill / "SKILL.md").write_text("""----name: pdf-processingdescription: Process PDF documents---@@ -69,11 +68,11 @@ Instructions for PDF handling.)(pdf_skill / "reference.md").write_text("# Reference\n\nSome reference docs.")+ # Create code-review skillcode_skill = skills / "code-review"code_skill.mkdir()(code_skill / "SKILL.md").write_text("""----name: code-reviewdescription: Review code for quality---@@ -83,17 +82,10 @@ Instructions for reviewing code.""")+ # Create skill with nested filesnested_skill = skills / "nested-skill"nested_skill.mkdir()- (nested_skill / "SKILL.md").write_text(- """----name: nested-skill-description: Has nested files------# Nested-"""- )+ (nested_skill / "SKILL.md").write_text("# Nested\n\nHas nested files.")scripts = nested_skill / "scripts"scripts.mkdir()(scripts / "helper.py").write_text("# Helper script\nprint('hello')")@@ -109,18 +101,10 @@ def skills_server(skills_dir: Path) -> FastMCP:return mcp-class TestListSkillSummaries:- async def test_list_skills_is_a_deprecated_alias(self, skills_server: FastMCP):- async with Client(skills_server) as client:- with pytest.warns(FastMCPDeprecationWarning, match="list_skill_summaries"):- skills = await list_skills(client)- expected = await list_skill_summaries(client)-- assert skills == expected-+class TestListSkills:async def test_lists_available_skills(self, skills_server: FastMCP):async with Client(skills_server) as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)assert len(skills) == 3names = {s.name for s in skills}@@ -128,7 +112,7 @@ class TestListSkillSummaries:async def test_returns_skill_summary_objects(self, skills_server: FastMCP):async with Client(skills_server) as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)for skill in skills:assert isinstance(skill, SkillSummary)@@ -138,7 +122,7 @@ class TestListSkillSummaries:async def test_includes_descriptions(self, skills_server: FastMCP):async with Client(skills_server) as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)by_name = {s.name: s for s in skills}assert by_name["pdf-processing"].description == "Process PDF documents"@@ -147,7 +131,7 @@ class TestListSkillSummaries:async def test_empty_server_returns_empty_list(self):mcp = FastMCP("Empty")async with Client(mcp) as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)assert skills == []@@ -171,7 +155,7 @@ class TestListSkillSummaries:return "# Wrong suffix"async with Client(mcp) as client:- skills = await list_skill_summaries(client)+ skills = await list_skills(client)assert skills == [SkillSummary(@@ -285,6 +269,53 @@ class TestDownloadSkill:downloaded = (result / "SKILL.md").read_text()assert downloaded == original+ async def test_writes_text_resources_as_utf8(+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+ ):+ content = "Use the tool β then stop."+ manifest = {+ "skill": "unicode",+ "files": [+ {+ "path": "SKILL.md",+ "size": len(content.encode("utf-8")),+ "hash": "sha256:unicode",+ }+ ],+ }+ client = FakeResourceReader(+ {+ "skill://unicode/_manifest": [+ text_resource("skill://unicode/_manifest", json.dumps(manifest))+ ],+ "skill://unicode/SKILL.md": [+ text_resource("skill://unicode/SKILL.md", content)+ ],+ }+ )+ original_write_text = Path.write_text++ def locale_sensitive_write_text(+ path: Path,+ data: str,+ encoding: str | None = None,+ errors: str | None = None,+ newline: str | None = None,+ ) -> int:+ return original_write_text(+ path,+ data,+ encoding=encoding or "ascii",+ errors=errors,+ newline=newline,+ )++ monkeypatch.setattr(Path, "write_text", locale_sensitive_write_text)++ result = await download_skill(cast(Client, client), "unicode", tmp_path)++ assert (result / "SKILL.md").read_text(encoding="utf-8") == content+async def test_raises_if_exists_without_overwrite(self, skills_server: FastMCP, tmp_path: Path):@@ -309,28 +340,6 @@ class TestDownloadSkill:)assert (result / "SKILL.md").exists()- assert not (result / "old-file.txt").exists()-- async def test_rejects_a_file_that_does_not_match_the_manifest(- self, skills_server: FastMCP, skills_dir: Path, tmp_path: Path- ):- async with Client(skills_server) as client:- reference = skills_dir / "pdf-processing" / "reference.md"- reference.write_bytes(b"x" * len(reference.read_bytes()))- with pytest.raises(ValueError, match="does not match its manifest"):- await download_skill(client, "pdf-processing", tmp_path)- assert not (tmp_path / "pdf-processing").exists()-- async def test_downloads_binary_files(self, skills_dir: Path, tmp_path: Path):- data = b"\x00\x01binary data"- (skills_dir / "pdf-processing" / "data.bin").write_bytes(data)- server = FastMCP("Skills Server")- server.add_provider(SkillsDirectoryProvider(roots=skills_dir))-- async with Client(server) as client:- result = await download_skill(client, "pdf-processing", tmp_path)-- assert (result / "data.bin").read_bytes() == dataasync def test_expands_user_path(self, skills_server: FastMCP, tmp_path: Path):# This tests that ~ expansion works (though we can't actually test ~)@@ -339,6 +348,58 @@ class TestDownloadSkill:assert result.exists()+ async def test_skips_manifest_paths_that_escape_target(self, tmp_path: Path):+ manifest = {+ "skill": "malicious",+ "files": [+ {"path": "SKILL.md", "size": 6, "hash": "sha256:safe"},+ {"path": "../escape.txt", "size": 6, "hash": "sha256:escape"},+ {"path": "/absolute.txt", "size": 8, "hash": "sha256:absolute"},+ ],+ }++ client = FakeResourceReader(+ {+ "skill://malicious/_manifest": [+ text_resource("skill://malicious/_manifest", json.dumps(manifest))+ ],+ "skill://malicious/SKILL.md": [+ text_resource("skill://malicious/SKILL.md", "# Safe")+ ],+ }+ )++ result = await download_skill(cast(Client, client), "malicious", tmp_path)++ assert (result / "SKILL.md").read_text() == "# Safe"+ assert not (tmp_path / "escape.txt").exists()+ assert client.requested_uris == [+ "skill://malicious/_manifest",+ "skill://malicious/SKILL.md",+ ]++ async def test_downloads_blob_resources(self, tmp_path: Path):+ data = b"\x00\x01binary data"+ manifest = {+ "skill": "binary",+ "files": [{"path": "data.bin", "size": len(data), "hash": "sha256:data"}],+ }++ client = FakeResourceReader(+ {+ "skill://binary/_manifest": [+ text_resource("skill://binary/_manifest", json.dumps(manifest))+ ],+ "skill://binary/data.bin": [+ blob_resource("skill://binary/data.bin", data)+ ],+ }+ )++ result = await download_skill(cast(Client, client), "binary", tmp_path)++ assert (result / "data.bin").read_bytes() == data+class TestSyncSkills:async def test_downloads_all_skills(self, skills_server: FastMCP, tmp_path: Path):@@ -412,35 +473,3 @@ class TestPathTraversal:async with Client(skills_server) as client:with pytest.raises(ValueError, match="would escape the target directory"):await download_skill(client, malicious_name, target)---class TestMountedSkills:- @pytest.fixture- def mounted_server(self, skills_dir: Path) -> FastMCP:- parent = FastMCP("parent")- for namespace in ("ops", "web"):- child = FastMCP(namespace, providers=[SkillsDirectoryProvider(skills_dir)])- parent.mount(child, namespace=namespace)- return parent-- async def test_download_installs_nested_skill_by_name(- self, mounted_server: FastMCP, tmp_path: Path- ):- async with Client(mounted_server) as client:- path = await download_skill(client, "ops/pdf-processing", tmp_path)-- assert path == tmp_path / "pdf-processing"- assert (path / "SKILL.md").exists()-- async def test_sync_installs_first_of_colliding_names(- self, mounted_server: FastMCP, tmp_path: Path- ):- async with Client(mounted_server) as client:- results = await sync_skills(client, tmp_path)-- assert sorted(path.name for path in results) == [- "code-review",- "nested-skill",- "pdf-processing",- ]- assert not (tmp_path / "ops").exists()