Skip to content

Commit b212c7f

Browse files
add openai responses api
1 parent 61d6023 commit b212c7f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

fern/sdk/mcp-server.mdx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,52 @@ The Vapi MCP Server exposes these actions as MCP tools:
148148
```
149149

150150
</Tab>
151+
<Tab title="OpenAI responses API">
152+
<Note>
153+
The OpenAI <code>responses</code> API now supports MCP. <a href="https://platform.openai.com/docs/guides/tools-remote-mcp#page-top" target="_blank" rel="noopener">Read more here</a>.
154+
</Note>
155+
<CodeBlocks>
156+
```typescript title="typescript"
157+
import OpenAI from 'openai';
158+
// Replace with your actual OpenAI API key
159+
const openai = new OpenAI({ apiKey: 'YOUR_OPENAI_API_KEY' });
160+
async function main() {
161+
const response = await openai.responses.create({
162+
model: 'gpt-4.1',
163+
tools: [
164+
{
165+
type: 'mcp',
166+
server_label: 'vapi-mcp',
167+
server_url: 'https://mcp.vapi.ai/mcp',
168+
headers: { "Authorization": "Bearer YOUR_VAPI_API_KEY" }
169+
},
170+
],
171+
input: 'What vapi tools do you have available?',
172+
});
173+
console.dir(response, { depth: null });
174+
}
175+
main();
176+
```
177+
```python title="python"
178+
import openai
179+
# Replace with your actual OpenAI API key
180+
openai.api_key = 'YOUR_OPENAI_API_KEY'
181+
response = openai.responses.create(
182+
model="gpt-4.1",
183+
tools=[
184+
{
185+
"type": "mcp",
186+
"server_label": "vapi-mcp",
187+
"server_url": "https://mcp.vapi.ai/mcp",
188+
"headers": {"Authorization": "Bearer YOUR_VAPI_API_KEY"}
189+
},
190+
],
191+
input="What vapi tools do you have available?",
192+
)
193+
print(response)
194+
```
195+
</CodeBlocks>
196+
</Tab>
151197
<Tab title="Local">
152198
Run the MCP server on your own machine for development or testing.
153199

0 commit comments

Comments
 (0)