# How to Integrate MCP with Third-Party Services for OpenAI Plugins

> Learn to integrate MCP with third-party services for OpenAI plugins. Deploy an MCP server, generate SDKs, and import tools for seamless API integration.

- Repository: [OpenAI/plugins](https://github.com/openai/plugins)
- Tags: how-to-guide
- Published: 2026-06-06

---

**You integrate MCP with third-party services for OpenAI plugins by deploying an MCP server that exposes typed JSON schemas, generating static AI SDK tool definitions with `mcp-to-ai-sdk`, importing those tools into a skill's [`SKILL.md`](https://github.com/openai/plugins/blob/main/SKILL.md) or [`skill.ts`](https://github.com/openai/plugins/blob/main/skill.ts), and enforcing an MCP-first discovery flow that falls back to direct REST calls when an endpoint is not covered.**

The `openai/plugins` repository provides a reference architecture for connecting AI agents to external APIs through the **Model Context Protocol (MCP)**. When you integrate MCP with third-party services for OpenAI plugins, you replace ad-hoc HTTP calls with structured, auth-aware RPC definitions that the agent can discover at runtime. This pattern is already implemented for services like Vercel and Wix, and you can apply the same workflow to any custom REST API.

## Create an MCP Server

The foundation of every integration is a lightweight HTTP service that implements the MCP specification. This server abstracts the third-party service's public API into a collection of typed operations and centralizes authentication—whether via OAuth, API keys, or bearer tokens—so the AI agent never sees raw secrets.

## Generate AI SDK Tool Definitions

Once the MCP server is running, use the `@ai-sdk/mcp` package or the `mcp-to-ai-sdk` CLI helper to pull its OpenAPI-like description and emit static tool definitions. This step guarantees that every tool call is strictly typed, preventing hallucinated parameters from reaching the external API.

```ts
// scripts/generate-tools.ts
import { generateToolsFromMCP } from "mcp-to-ai-sdk";

await generateToolsFromMCP({
  endpoint: "https://my-service.vercel.app/api/mcp",
  outputDir: "./plugins/my-service/skills/my-skill/tools",
});

```

## Add the Tool to a Skill

Inside the plugin, import the generated tool into a [`SKILL.md`](https://github.com/openai/plugins/blob/main/SKILL.md) or dedicated [`skill.ts`](https://github.com/openai/plugins/blob/main/skill.ts) file and expose it through the skill's [`manifest.json`](https://github.com/openai/plugins/blob/main/manifest.json). The skill description tells the agent when to invoke the tool and how to fall back to the classic REST client if MCP lacks coverage.

```ts
// plugins/my-service/skills/my-skill/skill.ts
import { listProjects } from "./tools/listProjects";

export const mySkill = {
  description: "List all projects for the connected account",
  async run(input: { owner: string }) {
    // The tool call is validated against the MCP-provided schema
    const result = await listProjects({ owner: input.owner });
    return { projects: result.projects };
  },
};

```

## Define the MCP-First Discovery Flow

Production skills in the repository follow an **MCP-first, CLI-fallback** pattern. The agent first consults local reference documentation—such as the files in `plugins/<service>/skills/<skill>/references/*.md`—and only issues an MCP discovery call (for example, `search` or `list`) when a required endpoint is missing. The Vercel skill in [`plugins/vercel/skills/vercel-api/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/skills/vercel-api/SKILL.md) demonstrates this pattern end-to-end.

When a specific method is absent from the MCP server, the skill falls back to a direct REST request:

```ts
// plugins/my-service/skills/my-skill/skill.ts
import { fetch } from "node-fetch";

async function getProjectDetails(id: string) {
  if (await listProjectsSupported()) {
    return await listProjects({ projectId: id });
  }
  // Direct REST call as a fallback
  const resp = await fetch(`https://api.myservice.com/v1/projects/${id}`, {
    headers: { Authorization: `Bearer ${process.env.MY_SERVICE_TOKEN}` },
  });
  return await resp.json();
}

```

## Deploy the MCP Server

For production, host the MCP server on a serverless platform such as Vercel or Cloudflare Workers. The skill's `commands/*.md.tmpl` files include deployment instructions that wire the MCP endpoint into the plugin's runtime configuration.

```bash
npx create-vercel@latest my-mcp-server
cd my-mcp-server
npm i @ai-sdk/mcp

# Add your MCP handlers in ./api/mcp.ts

vercel deploy

```

## Reference Implementations in openai/plugins

The source code for the Vercel and Wix skills provides authoritative examples of this architecture:

- **[`plugins/vercel/skills/vercel-api/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/skills/vercel-api/SKILL.md)** — Shows a full-featured skill that integrates Vercel's MCP server, including discovery logic, fallback handling, and deployment notes.
- **`plugins/vercel/skills/vercel-api/tools/*.ts`** — Contains auto-generated static tool definitions for Vercel MCP endpoints such as `listDeployments` and `getRuntimeLogs`.
- **[`plugins/wix/skills/wix-app/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/wix/skills/wix-app/SKILL.md)** — Demonstrates the MCP-first, CLI-fallback workflow for Wix services, with explicit flags that indicate which actions use MCP discovery.
- **[`plugins/vercel/skills/ai-sdk/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/skills/ai-sdk/SKILL.md)** — Guides developers on using the AI SDK's MCP client (`createMCPClient`) for custom integrations.
- **`plugins/vercel/commands/status.md.tmpl`** — Command template that gathers diagnostics via MCP reads before falling back to the Vercel CLI.
- **[`plugins/vercel/agents/ai-architect.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/agents/ai-architect.md)** — Agent description that explicitly references `@ai-sdk/mcp` integration.
- **[`plugins/vercel/skills/vercel-cli/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/skills/vercel-cli/SKILL.md)** — Shows how Vercel CLI commands are wrapped by MCP tools for seamless agent consumption.

## Summary

- **Deploy an MCP server** to centralize auth and expose typed JSON schemas for every third-party operation.
- **Generate static tools** with `generateToolsFromMCP` from `@ai-sdk/mcp` or `mcp-to-ai-sdk` to enforce strict input/output types.
- **Register tools in a skill** via [`skill.ts`](https://github.com/openai/plugins/blob/main/skill.ts) or [`SKILL.md`](https://github.com/openai/plugins/blob/main/SKILL.md) and declare them in the skill's [`manifest.json`](https://github.com/openai/plugins/blob/main/manifest.json).
- **Implement an MCP-first discovery flow** that consults local references before falling back to direct REST calls.
- **Deploy to a serverless host** and document the endpoint in the plugin's `commands/*.md.tmpl` templates.

## Frequently Asked Questions

### What is MCP in the context of OpenAI plugins?

MCP stands for **Model Context Protocol**, an auth-aware RPC layer that translates a third-party service's public API into structured tool definitions. In the `openai/plugins` repository, MCP lets an AI agent discover and call external operations through typed JSON schemas rather than unstructured HTTP requests.

### How does authentication work when integrating MCP with third-party services?

The MCP server encapsulates all token handling internally using OAuth, API keys, or bearer tokens. The AI agent interacts only with the MCP interface, so raw secrets remain inside the server and never appear in agent prompts or tool definitions.

### Can an OpenAI plugin skill fall back to REST if an MCP method is missing?

Yes. The recommended pattern in `openai/plugins` is MCP-first with direct REST as a fallback. The skill checks whether an MCP method exists—often via a helper such as `listProjectsSupported()`—and issues a standard HTTP request only when the MCP server does not expose the required endpoint.

### Where can I find examples of MCP integration in the openai/plugins repository?

The most comprehensive examples are in [`plugins/vercel/skills/vercel-api/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/vercel/skills/vercel-api/SKILL.md) and `plugins/vercel/skills/vercel-api/tools/*.ts`, which cover server discovery, generated tool usage, and fallback logic. The Wix skill at [`plugins/wix/skills/wix-app/SKILL.md`](https://github.com/openai/plugins/blob/main/plugins/wix/skills/wix-app/SKILL.md) provides another complete reference for the MCP-first workflow.