60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""Example: Skills Provider Server
|
|
|
|
This example shows how to expose agent skills as MCP resources.
|
|
Skills can be discovered, browsed, and downloaded by any MCP client.
|
|
|
|
Run this server:
|
|
uv run python examples/skills/server.py
|
|
|
|
Then use the client example to interact with it:
|
|
uv run python examples/skills/client.py
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
from fastmcp import FastMCP
|
|
from fastmcp.server.providers.skills import (
|
|
SkillsDirectoryProvider,
|
|
)
|
|
|
|
# Create server
|
|
mcp = FastMCP("Skills Server")
|
|
|
|
# Option 1: Load a single skill
|
|
# mcp.add_provider(SkillProvider(Path.home() / ".claude/skills/pdf-processing"))
|
|
|
|
# Option 2: Load all skills from a custom directory
|
|
skills_dir = Path(__file__).parent / "sample_skills"
|
|
mcp.add_provider(SkillsDirectoryProvider(roots=skills_dir, reload=True))
|
|
|
|
# Option 3: Load skills from a platform's default location
|
|
# mcp.add_provider(ClaudeSkillsProvider()) # ~/.claude/skills/
|
|
|
|
# Option 4: Load from multiple directories (in precedence order)
|
|
# mcp.add_provider(SkillsDirectoryProvider(roots=[
|
|
# Path.cwd() / ".claude/skills", # Project-level first
|
|
# Path.home() / ".claude/skills", # User-level fallback
|
|
# ]))
|
|
|
|
# Other vendor providers available:
|
|
# - CursorSkillsProvider() → ~/.cursor/skills/
|
|
# - VSCodeSkillsProvider() → ~/.copilot/skills/
|
|
# - CodexSkillsProvider() → ~/.codex/skills/
|
|
# - GeminiSkillsProvider() → ~/.gemini/skills/
|
|
# - GooseSkillsProvider() → ~/.config/agents/skills/
|
|
# - CopilotSkillsProvider() → ~/.copilot/skills/
|
|
# - OpenCodeSkillsProvider() → ~/.config/opencode/skills/
|
|
|
|
if __name__ == "__main__":
|
|
mcp.run()
|