Call the server from your code
Working examples for the Wigoo MCP server: the Vercel AI SDK, the OpenAI Responses API and the Anthropic Messages API, with what is tested and what is not.
This page shows four ways to use the server from code, so a model in your app can search plans and ask for quotes. Read the overview first if you are still choosing between them. The server needs no key, so only the model call needs a credential, and that one is yours.
What is tested. The program in the AI SDK section connects to the server, lists the tools and calls one, and the documentation's tests run it against the real server. The model calls on this page need an API key of the model vendor. The tests do not have one, so those requests are shown as the vendor documents them, checked against the vendor pages linked in each section on 18 November 2026, and are not run by our tests.
| Way | Who calls the tools | Section |
|---|---|---|
| The official TypeScript SDK | Your code | On the quickstart |
| The Vercel AI SDK | Your code, inside the SDK's tool loop | Below |
| The OpenAI Responses API | OpenAI, from the request | Below |
| The Anthropic Messages API | Anthropic, from the request | Below |
The official TypeScript SDK
The quickstart connects with @modelcontextprotocol/client and calls a tool, and test it goes on to a quote. Use that client when you write the tool loop yourself: list the tools, give them to your model, run the calls it asks for and return the results.
The Vercel AI SDK
The AI SDK has its own MCP client, in the @ai-sdk/mcp package, that turns the server's tools into AI SDK tools. This was checked against AI SDK 7 (ai 7.0.176 and @ai-sdk/mcp 2.0.101, the current releases on npm on 18 November 2026) and its MCP guide, Model Context Protocol (MCP).
npm install ai @ai-sdk/mcpThe first program needs no model. It connects over HTTP, lists the tools and calls search_destinations directly:
import { createMCPClient } from '@ai-sdk/mcp';
const mcp = await createMCPClient({
transport: { type: 'http', url: 'https://api.getwigoo.com/api/mcp' },
});
try {
const tools = await mcp.tools();
console.log(Object.keys(tools).join(', '));
const search = await tools.search_destinations.execute!(
{ query: 'Japan', currency: 'EUR' },
{ messages: [], toolCallId: 'search-1', context: {} },
);
// A tool result is the MCP result: the tool's JSON is the text of the first item.
const text = (search as { content: { text: string }[] }).content[0].text;
console.log(JSON.parse(text).destinations[0].name);
} finally {
await mcp.close();
}It prints the four tool names and Japan. Run it as a module, for example with npx tsx ai-sdk-tools.ts.
To let a model use the tools, pass them to generateText or streamText and allow more than one step, so the model can search, read the plans and then ask for the quote. The model is a model id string, as in the AI SDK's tool calling guide, or a provider model, and it needs that vendor's key. This part is not run by our tests:
import { generateText, isStepCount } from 'ai';
// `mcp` is the client created in the program above.
const { text } = await generateText({
model: 'anthropic/claude-sonnet-5.5',
tools: await mcp.tools(),
stopWhen: isStepCount(6),
system: 'You help travelers choose a data eSIM. Quote the price as about, and give the buy link unchanged.',
prompt: 'I am going to Japan for 10 days and need about 10 GB. Prices in euros.',
});
console.log(text);A few things from the AI SDK guide matter here. Close the client when the response is finished (with streamText, in its end callback). The HTTP transport rejects redirects by default, which is fine for this server because it does not redirect. Retries of tools/call are off unless you pass maxRetries to createMCPClient, and they are safe here because every tool is read-only. A tool result with isError: true goes back to the model as a result, and is not retried.
The OpenAI Responses API
OpenAI's Responses API can call a remote MCP server for you. Add an mcp tool to the request and OpenAI connects to the server, lists its tools and calls them during the response, and you never run a client. The request shape is from OpenAI's guide, MCP and connectors.
Send a POST to https://api.openai.com/v1/responses with Authorization: Bearer $OPENAI_API_KEY and a JSON body. In the body, choose a model from OpenAI's model list in place of MODEL_ID:
{
"model": "MODEL_ID",
"tools": [
{
"type": "mcp",
"server_label": "wigoo",
"server_description": "Wigoo travel eSIM catalog: destinations, plans, prices and buy links.",
"server_url": "https://api.getwigoo.com/api/mcp",
"require_approval": "never",
"allowed_tools": ["search_destinations", "get_destination", "list_plans", "get_quote"]
}
],
"input": "I am going to Japan for 10 days and need about 10 GB. Show prices in euros and give me the link to buy."
}- No authorization is needed, so there is no
authorizationfield. The server is public. require_approvalis"never"here because every tool is read-only. By default OpenAI asks for approval before data is shared with a server, and your app then has to answer each request, which is the right setting for servers that write.allowed_toolslimits the tools OpenAI imports. Leave it out to import all four.- The tool list is fetched once. OpenAI puts an
mcp_list_toolsitem in the response, and its guide says the list is not fetched again on later turns while that item stays in the conversation. Pass the previous output back as context to save the round trip.
The traveler's currency and language are not a setting of the tool. Say them in the input or the system instructions, and the model passes them as currency and language arguments.
The Anthropic Messages API
Anthropic's Messages API has an MCP connector: you name the server and a toolset in the request, and Anthropic connects and calls the tools. The request shape is from the MCP connector guide. The connector is a beta feature, so the request needs a beta header.
Send a POST to https://api.anthropic.com/v1/messages with these headers:
| Header | Value |
|---|---|
x-api-key | Your Anthropic API key |
anthropic-version | The API version the guide's examples use |
anthropic-beta | mcp-client-2025-11-20. The newer mcp-client-2026-09-15 includes it and also records and pins the server's tool list |
content-type | application/json |
The body names the server in mcp_servers and enables its tools with an mcp_toolset entry in tools. Choose a model from the guide's supported list in place of MODEL_ID:
{
"model": "MODEL_ID",
"max_tokens": 1500,
"messages": [
{
"role": "user",
"content": "I am going to Japan for 10 days and need about 10 GB. Show prices in euros and give me the link to buy."
}
],
"mcp_servers": [
{
"type": "url",
"url": "https://api.getwigoo.com/api/mcp",
"name": "wigoo"
}
],
"tools": [
{
"type": "mcp_toolset",
"mcp_server_name": "wigoo"
}
]
}- No
authorization_tokenis needed. The field is optional and the server is public. - The toolset enables every tool from the server by default. To limit it, the guide describes
default_configandconfigs, for example to switch everything off and enable only the tools you want. - The connector supports tool calls only, which is all this server has: no resources and no prompts.
- The server must be reachable over HTTPS from Anthropic. This one is.
Whichever you choose
Whatever calls the tools, the rules are the same: give the model the traveler's currency and language, let it read tool errors, show the price as a list price, and pass buy_url to the traveler unchanged. The checklist is in add eSIMs to your AI travel app, and what to do with the link is in hand the traveler to checkout.
Add eSIMs to your AI travel app
How to offer the right travel eSIM inside your own AI app with the Wigoo MCP server: two ways to wire it, when to offer it, what it shows and how the traveler pays.
Hand the traveler to checkout from your app
What your app does with the buy_url from get_quote: where to open it, what to keep, what the traveler sees, and what never to do.