What Is MCP in OpenAI Plugins? A Complete Guide to the Model Context Protocol
The Model Context Protocol (MCP) is a standardized interface that enables OpenAI-powered agents to discover and invoke external tools through structured input and output schemas instead of raw HTTP requests.
The Model Context Protocol (MCP) serves as the architectural backbone of the OpenAI plugins ecosystem, providing a safe and discoverable way for AI agents to interact with external services. Within the openai/plugins repository, MCP configurations define how agents connect to databases, APIs, and custom backends through validated tool definitions. This protocol replaces ad-hoc HTTP calls with schema-enforced function invocations, ensuring that language models operate within predefined safety boundaries.
What Is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is a communication standard that governs how AI agents interact with external services through purpose-built servers. Rather than generating raw HTTP requests, agents invoke tools (functions) defined by an MCP server, which exposes strict input schemas and output schemas that the model must follow. The server handles authentication—typically via OAuth—and enforces these schemas, preventing the model from generating arbitrary or malformed API calls.
How MCP Fits Into the OpenAI Plugin Architecture
The integration of MCP into the plugin architecture follows a clear client-server pattern, with configuration files linking the components together.
MCP Server Configuration
Each plugin can expose an MCP server through a .mcp.json configuration file located in the plugin root. This file defines the available tools, authentication requirements, and endpoint URLs. For example, in plugins/cloudflare/.mcp.json, the Cloudflare plugin ships an official MCP server that exposes Cloudflare-specific operations with validated schemas.
MCP Client Implementation
The MCP client—implemented in libraries like @ai-sdk/mcp (used by the Vercel AI SDK)—enables agents to discover and invoke tools from remote MCP servers. As documented in plugins/vercel/skills/ai-sdk/SKILL.md, the createMCPClient function establishes a connection to the MCP endpoint, handles OAuth authentication automatically, and manages network transport. The client queries the server for available tools using listTools() and validates invocations against the defined schemas.
Plugin Manifest Integration
MCP configuration works alongside the standard Codex manifest system. Each plugin declares its MCP capabilities in .mcp.json while maintaining a .codex-plugin/plugin.json for the broader Codex runtime. The Metabase plugin, for instance, references its MCP configuration in plugins/metabase/.codex-plugin/plugin.json, telling the runtime that structured tool endpoints are available alongside traditional plugin features.
Transport and Protocol Compliance
Modern MCP implementations in the OpenAI plugins repository use Streamable HTTP transport, which replaced the older Server-Sent Events (SSE) transport as of the March 2025 specification. Documentation in plugins/vercel/skills/vercel-api/SKILL.md confirms that Vercel-deployed MCP servers utilize this updated transport layer. Client libraries follow the latest MCP specification requirements, enforcing inputSchema and outputSchema fields during tool discovery and invocation.
Why MCP Matters for AI Agents
MCP provides four critical advantages over traditional integration methods:
- Safety – Agents cannot invent arbitrary HTTP calls; they are restricted to pre-approved tool schemas defined in the MCP configuration.
- Discoverability – Agents dynamically query available tools from the MCP server, enabling new capabilities without prompt engineering or code changes.
- Portability – Any MCP-compatible server—whether hosted on Vercel, Cloudflare, or self-hosted infrastructure—can be swapped while maintaining the same client code.
- Extensibility – Plugin developers add new capabilities by extending their
.mcp.jsondefinitions rather than rewriting agent logic.
Practical Implementation Examples
The openai/plugins repository contains concrete implementations demonstrating client creation, tool invocation, and configuration patterns.
Creating an MCP Client in Node.js
The Vercel AI SDK skill demonstrates how to instantiate a client connection to an MCP server:
import { createMCPClient } from "@ai-sdk/mcp";
const client = await createMCPClient({
// URL of the remote MCP server (provided by the plugin)
endpoint: "https://my-plugin.mcp.vercel.app/api/mcp",
// OAuth is handled automatically by the library
});
// List available tools
const tools = await client.listTools();
console.log("Available tools:", tools);
The createMCPClient function is documented in plugins/vercel/skills/ai-sdk/SKILL.md and handles the underlying Streamable HTTP transport and authentication flows automatically.
Calling MCP Tools with Schema Validation
Once connected, the client invokes specific tools by name, with parameters validated against the server's inputSchema:
const result = await client.callTool("searchDocuments", {
query: "latest quarterly earnings for Apple",
});
console.log("Search results:", result);
The tool's outputSchema guarantees that the returned data structure matches the agent's expectations, enabling reliable downstream processing without defensive parsing logic.
Configuring MCP Tools in Skill Definitions
Skills that leverage MCP often define their tool interfaces in YAML configuration files. The following example from the Vercel plugin's agent configuration demonstrates how tools map to MCP server capabilities:
# plugins/vercel/skills/vercel-api/agents/openai.yaml
description: |
Agent that interacts with Vercel through the MCP server.
tools:
- name: getRuntimeLogs
inputSchema:
deploymentId: string
level: enum("info","error","debug")
outputSchema:
logs: array<string>
When the agent requires runtime logs, it invokes getRuntimeLogs via the MCP client, and the Vercel MCP server streams the structured response back according to the defined output schema.
Key Source Files and Configuration Paths
Understanding MCP requires familiarity with these specific locations in the openai/plugins repository:
plugins/cloudflare/.mcp.json– Defines the Cloudflare MCP server endpoint and available tools.plugins/vercel/skills/ai-sdk/SKILL.md– Documents thecreateMCPClientimplementation and client-side usage patterns.plugins/vercel/skills/vercel-api/SKILL.md– Explains Streamable HTTP transport and the March 2025 specification compliance.plugins/metabase/.codex-plugin/plugin.json– Shows how the standard plugin manifest references MCP capabilities.plugins/wix/skills/wix-app/SKILL.md– Illustrates the "check-reference-then-MCP" pattern used when skills first consult API documentation before falling back to MCP discovery.
Summary
- MCP standardizes how OpenAI agents call external services through structured tool definitions rather than raw HTTP.
- Configuration resides in
.mcp.jsonfiles, while integration occurs alongside.codex-plugin/plugin.jsonmanifests. - The MCP client (
@ai-sdk/mcp) handles transport, authentication, and schema validation automatically. - Streamable HTTP is the current transport standard as of March 2025, replacing older SSE implementations.
- Schema enforcement via inputSchema and outputSchema prevents malformed requests and ensures reliable data structures.
Frequently Asked Questions
What does MCP stand for in OpenAI plugins?
MCP stands for Model Context Protocol. It is the standardized communication layer that allows AI agents to discover and interact with external tools and services through structured, schema-validated function calls rather than unstructured HTTP requests.
How does MCP improve safety compared to direct API integration?
MCP improves safety by enforcing input schemas and output schemas at the server level. The AI agent can only invoke tools that have been pre-defined in the .mcp.json configuration, and all parameters must conform to the specified types. This prevents the model from generating arbitrary URLs, malformed payloads, or unauthorized API calls, as the MCP client validates all invocations before transmission.
Which file configures the MCP server in a plugin?
The MCP server configuration is defined in a .mcp.json file located in the plugin's root directory. For example, plugins/cloudflare/.mcp.json contains the endpoint definitions and tool schemas for the Cloudflare integration. This file works in conjunction with the standard .codex-plugin/plugin.json manifest to register capabilities with the Codex runtime.
What transport protocol does MCP currently use?
As of the March 2025 specification, MCP uses Streamable HTTP as its transport protocol. This replaces the previous Server-Sent Events (SSE) transport method. Documentation in plugins/vercel/skills/vercel-api/SKILL.md confirms that modern MCP servers deployed on Vercel utilize Streamable HTTP for client-server communication, providing better error handling and connection management than the legacy SSE approach.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →