[KongchangAI]
· 2 min read· 1,366 words

LangChain + MCP in Practice: Connecting the Agent Tool Ecosystem

LangChain + MCP in Practice: Connecting the Agent Tool Ecosystem

LangChain builds Agents fast; MCP enables cross-framework tool reuse—together they form the foundation of enterprise AI apps.

The article contrasts LangChain and MCP. LangChain encapsulates model invocation, tool definition, and Agent construction so developers focus on business logic, but its add_tool tools only work inside the current Agent. MCP, an open protocol from Anthropic, standardizes tool discovery, invocation, and result handling so any compatible Agent can reuse tools, achieving decoupling. Function Calling and MCP express the same capability, and OpenAI now supports MCP too.

Why LangChain and MCP Are Needed

Large models have powerful reasoning capabilities—they can understand conversations and organize messy information—but they can only answer based on the data they were trained on. To make a large model work with a company's internal business data, you need to "bind tools" to it: enabling the model not only to understand questions but also to call tools to fetch real-time data, then rely on its reasoning to produce an answer.

However, writing model invocation, tool management, and conversation state maintenance from scratch wastes effort on low-level details. This is exactly where frameworks like LangChain add value: they encapsulate common capabilities such as model invocation, tool definition, and Agent construction, letting developers focus on business logic. According to the Bilibili tutorial author, you shouldn't hand-roll the framework—you should "stand on the shoulders of giants."

Put your energy here

The Layered Relationship Between LangChain and Agents

LangChain is a framework for building AI applications, offering APIs like create_agent to create Agents. In LangChain, you can define tools using add_tool, for example get_stock_price (look up a stock price by company name) and search_news (search for company news). These tools have nothing to do with MCP—they're only valid inside the current LangChain Agent.

An Agent can be understood as a higher-level wrapper around the large model: it automatically manages conversation history, actually executes tool calls and returns results, and can judge from those results whether further tool calls are needed. Under the hood, LangChain implements Agents via LangGraph; LangGraph is closer to the metal and more flexible. Above that, there are even higher-level wrappers such as Deep Agents. The tech stack diagram shown by the author illustrates that the lower the layer, the more flexible the API; the higher the layer, the more convenient to use.

It can only be used by your current LangChain Agent

LangGraph is the low-level orchestration library released by the LangChain team. It models an Agent's execution as a "state graph": nodes represent a model call or tool call, edges represent control flow and conditional branches, and the entire graph's runtime state (message history, intermediate variables, etc.) can be persisted and replayed. Because of this, it naturally supports complex scenarios such as looped calls, human-in-the-loop, and resuming from checkpoints. LangChain 1.x's create_agent is in fact a common ReAct loop wrapped on top of LangGraph, which is why the original text says "the lower the layer, the more flexible; the higher the layer, the more convenient"—write LangGraph directly when you need fine-grained control over the flow, and use the high-level API when you need to prototype quickly.

The Core Problem MCP Solves: Tool Reuse and Decoupling

Tools defined inside LangChain can only be used by the Agent in the current codebase. If another Agent wants to use the same tool, it has to redefine it—no reuse. More critically, Agents built with different frameworks (such as the Claude SDK or OpenAI SDK) cannot recognize tools defined by LangChain.

MCP (Model Context Protocol) is an open protocol that specifies how tools are discovered, how they are invoked, and how return results are handled. As long as a tool is developed according to the MCP protocol, any model provider that supports MCP can call it. The author draws an analogy with the USB interface: as long as a device is compatible with the USB protocol, the computer can recognize it. MCP was proposed by Anthropic, and according to the tutorial, almost all mainstream AI providers have supported it since its release.

Or should I say I'm Microsoft's

MCP brings two direct benefits: first, tool reuse—multiple Agents can share the same set of MCP tools; second, decoupling—MCP tools aren't bound to any particular Agent framework, so Agents built with the Claude SDK, OpenAI SDK, and others can all use them.

MCP uses a typical client-server architecture: the MCP Server is responsible for exposing capabilities, and the MCP Client is built into the Agent host, with the two communicating via JSON-RPC messages. The transport layer can be local standard input/output (stdio) or remote methods such as HTTP/SSE. The protocol defines three types of primitives—Tools (functions the model can call), Resources (data that can be read, such as files and database records), and Prompts (predefined prompt templates). A typical call consists of three steps: tools/list to discover tools, tools/call to execute a tool, and returning a structured result. Because the interface is standardized, the same MCP Server can be mounted and used by Claude, Cursor, and Agents built with various SDKs without modification.

Hands-On Integration: LangChain Agents Calling MCP Tools

The integration of LangChain and MCP more precisely refers to the integration of Agents and MCP (under the hood, LangGraph and MCP). When building an Agent in LangChain, besides using tools defined internally via add_tool, you can also connect tools developed with the MCP protocol. The tutorial demonstrates how to use both local tools and MCP tools within the same Agent, giving an intuitive comparison of the two.

This integration moves the Agent's tool ecosystem from a "closed loop within the framework" to "open across frameworks." Developers can quickly build an Agent with LangChain first, then publish general-purpose tools as MCP Servers for other Agents to reuse.

For the one that can't be analogized

Clarifying Concepts: Function Calling vs. MCP

The tutorial specifically addresses the question of "which is used more, MCP or Function Calling." The author points out that Function Calling is a concept proposed by OpenAI, while MCP is a concept proposed by Anthropic—both do the same thing: let the model call tools. OpenAI is now compatible with MCP as well, so they can be seen as different names for the same class of capability. Earlier the industry mostly mentioned Function Calling; now people more often just say MCP.

For agent development, the author recommends using LangChain rather than agonizing over domestic vs. international agents; only large models have a domestic/international distinction, and domestic models such as DeepSeekAd are already very capable. The version currently covered by the tutorial is LangChain 1.3; LangChain 4j isn't used much in companies.

Function Calling describes a capability at the model level: developers put the tool's name, description, and JSON Schema parameters into the request, and the model outputs a structured call intent when needed—the actual function execution is still done by the application side. It only specifies "how the model expresses what it wants to call"; it doesn't specify how tools are discovered, who hosts them, or how results are returned. MCP extends this chain one layer outward, standardizing tool registration, discovery, and execution into an independent process or remote service via a unified protocol. The two are complementary: the Agent framework converts the tool list provided by the MCP Server into the schema required by Function Calling and hands it to the model; once the model decides to call a tool, the framework forwards the execution via the MCP protocol.

Conclusion

LangChain provides a complete framework for building Agents, while MCP solves the problems of cross-framework tool reuse and model decoupling. Combined, they let Agents be built quickly while flexibly plugging into a standardized tool ecosystem. For enterprise AI application development, this combination is worth mastering first.

One-line Summary

LangChain handles rapid Agent construction, MCP handles cross-framework tool reuse—together they form the foundation of enterprise AI applications.

Paragraph Summary

The article explores the positioning differences between LangChain and MCP. Large models can only answer based on training data, so connecting to enterprise business data requires binding callable tools to them; LangChain encapsulates common capabilities such as model invocation, tool definition, and Agent construction, sparing developers from repeatedly hand-writing low-level details. But tools defined inside LangChain via add_tool only work for the current Agent and fail once you switch frameworks. MCP is an open protocol proposed by Anthropic that unifies tool discovery, invocation, and result handling, enabling tools to be reused by any Agent that supports the protocol—achieving decoupling. In practice, you can mount both local tools and MCP tools within the same LangChain Agent; Function Calling and MCP are essentially different expressions of the same class of tool-calling capability, and OpenAI is now compatible with MCP as well.

Share:

Related articles