Skip to content

Conversation

@christian-bromann
Copy link
Member

This PR adds support for OpenAI's MCP (Model Context Protocol) tool, enabling models to connect to remote MCP servers and OpenAI-maintained service connectors.

Usage

import { ChatOpenAI, tools } from "@langchain/openai";

const model = new ChatOpenAI({ model: "gpt-4o" });

// Remote MCP server
const response = await model.invoke("Roll 2d4+1", {
  tools: [tools.mcp({
    serverLabel: "dmcp",
    serverUrl: "https://dmcp-server.deno.dev/sse",
    requireApproval: "never",
  })],
});

// Service connector (e.g., Google Calendar)
const calendarResponse = await model.invoke("What's on my calendar today?", {
  tools: [tools.mcp({
    serverLabel: "google_calendar",
    connectorId: "connector_googlecalendar",
    authorization: "<oauth-access-token>",
    requireApproval: "never",
  })],
});

Note: we don't have great support for the MCP approval flow. I left this out of this PR but filled an issue for it #9553

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 5bc2c23

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@langchain/openai Minor
@langchain/classic Patch
@langchain/community Patch
@langchain/deepseek Patch
@langchain/xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@christian-bromann christian-bromann force-pushed the cb/openai-websearch-tools branch from 6b2cf1c to 79c52aa Compare December 8, 2025 23:21
@christian-bromann christian-bromann force-pushed the cb/openai-mcp-connector-tool branch 2 times, most recently from 09c49ab to 939f966 Compare December 8, 2025 23:27
Base automatically changed from cb/openai-websearch-tools to cb/anthropic-mcp-toolset December 9, 2025 00:38
@christian-bromann christian-bromann merged commit 5bc2c23 into cb/anthropic-mcp-toolset Dec 9, 2025
131 of 136 checks passed
@christian-bromann christian-bromann deleted the cb/openai-mcp-connector-tool branch December 9, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants