Aller au contenu
Skillpedia
Connecteurs (MCP)28k · #9867

fastmcp-server

Ce qu’il fait

Cette compétence guide l'écriture de serveurs MCP en Python avec la bibliothèque FastMCP. Elle s'adresse aux développeurs qui veulent que leurs outils d'IA exposent des outils, des ressources ou des prompts de manière standard.

Quand l’utiliser

  • ✓Quand vous voulez créer un nouveau serveur MCP en Python avec FastMCP.
  • ✓Quand vous devez ajouter des outils, des ressources ou des prompts à un serveur FastMCP existant.
  • ✓Quand vous voulez relire les schémas et définitions d'un serveur FastMCP pour détecter des problèmes.

Lien du skill

https://github.com/PrefectHQ/fastmcp/blob/main/docs/.mintlify/skills/fastmcp-server/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/PrefectHQ/fastmcp/blob/main/docs/.mintlify/skills/fastmcp-server/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Aide-moi à créer un petit serveur MCP en Python qui expose un outil permettant de consulter le statut d'une commande.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent vérifie la version de FastMCP de votre projet, lit la documentation correspondante et écrit le code du serveur. Les schémas des outils sont générés à partir des annotations de type Python et des descriptions.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Authoring MCP servers with FastMCP

Find the current API

Check the project's installed FastMCP version and dependency constraints. Fetch the documentation index and read the relevant pages for that version. The index includes versioned documentation; select /v3/ pages for FastMCP 3 and unversioned pages for FastMCP 4. Read individual pages through their .md URLs instead of loading llms-full.txt. For APIs newer than the installed release, check that release's source or signatures. Preserve the project's dependency constraints unless an upgrade is part of the request. For a new project, check the current stable release before choosing a dependency.

Use the standalone fastmcp package. Its API differs from mcp.server.fastmcp in the Python MCP SDK.

Author the server

Choose the MCP interface to suit what the server exposes: tools for callable operations, resources for addressable content, and prompts for reusable message templates. FastMCP derives tool schemas from Python annotations and descriptions; use Literal or enums for finite choices and Field descriptions for parameter semantics. SDK wrappers need to preserve signatures and docstrings, for example with functools.wraps, or discovery loses that information. Inspect the schema the client receives, especially after transforms or custom discovery rendering: requiredness, enum values, and nested fields can disappear from a summary.

Let the intended client tasks guide tool boundaries, descriptions, and result shape. Give clients enough context to use results and recover from errors. The right granularity depends on the service; generated API tools, custom tools, and compositions can all be appropriate.

For paginated or bounded results, expose whether the answer is complete and how to continue. An upstream failure is not an empty result. Return useful recovery information through tool errors rather than a successful-looking payload. Use ToolError, ResourceError, or PromptError from fastmcp.exceptions for intentional client-facing messages. With mask_error_details=True, ordinary exceptions such as ValueError lose their messages; do not put sensitive backend details in the explicit error types, whose messages remain visible.

When using tool search or code mode, make exact named operations discoverable and explain the execution contract: what persists between calls and what becomes the result. A short fetch/filter/return example can prevent repeated empty outputs. Check the installed implementation before describing that behavior.

Look up FastMCP's relevant facilities as needed: context and dependencies, lifespan, authentication, composition, and transports. Use the project's runtime 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.

Verify the server through FastMCP's Client, which can connect directly to a server instance for in-process testing. Check a representative operation, its client-visible schema and result, and a meaningful failure. For composed or transformed servers, verify the public names and URIs through the outer server, including resource references returned by prompts. Namespace transforms change component names and resource URIs, but do not rewrite URI text inside prompt messages. When a prompt must work both standalone and mounted, direct the client to discover the resource template instead of hardcoding the child's URI. Exercise the chosen transport when connection or deployment behavior is part of the change.

Evaluate agent workflows

When the task includes evaluating how agents use the server, test a representative workflow using the proj

Questions fréquentes

Quel paquet utilise-t-elle ?

Elle utilise le paquet Python autonome fastmcp, dont l'interface diffère de l'enveloppe fournie par le SDK MCP officiel.

Comment l'agent choisit-il la bonne version de l'API ?

Il vérifie la version installée dans le projet et lit la documentation de cette version.

Comment les schémas des outils sont-ils créés ?

FastMCP les construit à partir des annotations Python et des descriptions ; des indications de type et des docstrings claires comptent donc beaucoup.

Détails

Description originale de l’auteur

Build, extend, or review MCP servers with Python FastMCP, using documentation matched to the project's version.

repo: PrefectHQ/fastmcp

Popularité

Étoiles GitHub
28k
Position au classement
#9867
Licence
Apache-2.0
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires