mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 05:54:19 +02:00
Add CLAUDE.md with FastMCP development guidelines
Establishes preference for in-memory transport when testing/investigating FastMCP servers, and recommends StreamableHttp over SSE for HTTP transport needs. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bed24d20cd
commit
3ce613b43a
1 changed files with 30 additions and 0 deletions
30
CLAUDE.md
Normal file
30
CLAUDE.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# FastMCP Development Guidelines
|
||||
|
||||
## Testing and Investigation
|
||||
|
||||
### In-Memory Transport - Always Preferred
|
||||
|
||||
When testing or investigating FastMCP servers, **always prefer the in-memory transport** unless you specifically need HTTP transport features. Pass a FastMCP server directly to a Client to eliminate separate processes and network complexity.
|
||||
|
||||
```python
|
||||
# Create your FastMCP server
|
||||
mcp = FastMCP("TestServer")
|
||||
|
||||
@mcp.tool
|
||||
def greet(name: str) -> str:
|
||||
return f"Hello, {name}!"
|
||||
|
||||
# Pass server directly to client - uses in-memory transport
|
||||
async with Client(mcp) as client:
|
||||
result = await client.call_tool("greet", {"name": "World"})
|
||||
```
|
||||
|
||||
### When to Use HTTP Transport
|
||||
|
||||
Only use HTTP transport when testing network-specific features. Prefer StreamableHttp over SSE as it's the modern approach.
|
||||
|
||||
```python
|
||||
# Only when network testing is required
|
||||
async with Client(transport=StreamableHttpTransport(server_url)) as client:
|
||||
result = await client.ping()
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue