Skip to content
Model Context Protocol (MCP) Practical Introduction Guide: Mastering the standard protocol that connects AI agents with external tools
← Back to blog

Model Context Protocol (MCP) Practical Introduction Guide: Mastering the standard protocol that connects AI agents with external tools

AI How-to·12 min read

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.

Model Context Protocol (MCP) Practical Introduction Guide: Mastering the standard protocol that connects AI agents with external tools

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 MCPFunction Calling (Existing) LangChain Tools
StandardizationAgentic AI Foundation standardDifferent for each modelFramework dependent
Reuse toolsWrite once → All clientsRewrite by modelInside LangChain only
Status ManagementSession-based state persistence StatelessAdditional memory implementation required
Introduction costSDK learning 1-2 daysRequires understanding of model APILearn the entire framework
Community ServerThousands (GitHub, Slack, DB, etc.)Implement yourselfLimited

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

TrapSymptomsPrevention/Recovery
CursorJack AttackMalicious deep link installs rogue MCP serverSet mcp.json change detection hook, prevent clicking on untrusted cursor:// links
No authenticationHTTP server is accessible to anyoneAPI Gateway + OAuth 2.0 integration, SSO token verification
Session LeakInfinite increase in memory usageSet session TTL, periodic garbage collection
Insufficient audit logNo tracking which tool was called and whenStructured logging + SIEM integration for all tool calls
Tool PoisoningMalicious server injects prompt into tooltipRegister 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

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

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