fastmcp-integration
Examples and patterns for integrating FastMCP Cloud servers with Claude Agent SDK using HTTP transport
What this skill does
# FastMCP Cloud Integration Skill
This skill provides examples and troubleshooting for FastMCP Cloud integration.
## Critical Pattern: Use HTTP Transport
**FastMCP Cloud uses HTTP, NOT SSE!**
### ✅ Correct Configuration
**Example: Basic FastMCP Cloud Integration**
```python
import os
import asyncio
from dotenv import load_dotenv
from claude_agent_sdk import query
from claude_agent_sdk.types import ClaudeAgentOptions
load_dotenv()
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")
FASTMCP_CLOUD_API_KEY = os.getenv("FASTMCP_CLOUD_API_KEY")
async def main():
async for message in query(
prompt="List available tools from the MCP server",
options=ClaudeAgentOptions(
model="claude-sonnet-4-20250514",
# ✅ CRITICAL: Use HTTP for FastMCP Cloud
mcp_servers={
"your-server": {
"type": "http", # ← Must be "http" not "sse"
"url": "https://your-server.fastmcp.app/mcp",
"headers": {
"Authorization": f"Bearer {FASTMCP_CLOUD_API_KEY}"
}
}
},
# Allow MCP tools
allowed_tools=["mcp__your-server__*"],
# Pass API keys via env
env={
"ANTHROPIC_API_KEY": ANTHROPIC_API_KEY,
"FASTMCP_CLOUD_API_KEY": FASTMCP_CLOUD_API_KEY
}
)
):
if hasattr(message, 'type') and message.type == 'text':
print(message.text)
if __name__ == "__main__":
asyncio.run(main())
```
**Example: Multiple FastMCP Cloud Servers**
```python
mcp_servers={
"cats": {
"type": "http",
"url": "https://catsmcp.fastmcp.app/mcp",
"headers": {"Authorization": f"Bearer {FASTMCP_CLOUD_API_KEY}"}
},
"github": {
"type": "http",
"url": "https://github-mcp.fastmcp.app/mcp",
"headers": {"Authorization": f"Bearer {FASTMCP_CLOUD_API_KEY}"}
}
}
allowed_tools=[
"mcp__cats__*", # All CATS tools
"mcp__github__*", # All GitHub tools
]
```
**Example: Checking MCP Connection Status**
```python
async for message in query(...):
if hasattr(message, 'type') and message.type == 'system':
if hasattr(message, 'data') and 'mcp_servers' in message.data:
for server in message.data['mcp_servers']:
status = server.get('status', 'unknown')
name = server.get('name', 'unknown')
print(f"✅ MCP Server '{name}': {status}")
if status == 'failed':
print("❌ Connection failed!")
print(" Check: 1) Using 'type': 'http'")
print(" Check: 2) FASTMCP_CLOUD_API_KEY is valid")
print(" Check: 3) URL is correct")
```
### ❌ Common Mistakes
**Wrong transport type:**
```python
"type": "sse" # ❌ Doesn't work with FastMCP Cloud
```
**Missing API key:**
```python
# ❌ Not passing FASTMCP_CLOUD_API_KEY
env={"ANTHROPIC_API_KEY": ANTHROPIC_API_KEY}
```
**Wrong package:**
```python
from anthropic_agent_sdk import query # ❌ Wrong!
# Should be:
from claude_agent_sdk import query # ✅ Correct
```
## Troubleshooting
### Symptom: `'mcp_servers': [{'name': 'cats', 'status': 'failed'}]`
**Causes:**
1. Using `"type": "sse"` instead of `"type": "http"`
2. Missing or invalid `FASTMCP_CLOUD_API_KEY`
3. Wrong URL format
**Fix:**
- Change to `"type": "http"`
- Verify API key is correct and passed in `env` parameter
- Ensure URL is `https://your-server.fastmcp.app/mcp` (with `/mcp` endpoint)
### Symptom: `ImportError: No module named 'anthropic_agent_sdk'`
**Cause:** Wrong package name
**Fix:**
```bash
pip uninstall anthropic-agent-sdk # Remove wrong package
pip install claude-agent-sdk # Install correct package
```
## Complete Example
See `examples/python/fastmcp-cloud-http.py` for a full working example.
## Environment Variables
Required in `.env`:
```env
ANTHROPIC_API_KEY=sk-ant-api03-...
FASTMCP_CLOUD_API_KEY=fmcp_...
```
Must be passed via `env` parameter:
```python
env={
"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
"FASTMCP_CLOUD_API_KEY": os.getenv("FASTMCP_CLOUD_API_KEY")
}
```
## What The Output Actually Looks Like
### Example: Successful Connection
When you run your agent, you'll see system messages like this:
```python
# System message with connection status
SystemMessage(
subtype='init',
data={
'type': 'system',
'session_id': 'c8feee3e-bb62-4dcc-92bc-042b507e614a',
'mcp_servers': [{'name': 'cats', 'status': 'connected'}], # ✅ Connected!
'tools': ['mcp__cats__search_candidates', 'mcp__cats__get_candidate', ...],
'model': 'claude-sonnet-4-20250514',
...
}
)
```
**What this means:**
- `'status': 'connected'` ✅ - Your HTTP configuration worked!
- `'tools': [...]` - All 163 CATS tools are now available
- Agent can now use `mcp__cats__search_candidates`, etc.
### Example: Failed Connection
If you use wrong transport type, you'll see:
```python
SystemMessage(
data={
'mcp_servers': [{'name': 'cats', 'status': 'failed'}], # ❌ Failed!
'tools': ['Task', 'Bash', 'Read', ...], # Only built-in tools, no MCP tools
...
}
)
```
**What this means:**
- `'status': 'failed'` ❌ - Connection didn't work
- No `mcp__cats__*` tools available
- Common cause: Using `"type": "sse"` instead of `"type": "http"`
### Example: Tool Call
When Claude uses an MCP tool:
```python
# Claude decides to call search_candidates
AssistantMessage(
content=[
ToolUseBlock(
id='toolu_01HhvXi5wyvVa2DWtbP8KvJw',
name='mcp__cats__search_candidates',
input={'search_string': 'heavy duty mechanic'}
)
]
)
# Tool result comes back
UserMessage(
content=[
ToolResultBlock(
tool_use_id='toolu_01HhvXi5wyvVa2DWtbP8KvJw',
content='{"count":2,"total":3540,"_embedded":{"candidates":[...]}}'
)
]
)
# Claude responds with analysis
AssistantMessage(
content=[
TextBlock(
text="I found 3,540 heavy duty mechanic candidates. Here are the first 2..."
)
]
)
```
### Real Output From Working Demo
```
================================================================================
CATS Multi-Tool Agent Demo - Claude Agent SDK
================================================================================
🔌 MCP Server Status:
--------------------------------------------------------------------------------
✅ cats: CONNECTED
📦 Available CATS Tools: 163
- search_candidates
- get_candidate
- list_candidate_custom_fields
- list_candidate_attachments
- parse_resume
... and 158 more
💬 Claude:
--------------------------------------------------------------------------------
I'll search for heavy duty mechanics using the CATS database...
💬 Claude:
--------------------------------------------------------------------------------
I found 3,540 heavy duty mechanic candidates in the system. Here are the
first 2 results with their Red Seal certification status:
1. **Sahlan Samsuddin**
- Email: [email protected]
- Location: Mimika, Papua
- Red Seal Status: Not found in "Notes on Qualifications" field
- Tags: None
2. **[Next candidate]**
...
```
## Additional Examples
See the `examples/` directory in this skill:
- `examples/multi-server.py` - Connecting to multiple FastMCP Cloud servers
- `examples/connection-status.py` - Testing and troubleshooting connections
- `@plugins/claude-agent-sdk/examples/python/complete-example-with-output.py` - Full example with output
## Related Resources
- Basic example: `@plugins/claude-agent-sdk/examples/python/basic-query.py`
- FastMCP Cloud example: `@plugins/claude-agent-sdk/examples/python/fastmcp-cloud-http.py`
- Examples README: `@plugins/claude-agent-sdk/examples/README.md`
- Agent SDK Docs: `@plRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.