Jeremiah Lowin commited on
Commit
8e52c19
·
unverified ·
2 Parent(s): f9c77fe66a75db

Merge pull request #915 from jlowin/integrations

Browse files
docs/docs.json CHANGED
@@ -124,9 +124,11 @@
124
  "group": "Integrations",
125
  "pages": [
126
  "integrations/anthropic",
 
 
127
  "integrations/claude-desktop",
128
- "integrations/openai",
129
  "integrations/gemini",
 
130
  "integrations/contrib"
131
  ]
132
  },
 
124
  "group": "Integrations",
125
  "pages": [
126
  "integrations/anthropic",
127
+ "integrations/chatgpt",
128
+ "integrations/claude-code",
129
  "integrations/claude-desktop",
 
130
  "integrations/gemini",
131
+ "integrations/openai",
132
  "integrations/contrib"
133
  ]
134
  },
docs/integrations/anthropic.mdx CHANGED
@@ -31,7 +31,7 @@ def roll_dice(n_dice: int) -> list[int]:
31
  return [random.randint(1, 6) for _ in range(n_dice)]
32
 
33
  if __name__ == "__main__":
34
- mcp.run(transport="sse", port=8000)
35
  ```
36
 
37
  ## Deploy the Server
@@ -70,7 +70,7 @@ You'll also need to authenticate with Anthropic. You can do this by setting the
70
  export ANTHROPIC_API_KEY="your-api-key"
71
  ```
72
 
73
- Here is an example of how to call your server from Python. Note that you'll need to replace `https://your-server-url.com` with the actual URL of your server. In addition, we use `/sse` as the endpoint because we deployed an SSE server with the default path; you may need to use a different endpoint if you customized your server's deployment. **At this time you must also include the `extra_headers` parameter with the `anthropic-beta` header.**
74
 
75
  ```python {5, 13-22}
76
  import anthropic
@@ -88,7 +88,7 @@ response = client.beta.messages.create(
88
  mcp_servers=[
89
  {
90
  "type": "url",
91
- "url": f"{url}/sse",
92
  "name": "dice-server",
93
  }
94
  ],
@@ -175,7 +175,7 @@ def roll_dice(n_dice: int) -> list[int]:
175
 
176
  if __name__ == "__main__":
177
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
178
- mcp.run(transport="sse", port=8000)
179
  ```
180
 
181
  ### Client Authentication
