Model Context Protocol (MCP) Practical Introduction Guide: Mastering the standard protocol that connects AI agents with external tools
A practical playbook that introduces MCP, which allows AI models such as Claude and GPT to directly access databases, file systems, and APIs, into production in two weeks.
1. Problem Definition: Why AI is disconnected from the outside world
Target audience: Developers, team leaders, and architects looking to deploy AI agents into production
Problem you are trying to solve:
- LLMs such as Claude and GPT cannot access real-time data
- Duplicate work that requires writing separate API integration code for each tool
- No tool access authority management and security audit log
Scope of application: MCP-supported client environments such as Claude Desktop, Claude Code, Cursor, and VS Code. Focused on single-user workflows (limited multi-tenant as of March 2026).
Not applicable: Fully autonomous multi-agent orchestration (not yet mature), direct integration with legacy systems (requires wrapper).
2. Evidence and Comparison: MCP vs Conventional Method
| Comparison criteria | MCP | Function Calling (Existing) | LangChain Tools |
|---|---|---|---|
| Standardization | Agentic AI Foundation standard | Different for each model | Framework dependent |
| Reuse tools | Write once → All clients | Rewrite by model | Inside LangChain only |
| Status Management | Session-based state persistence | Stateless | Additional memory implementation required |
| Introduction cost | SDK learning 1-2 days | Requires understanding of model API | Learn the entire framework |
| Community Server | Thousands (GitHub, Slack, DB, etc.) | Implement yourself | Limited |
MCP selection criteria:
- Mainly using the Claude ecosystem
- I want to integrate multiple tools into one protocol
- I want to immediately utilize the existing MCP server (GitHub, Slack, PostgreSQL, etc.)
3. Step-by-step execution method
Step 1: Preparing the environment
#Node.js environment (recommended)
npm install @modelcontextprotocol/sdk zod
npm install -D typescript @types/node
#Python environment
pip install mcp-sdk
Step 2: Create the first MCP server (stdio method)
Stdio transport suitable for local development:
// src/server.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import * as fs from "fs";
const server = new McpServer({
name: "my-file-server",
version: "1.0.0"
});
//Register file reading tool
server.tool("read_file", {
description: "Read contents of a file",
inputSchema: {
type: "object",
properties: {
path: { type: "string", description: "File path" }
},
required: ["path"]
}
}, async ({ path }) => {
const content = fs.readFileSync(path, "utf-8");
return { content: [{ type: "text", text: content }] };
});
//start server
const transport = new StdioServerTransport();
await server.connect(transport);
Step 3: Connect to Claude Desktop
~/.claude/mcp.json Create file:
{
"servers": {
"my-file-server": {
"command": "npx",
"args": ["tsx", "src/server.ts"],
"transport": "stdio"
}
}
}
Restart Cloud Desktop and check read_file in the tools list.
Step 4: Expand to HTTP server (for production)
// src/http-server.ts
import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
const app = express();
app.use(express.json());
const server = new McpServer({ name: "prod-server", version: "1.0.0" });
//...registering tools...
const sessions = new Map();
app.all("/mcp", async (req, res) => {
const sessionId = req.headers["mcp-session-id"];
let transport = sessions.get(sessionId);
if (!transport) {
transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => crypto.randomUUID(),
onsessioninitialized: (id) => sessions.set(id, transport)
});
await server.connect(transport);
}
await transport.handleRequest(req, res);
});
app.listen(3100, () => console.log("MCP HTTP server on :3100"));
Step 5: Utilize existing MCP server
Directly connect to community server:
#GitHub Server (Official)
npx @modelcontextprotocol/server-github
#PostgreSQL server
npx @modelcontextprotocol/server-postgres
4. Pitfalls
| Trap | Symptoms | Prevention/Recovery |
|---|---|---|
| CursorJack Attack | Malicious deep link installs rogue MCP server | Set mcp.json change detection hook, prevent clicking on untrusted cursor:// links |
| No authentication | HTTP server is accessible to anyone | API Gateway + OAuth 2.0 integration, SSO token verification |
| Session Leak | Infinite increase in memory usage | Set session TTL, periodic garbage collection |
| Insufficient audit log | No tracking which tool was called and when | Structured logging + SIEM integration for all tool calls |
| Tool Poisoning | Malicious server injects prompt into tooltip | Register only trusted servers, review tooltip |
5. Action Checklist
- ☐ Confirm Node.js 20+ or Python 3.10+ installation
- ☐ Install the latest version of @modelcontextprotocol/sdk
- ☐ stdio server local test completed
- ☐ Check tool list display in Claude Desktop
- ☐ Call actual tool → Verify result return
- ☐ Implement session management logic when switching HTTP servers
- ☐ Add authentication layer (required for production)
- ☐ Enable audit log (record each tool call)
- ☐ mcp.json change notification settings
- ☐ Error handling and timeout settings
Definition of Done: Claude Desktop calls a tool on a custom MCP server, receives expected results, and logs the call.
6. Reference
- WorkOS - Everything Your Team Needs to Know About MCP in 2026 (March 2026)
- TrueFoundry - MCP Servers in Cursor: Setup, Configuration, and Security Guide (March 2026)
- Free Academy - Build Your First MCP Server: Step-by-Step Guide (March 2026)
- freeCodeCamp - How to Build MCP Servers for Your Internal Data (February 2026)
- WorkOS - 2026 MCP Roadmap: Enterprise Readiness (March 2026)
7. Author's perspective
Recommended: As of 2026, MCP is the most practical way to connect tools in Claude-centric workflows. Especially:
- Immediately applicable to developer tool automation (code analysis, file manipulation, Git integration)
- Low initial construction cost due to abundant community servers
- Securing long-term stability through Agentic AI Foundation governance
Not recommended for:
- Environment using only OpenAI → Function Calling is more direct
- Multi-tenant SaaS → Enterprise certification specifications not yet confirmed
- Fully autonomous agent farm → Separate orchestration layer required
Conclusion: If it is AI tool automation for a single user/small team, adopt it now. For enterprise large-scale deployment, we recommend reexamination after confirmation of certification specifications in the second half of 2026.
Share this article
Related articles
Alibaba SkillWeaver Commentary: Why agent tool selection should prioritize skill search, DAG, and failure recovery budget rather than long prompts
Alibaba SkillWeaver is explained on a practical application basis in terms of tool selection, skill search, DAG execution plan, and failure recovery budget.
End of OpenAI Agent Builder Explanation: Why agent automation must separate SDK, Workspace Agent, and operation boundaries before screen builders
As OpenAI announces the end of its Agent Builder and Evals products, the focus of agent automation is shifting from screen-based builders to code-based SDKs and workspace operating models. This article organizes the execution flow and checklist by which existing Agent Builder users and team automation personnel should migrate.
Next.js AGENTS.md practical introduction guide: How to tell an AI coding agent to read version-locked documents first instead of training data
Based on Next.js 16.2's AGENTS.md and MCP support, we have organized an operating pattern that causes coding agents such as Claude Code·Codex to look at the current project document first instead of old training data.
Take the AQ test
See your AI capability in three minutes. Assess recognition, utilization, verification, integration, and ethics at once, then receive practical insights.
Start the free AQ test