跪拜 Guibai
← All articles
JavaScript

MCP Ends the AI Tool Language War with a Single Protocol

By mONESY ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

MCP turns AI tools into language-agnostic, independently deployable services. Teams can write a tool once in Rust, Python, or Java and reuse it across every agent project without rewriting adapters or worrying about runtime compatibility.

Summary

Two persistent headaches in AI agent development — tool code tightly coupled to a single project and language lock-in that blocks cross-language reuse — get a clean architectural fix through the Model Context Protocol. MCP splits the system into an independent server process that exposes Tools and Resources, and a client that discovers and invokes them over standard I/O or HTTP, with the LLM deciding autonomously when to call each tool.

A working Node.js example walks through both sides: a server registers a `query_user` tool and a static usage guide resource, while a LangChain-based client spawns the server as a child process, reads all resources into a system prompt, and runs an agent loop that calls tools across the process boundary until the model produces a final answer. The client’s `MultiServerMCPClient` can manage multiple servers written in different languages simultaneously.

The protocol eliminates the copy-paste adaptation layer that typically comes with switching agent frameworks. Because the transport is just stdio or HTTP, any language with an MCP SDK implementation can serve tools, and the agent host never needs to know what language a tool was written in.

Takeaways
Tool code and agent logic are fully decoupled: the MCP server runs as a standalone process, and the client communicates with it over stdio or HTTP.
Any language that implements the MCP SDK can serve tools; a Node.js client can call tools written in Python, Java, or Rust with no language-specific glue code.
A single `MultiServerMCPClient` can manage multiple MCP servers simultaneously, each potentially written in a different language and handling a distinct business domain.
Resources are static text (manuals, rules) that get injected into the system prompt at startup, complementing RAG for long-document retrieval.
The agent loop repeatedly invokes the model, checks for tool calls, executes them across the process boundary, and feeds results back until the model produces a final text answer.
Calling `mcpClient.close()` is mandatory to kill all spawned child processes and prevent background process leaks.
Conclusions

MCP’s real value is not the protocol itself but the elimination of the adapter tax: every new agent framework or language choice currently forces a rewrite of tool wrappers, and MCP makes that cost zero.

The architecture treats tools as first-class context participants rather than external data fetchers. The LLM sees tool descriptions and decides when to call them, which is a fundamentally different model from hard-coded function-calling pipelines.

Stdio as a transport is underrated for local development. It requires no port management, no network stack, and works across any language that can read and write to standard I/O, making it the simplest possible IPC for agent tools.

Concepts & terms
Model Context Protocol (MCP)
An open protocol that standardizes how AI agents discover and invoke external tools and static resources. It defines a server that exposes Tools (executable functions) and Resources (static text), and a client that connects over stdio or HTTP.
StdioServerTransport
An MCP transport that uses a child process’s standard input and output streams for bidirectional communication. No network ports are required, making it the default choice for local tool servers.
MultiServerMCPClient
A LangChain client that manages connections to multiple MCP servers simultaneously. It spawns each server as a child process, discovers their tools and resources, and presents them as a unified set to the LLM.
Tool vs. Resource in MCP
Tools are executable functions the LLM can call on demand (e.g., query a database). Resources are static text blocks (e.g., a usage manual) that get pre-loaded into the model’s system prompt at startup.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