Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
356af86
1
Parent(s): fda17d2
Add ChatGPT doc
Browse files- docs/docs.json +2 -1
- docs/integrations/chatgpt.mdx +158 -0
- docs/integrations/claude-desktop.mdx +1 -1
docs/docs.json
CHANGED
|
@@ -124,9 +124,10 @@
|
|
| 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-desktop",
|
|
|
|
| 129 |
"integrations/gemini",
|
| 130 |
+
"integrations/openai",
|
| 131 |
"integrations/contrib"
|
| 132 |
]
|
| 133 |
},
|
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-desktop.mdx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
title: Claude Desktop + FastMCP
|
| 3 |
sidebarTitle: Claude Desktop
|
| 4 |
description: Call FastMCP servers from Claude Desktop
|
| 5 |
-
icon:
|
| 6 |
---
|
| 7 |
|
| 8 |
|
|
|
|
| 2 |
title: Claude Desktop + FastMCP
|
| 3 |
sidebarTitle: Claude Desktop
|
| 4 |
description: Call FastMCP servers from Claude Desktop
|
| 5 |
+
icon: message-smile
|
| 6 |
---
|
| 7 |
|
| 8 |
|