Example MCP Request
A Responses API request to OpenAI with MCP tools enabled.MCP Server Authentication
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 toolheaders
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.