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.
PUT THE IDEA TO WORK
Practical AI tools
Turn a technical decision into a transparent estimate, capacity plan, or evaluation check. No signup required; your inputs stay in your browser.
Explore the free tools →TEST YOUR JUDGEMENT
Play the AQ Challenge
A 2-minute, 10-round AI judgement game: spot hallucinations, pick the safer prompt, and decide what to delegate. Try the Daily AQ, then challenge a friend with the same rounds.
Play the AQ Challenge →Share this article
Related articles
AI Agent Approval Queue Practical Guide 2026: Why you should design human approval, waiting state, and retry boundaries before automatic execution
We summarize in a practical flow how the approval queue, policy engine, human inbox, and idempotent executor should be divided before the AI agent executes external actions.
Context Engineering Practical Guide 2026: Why AI task automation should design memory, search, compression, and isolation criteria before prompts
The reason AI automation falters is not because of a lack of writing skills, but because the information, tools, memories, and verification criteria that the model needs to see at every moment are not organized. This article presents criteria and checklists for turning context engineering into a practical workflow.
AI Agent Framework Selection Guide 2026: Why you should anchor execution boundaries, state, and authorization loops before SDK names
A practical guide to choosing agent frameworks for 2026, such as OpenAI Agents SDK, Microsoft Agent Framework, Google ADK, and LangGraph, not by feature list but by execution boundaries, state management, authorization loops, and operational responsibilities.
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