Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
66a75db
1
Parent(s): 356af86
Add claude code
Browse files- docs/docs.json +1 -0
- docs/integrations/claude-code.mdx +60 -0
docs/docs.json
CHANGED
|
@@ -125,6 +125,7 @@
|
|
| 125 |
"pages": [
|
| 126 |
"integrations/anthropic",
|
| 127 |
"integrations/chatgpt",
|
|
|
|
| 128 |
"integrations/claude-desktop",
|
| 129 |
"integrations/gemini",
|
| 130 |
"integrations/openai",
|
|
|
|
| 125 |
"pages": [
|
| 126 |
"integrations/anthropic",
|
| 127 |
"integrations/chatgpt",
|
| 128 |
+
"integrations/claude-code",
|
| 129 |
"integrations/claude-desktop",
|
| 130 |
"integrations/gemini",
|
| 131 |
"integrations/openai",
|
docs/integrations/claude-code.mdx
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Claude Code + FastMCP
|
| 3 |
+
sidebarTitle: Claude Code
|
| 4 |
+
description: Connect FastMCP servers to Claude Code
|
| 5 |
+
icon: message-smile
|
| 6 |
+
tag: NEW
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
Claude Code supports MCP servers through multiple transport methods, allowing you to extend Claude's capabilities with custom tools, resources, and prompts from your FastMCP servers.
|
| 10 |
+
|
| 11 |
+
<Note>
|
| 12 |
+
Claude Code supports both local and remote MCP servers with flexible configuration options. See the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for other transport methods.
|
| 13 |
+
</Note>
|
| 14 |
+
|
| 15 |
+
<Tip>
|
| 16 |
+
Claude Code provides built-in MCP management commands to easily add, configure, and authenticate your FastMCP servers.
|
| 17 |
+
</Tip>
|
| 18 |
+
|
| 19 |
+
## Create a Server
|
| 20 |
+
|
| 21 |
+
You can create FastMCP servers using STDIO transport, remote HTTP servers, or local HTTP servers. This example shows one common approach: running an HTTP server locally for development.
|
| 22 |
+
|
| 23 |
+
```python server.py
|
| 24 |
+
import random
|
| 25 |
+
from fastmcp import FastMCP
|
| 26 |
+
|
| 27 |
+
mcp = FastMCP(name="Dice Roller")
|
| 28 |
+
|
| 29 |
+
@mcp.tool
|
| 30 |
+
def roll_dice(n_dice: int) -> list[int]:
|
| 31 |
+
"""Roll `n_dice` 6-sided dice and return the results."""
|
| 32 |
+
return [random.randint(1, 6) for _ in range(n_dice)]
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
mcp.run(transport="streamable-http", port=8000)
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Connect to Claude Code
|
| 39 |
+
|
| 40 |
+
Start your server and add it to Claude Code:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
# Start your server first
|
| 44 |
+
python server.py
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Then add it to Claude Code:
|
| 48 |
+
```bash
|
| 49 |
+
claude mcp add dice --transport http http://localhost:8000/mcp/
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Using Your Server
|
| 53 |
+
|
| 54 |
+
Once connected, Claude Code will automatically discover and use your server's tools when relevant:
|
| 55 |
+
|
| 56 |
+
```
|
| 57 |
+
Roll some dice for me
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Claude will call your `roll_dice` tool and provide the results. If your server provides resources, you can reference them with `@` mentions like `@dice:file://path/to/resource`.
|