@@ -213,7 +213,7 @@ response = client.beta.messages.create(
213
  mcp_servers=[
214
  {
215
  "type": "url",
216
- "url": f"{url}/sse",
217
  "name": "dice-server",
218
  "authorization_token": access_token
219
  }
 
31
  return [random.randint(1, 6) for _ in range(n_dice)]
32
 
33
  if __name__ == "__main__":
34
+ mcp.run(transport="streamable-http", port=8000)
35
  ```
36
 
37
  ## Deploy the Server
 
70
  export ANTHROPIC_API_KEY="your-api-key"
71
  ```
72
 
73
+ Here is an example of how to call your server from Python. Note that you'll need to replace `https://your-server-url.com` with the actual URL of your server. In addition, we use `/mcp/` as the endpoint because we deployed a streamable-HTTP server with the default path; you may need to use a different endpoint if you customized your server's deployment. **At this time you must also include the `extra_headers` parameter with the `anthropic-beta` header.**
74
 
75
  ```python {5, 13-22}
76
  import anthropic
 
88
  mcp_servers=[
89
  {
90
  "type": "url",
91
+ "url": f"{url}/mcp/",
92
  "name": "dice-server",
93
  }
94
  ],
 
175
 
176
  if __name__ == "__main__":
177
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
178
+ mcp.run(transport="streamable-http", port=8000)
179
  ```
180
 
181
  ### Client Authentication
 
213
  mcp_servers=[
214
  {
215
  "type": "url",
216
+ "url": f"{url}/mcp/",
217
  "name": "dice-server",
218
  "authorization_token": access_token
219
  }
docs/integrations/chatgpt.mdx ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ChatGPT + FastMCP
3
+ sidebarTitle: ChatGPT
4
+ description: Connect FastMCP servers to ChatGPT Deep Research
5
+ icon: message-smile
6
+ tag: NEW
7
+ ---
8
+
9
+ ChatGPT supports MCP servers through remote HTTP connections, allowing you to extend ChatGPT's capabilities with custom tools and knowledge from your FastMCP servers.
10
+
11
+ <Note>
12
+ MCP integration with ChatGPT is currently limited to **Deep Research** functionality and is not available for general chat. This feature is available for ChatGPT Pro, Team, Enterprise, and Edu users.
13
+ </Note>
14
+
15
+ <Tip>
16
+ OpenAI's official MCP documentation and examples are built with **FastMCP v2**! Check out their [sample MCP server](https://github.com/openai/mcp-server-sample) which demonstrates FastMCP in action.
17
+ </Tip>
18
+
19
+ ## Deep Research
20
+
21
+ ChatGPT's Deep Research feature requires MCP servers to be internet-accessible HTTP endpoints with **exactly two specific tools**:
22
+
23
+ - **`search`**: For searching through your resources and returning matching IDs
24
+ - **`fetch`**: For retrieving the full content of specific resources by ID
25
+
26
+ <Warning>
27
+ If your server doesn't implement both `search` and `fetch` tools with the correct signatures, ChatGPT will show the error: "This MCP server doesn't implement our specification". Both tools are required.
28
+ </Warning>
29
+
30
+ ### Tool Descriptions Matter
31
+
32
+ Since ChatGPT needs to understand how to use your tools effectively, **write detailed tool descriptions**. The description teaches ChatGPT how to form queries, what parameters to use, and what to expect from your data. Poor descriptions lead to poor search results.
33
+
34
+ ### Create a Server
35
+
36
+ A Deep Research-compatible server must implement these two required tools:
37
+
38
+ - **`search(query: str)`** - Takes a query of any kind and returns matching record IDs
39
+ - **`fetch(id: str)`** - Takes an ID and returns the record
40
+
41
+ **Critical**: Write detailed docstrings for both tools. These descriptions teach ChatGPT how to use your tools effectively. Poor descriptions lead to poor search results.
42
+
43
+ The `search` tool should take a query (of any kind!) and return IDs. The `fetch` tool should take an ID and return the record.
44
+
45
+ Here's a reference server implementation you can adapt (see also [OpenAI's sample server](https://github.com/openai/mcp-server-sample) for comparison):
46
+
47
+ ```python server.py [expandable]
48
+ import json
49
+ from pathlib import Path
50
+ from dataclasses import dataclass
51
+ from fastmcp import FastMCP
52
+
53
+ @dataclass
54
+ class Record:
55
+ id: str
56
+ title: str
57
+ text: str
58
+ metadata: dict
59
+
60
+ def create_server(
61
+ records_path: Path | str,
62
+ name: str | None = None,
63
+ instructions: str | None = None,
64
+ ) -> FastMCP:
65
+ """Create a FastMCP server that can search and fetch records from a JSON file."""
66
+ records = json.loads(Path(records_path).read_text())
67
+
68
+ RECORDS = [Record(**r) for r in records]
69
+ LOOKUP = {r.id: r for r in RECORDS}
70
+
71
+ mcp = FastMCP(name=name or "Deep Research MCP", instructions=instructions)
72
+
73
+ @mcp.tool()
74
+ async def search(query: str):
75
+ """
76
+ Simple unranked keyword search across title, text, and metadata.
77
+ Searches for any of the query terms in the record content.
78
+ Returns a list of matching record IDs for ChatGPT to fetch.
79
+ """
80
+ toks = query.lower().split()
81
+ ids = []
82
+ for r in RECORDS:
83
+ record_txt = " ".join(
84
+ [r.title, r.text, " ".join(r.metadata.values())]
85
+ ).lower()
86
+ if any(t in record_txt for t in toks):
87
+ ids.append(r.id)
88
+
89
+ return {"ids": ids}
90
+
91
+ @mcp.tool()
92
+ async def fetch(id: str):
93
+ """
94
+ Fetch a record by ID.
95
+ Returns the complete record data for ChatGPT to analyze and cite.
96
+ """
97
+ if id not in LOOKUP:
98
+ raise ValueError(f"Unknown record ID: {id}")
99
+ return LOOKUP[id]
100
+
101
+ return mcp
102
+
103
+ if __name__ == "__main__":
104
+ mcp = create_server("path/to/records.json")
105
+ mcp.run(transport="streamable-http", port=8000)
106
+ ```
107
+
108
+ ### Deploy the Server
109
+
110
+ Your server must be deployed to a public URL in order for ChatGPT to access it.
111
+
112
+ For development, you can use tools like `ngrok` to temporarily expose a locally-running server to the internet. We'll do that for this example (you may need to install `ngrok` and create a free account), but you can use any other method to deploy your server.
113
+
114
+ Assuming you saved the above code as `server.py`, you can run the following two commands in two separate terminals to deploy your server and expose it to the internet:
115
+
116
+ <CodeGroup>
117
+ ```bash FastMCP server
118
+ python server.py
119
+ ```
120
+
121
+ ```bash ngrok
122
+ ngrok http 8000
123
+ ```
124
+ </CodeGroup>
125
+
126
+ <Warning>
127
+ This exposes your unauthenticated server to the internet. Only run this command in a safe environment if you understand the risks.
128
+ </Warning>
129
+
130
+ ### Connect to ChatGPT
131
+
132
+ Replace `https://your-server-url.com` with the actual URL of your server (such as your ngrok URL).
133
+
134
+ 1. Open ChatGPT and go to **Settings** → **Connectors**
135
+ 2. Click **Add custom connector**
136
+ 3. Enter your server details:
137
+ - **Name**: Library Catalog
138
+ - **URL**: Your server URL (e.g., `https://abc123.ngrok.io`)
139
+ - **Description**: A library catalog for searching and retrieving books
140
+
141
+ #### Test the Connection
142
+
143
+ 1. Start a new chat in ChatGPT
144
+ 2. Click **Tools** → **Run deep research**
145
+ 3. Select your **Library Catalog** connector as a source
146
+ 4. Ask questions like:
147
+ - "Search for Python programming books"
148
+ - "Find books about AI and machine learning"
149
+ - "Show me books by the Python Software Foundation"
150
+
151
+ ChatGPT will use your server's search and fetch tools to find relevant information and cite the sources in its response.
152
+
153
+ ### Troubleshooting
154
+
155
+ #### "This MCP server doesn't implement our specification"
156
+
157
+
158
+ If you get this error, it most likely means that your server doesn't implement the required tools (`search` and `fetch`). To correct it, ensure that your server meets the service requirements.
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`.
docs/integrations/claude-desktop.mdx CHANGED
@@ -2,11 +2,15 @@
2
  title: Claude Desktop + FastMCP
3
  sidebarTitle: Claude Desktop
4
  description: Call FastMCP servers from Claude Desktop
5
- icon: desktop
6
  ---
7
 
8
 
9
- Claude Desktop supports MCP servers through local STDIO connections, allowing you to extend Claude's capabilities with custom tools, resources, and prompts from your FastMCP servers.
 
 
 
 
10
 
11
  <Note>
12
  This guide focuses specifically on using FastMCP servers with Claude Desktop. For general Claude Desktop MCP setup and official examples, see the [official Claude Desktop quickstart guide](https://modelcontextprotocol.io/quickstart/user).
@@ -15,10 +19,10 @@ This guide focuses specifically on using FastMCP servers with Claude Desktop. Fo
15
 
16
  ## Requirements
17
 
18
- Claude Desktop requires MCP servers to run locally using STDIO transport. This means your server will communicate with Claude through standard input/output rather than HTTP.
19
 
20
  <Tip>
21
- If you need to connect to remote servers, you can create a **proxy server** that runs locally via STDIO and forwards requests to remote HTTP servers. See the [Proxy Servers](#proxy-servers) section below.
22
  </Tip>
23
 
24
  ## Create a Server
@@ -181,7 +185,7 @@ Claude Desktop runs servers in a completely isolated environment with no access
181
  ## Remote Servers
182
 
183
 
184
- Claude Desktop only supports local STDIO servers, but FastMCP can create a proxy server that forwards requests to a remote HTTP server. You can install the proxy server in Claude Desktop.
185
 
186
  Create a proxy server that connects to a remote HTTP server:
187
 
 
2
  title: Claude Desktop + FastMCP
3
  sidebarTitle: Claude Desktop
4
  description: Call FastMCP servers from Claude Desktop
5
+ icon: message-smile
6
  ---
7
 
8
 
9
+ Claude Desktop supports MCP servers through local STDIO connections and remote servers (beta), allowing you to extend Claude's capabilities with custom tools, resources, and prompts from your FastMCP servers.
10
+
11
+ <Note>
12
+ Remote MCP server support is currently in beta and available for users on Claude Pro, Max, Team, and Enterprise plans (as of June 2025). Most users will still need to use local STDIO connections.
13
+ </Note>
14
 
15
  <Note>
16
  This guide focuses specifically on using FastMCP servers with Claude Desktop. For general Claude Desktop MCP setup and official examples, see the [official Claude Desktop quickstart guide](https://modelcontextprotocol.io/quickstart/user).
 
19
 
20
  ## Requirements
21
 
22
+ Claude Desktop traditionally requires MCP servers to run locally using STDIO transport, where your server communicates with Claude through standard input/output rather than HTTP. However, users on certain plans now have access to remote server support as well.
23
 
24
  <Tip>
25
+ If you don't have access to remote server support or need to connect to remote servers, you can create a **proxy server** that runs locally via STDIO and forwards requests to remote HTTP servers. See the [Proxy Servers](#proxy-servers) section below.
26
  </Tip>
27
 
28
  ## Create a Server
 
185
  ## Remote Servers
186
 
187
 
188
+ Users on Claude Pro, Max, Team, and Enterprise plans have first-class remote server support via integrations. For other users, or as an alternative approach, FastMCP can create a proxy server that forwards requests to a remote HTTP server. You can install the proxy server in Claude Desktop.
189
 
190
  Create a proxy server that connects to a remote HTTP server:
191
 
docs/integrations/gemini.mdx CHANGED
@@ -99,7 +99,7 @@ from fastmcp import Client
99
  from fastmcp.client.auth import BearerAuth
100
 
101
  mcp_client = Client(
102
- "https://my-server.com/sse",
103
  auth=BearerAuth("<your-token>"),
104
  )
105
  ```
 
99
  from fastmcp.client.auth import BearerAuth
100
 
101
  mcp_client = Client(
102
+ "https://my-server.com/mcp/",
103
  auth=BearerAuth("<your-token>"),
104
  )
105
  ```
docs/integrations/openai.mdx CHANGED
@@ -38,7 +38,7 @@ def roll_dice(n_dice: int) -> list[int]:
38
  return [random.randint(1, 6) for _ in range(n_dice)]
39
 
40
  if __name__ == "__main__":
41
- mcp.run(transport="sse", port=8000)
42
  ```
43
 
44
  ### Deploy the Server
@@ -77,7 +77,7 @@ You'll also need to authenticate with OpenAI. You can do this by setting the `OP
77
  export OPENAI_API_KEY="your-api-key"
78
  ```
79
 
80
- Here is an example of how to call your server from Python. Note that you'll need to replace `https://your-server-url.com` with the actual URL of your server. In addition, we use `/sse` as the endpoint because we deployed an SSE server with the default path; you may need to use a different endpoint if you customized your server's deployment.
81
 
82
  ```python {4, 11-16}
83
  from openai import OpenAI
@@ -93,7 +93,7 @@ resp = client.responses.create(
93
  {
94
  "type": "mcp",
95
  "server_label": "dice_server",
96
- "server_url": f"{url}/sse",
97
  "require_approval": "never",
98
  },
99
  ],
@@ -172,7 +172,7 @@ def roll_dice(n_dice: int) -> list[int]:
172
 
173
  if __name__ == "__main__":
174
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
175
- mcp.run(transport="sse", port=8000)
176
  ```
177
 
178
  #### Client Authentication
@@ -212,7 +212,7 @@ resp = client.responses.create(
212
  {
213
  "type": "mcp",
214
  "server_label": "dice_server",
215
- "server_url": f"{url}/sse",
216
  "require_approval": "never",
217
  "headers": {
218
  "Authorization": f"Bearer {access_token}"
 
38
  return [random.randint(1, 6) for _ in range(n_dice)]
39
 
40
  if __name__ == "__main__":
41
+ mcp.run(transport="streamable-http", port=8000)
42
  ```
43
 
44
  ### Deploy the Server
 
77
  export OPENAI_API_KEY="your-api-key"
78
  ```
79
 
80
+ Here is an example of how to call your server from Python. Note that you'll need to replace `https://your-server-url.com` with the actual URL of your server. In addition, we use `/mcp/` as the endpoint because we deployed a streamable-HTTP server with the default path; you may need to use a different endpoint if you customized your server's deployment.
81
 
82
  ```python {4, 11-16}
83
  from openai import OpenAI
 
93
  {
94
  "type": "mcp",
95
  "server_label": "dice_server",
96
+ "server_url": f"{url}/mcp/",
97
  "require_approval": "never",
98
  },
99
  ],
 
172
 
173
  if __name__ == "__main__":
174
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
175
+ mcp.run(transport="streamable-http", port=8000)
176
  ```
177
 
178
  #### Client Authentication
 
212
  {
213
  "type": "mcp",
214
  "server_label": "dice_server",
215
+ "server_url": f"{url}/mcp/",
216
  "require_approval": "never",
217
  "headers": {
218
  "Authorization": f"Bearer {access_token}"