Obiguard’s AI gateway has MCP server support that many foundational model providers offer.
Model Context Protocol (MCP) is an open standard that defines how applications can provide tools and context to LLMs.
The MCP tool in the Responses API enables developers to grant models access to tools hosted on Remote MCP servers. These servers are managed by developers and organizations across the internet and make tools available to MCP clients, such as the Responses API.
Obiguard supports using MCP servers through the Responses API.
Making a request to a remote MCP server with the Responses API is simple.
For instance, you can use the DeepWiki MCP server to query nearly any public GitHub repository.
A Responses API request to OpenAI with MCP tools enabled.
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key="sk-obg-***", # Your Obiguard API key here)resp = client.responses.create( model="gpt-4.1", tools=[ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never", }, ], input="What transport protocols are supported in the 2025-03-26 version of the MCP spec?",)print(resp.output_text)
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key="sk-obg-***", # Your Obiguard API key here)resp = client.responses.create( model="gpt-4.1", tools=[ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never", }, ], input="What transport protocols are supported in the 2025-03-26 version of the MCP spec?",)print(resp.output_text)
Copy
from openai import OpenAIfrom obiguard import OBIGUARD_GATEWAY_URL, createHeadersclient = OpenAI( api_key="dummy", # Not used when using virtual keys base_url=OBIGUARD_GATEWAY_URL, default_headers=createHeaders( obiguard_api_key="vk_obg-***", # Your Obiguard virtual key here ))resp = client.responses.create( model="gpt-4.1", tools=[ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never", }, ], input="What transport protocols are supported in the 2025-03-26 version of the MCP spec?",)print(resp.output_text)
Copy
curl https://gateway.obiguard.ai/v1/responses \ -H "Content-Type: application/json" \ -H "x-obiguard-api-key: vk-obg***" \ # Your Obiguard API key here -d '{ "model": "gpt-4.1", "tools": [ { "type": "mcp", "server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/mcp", "require_approval": "never" } ], "input": "What transport protocols are supported in the 2025-03-26 version of the MCP spec?" }'
While the DeepWiki MCP server does not require authentication, most other MCP servers do.
The MCP tool in the Responses API allows you to specify custom headers for requests to remote MCP servers.
These headers can include API keys, OAuth tokens, or any other authentication method supported by the server.
The most commonly used header for authentication is the Authorization header.
Here is an example of how to include it:
Using the Stripe MCP tool
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key="sk-obg***", # Your Obiguard API key here)resp = client.responses.create( model="gpt-4.1", input="Create a payment link for $20", tools=[ { "type": "mcp", "server_label": "stripe", "server_url": "https://mcp.stripe.com", "headers": { "Authorization": "Bearer $STRIPE_API_KEY" } } ])print(resp.output_text)
Copy
from obiguard import Obiguardclient = Obiguard( obiguard_api_key="sk-obg***", # Your Obiguard API key here)resp = client.responses.create( model="gpt-4.1", input="Create a payment link for $20", tools=[ { "type": "mcp", "server_label": "stripe", "server_url": "https://mcp.stripe.com", "headers": { "Authorization": "Bearer $STRIPE_API_KEY" } } ])print(resp.output_text)
Copy
from openai import OpenAIfrom obiguard import OBIGUARD_GATEWAY_URL, createHeadersclient = OpenAI( api_key="dummy", # Not used when using virtual keys base_url=OBIGUARD_GATEWAY_URL, default_headers=createHeaders( obiguard_api_key="vk_obg-***", # Your Obiguard virtual key here ))resp = client.responses.create( model="gpt-4.1", tools=[ { "type": "mcp", "server_label": "stripe", "server_url": "https://mcp.stripe.com", "headers": { "Authorization": "Bearer $STRIPE_API_KEY" } }, ], input="What transport protocols are supported in the 2025-03-26 version of the MCP spec?",)print(resp.output_text)
Copy
curl https://gateway.obiguard.ai/v1/responses \ -H "Content-Type: application/json" \ -H "x-obiguard-api-key: vk-obg***" \ # Your Obiguard API key here -d '{ "model": "gpt-4.1", "input": "Create a payment link for $20", "tools": [ { "type": "mcp", "server_label": "stripe", "server_url": "https://mcp.stripe.com", "headers": { "Authorization": "Bearer $STRIPE_API_KEY" } } ]}'
To ensure sensitive keys remain secure, the Responses API does not store any string values provided in the headers object.
These values are also excluded from the created Response object.
Additionally, since some remote MCP servers generate authenticated URLs,
the path portion of the server_url is removed in responses (e.g., example.com/mcp becomes example.com).
As a result, you must include the full server_url path and any necessary headers in every Responses API creation request.
Assistant
Responses are generated using AI and may contain mistakes.