From 6503b79352fea43803293e95a5859f1e7485fba3 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Sun, 22 Jun 2025 15:44:46 -0400 Subject: [PATCH] Add claude code --- docs/docs.json | 1 + docs/integrations/claude-code.mdx | 60 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 docs/integrations/claude-code.mdx diff --git a/docs/docs.json b/docs/docs.json index 096d1ab80..c92615af0 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -125,6 +125,7 @@ "pages": [ "integrations/anthropic", "integrations/chatgpt", + "integrations/claude-code", "integrations/claude-desktop", "integrations/gemini", "integrations/openai", diff --git a/docs/integrations/claude-code.mdx b/docs/integrations/claude-code.mdx new file mode 100644 index 000000000..8727de5d5 --- /dev/null +++ b/docs/integrations/claude-code.mdx @@ -0,0 +1,60 @@ +--- +title: Claude Code + FastMCP +sidebarTitle: Claude Code +description: Connect FastMCP servers to Claude Code +icon: message-smile +tag: NEW +--- + +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. + + +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. + + + +Claude Code provides built-in MCP management commands to easily add, configure, and authenticate your FastMCP servers. + + +## Create a Server + +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. + +```python server.py +import random +from fastmcp import FastMCP + +mcp = FastMCP(name="Dice Roller") + +@mcp.tool +def roll_dice(n_dice: int) -> list[int]: + """Roll `n_dice` 6-sided dice and return the results.""" + return [random.randint(1, 6) for _ in range(n_dice)] + +if __name__ == "__main__": + mcp.run(transport="streamable-http", port=8000) +``` + +## Connect to Claude Code + +Start your server and add it to Claude Code: + +```bash +# Start your server first +python server.py +``` + +Then add it to Claude Code: +```bash +claude mcp add dice --transport http http://localhost:8000/mcp/ +``` + +## Using Your Server + +Once connected, Claude Code will automatically discover and use your server's tools when relevant: + +``` +Roll some dice for me +``` + +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`. \ No newline at end of file