Giới thiệu MCP — Model Context Protocol

8 — MCPTrung cấp20 phút

Bạn build chatbot cho enterprise. Cần tools: - GitHub (list repos, PRs, issues) - Slack (send msg, read channels) - Jira (create ticket, update status) - Google Drive (search, read docs) - Gmail (send, search emails) - Salesforce (query leads) - ...

Bạn sẽ học được
  • Giải thích MCP giải quyết vấn đề gì (tool integration maintenance burden)
  • Phân biệt MCP vs tool use thông thường
  • Hiểu architecture: Client, Server, Tools/Prompts/Resources
  • Biết tại sao MCP đang thành industry standard

MCP = "Language for tool providers"

Idea: Service providers (GitHub, Slack, etc.) implement MCP servers exposing their tools qua chuẩn chung. Bạn chỉ cần connect MCP client tới servers.

Anthropic, AWS, GitHub, Google, Slack, Notion đều release MCP servers chính thức. Bạn reuse, không build.

Before MCP:
┌──────────────────────┐
│  Your chatbot app    │
│                      │
│  - GitHub tool 1     │
│  - GitHub tool 2     │
│  - ...50 tools       │  ← BẠN MAINTAIN
│  - Slack tool 1      │
│  - ...30 tools       │  ← BẠN MAINTAIN
│  - ...               │
└──────────────────────┘

After MCP:
┌──────────────────────┐         ┌──────────────────┐
│  Your chatbot app    │ ──MCP──▶ │ GitHub MCP       │
│  (just client)       │         │ (official)        │
│                      │ ──MCP──▶ │ Slack MCP        │
│                      │         │ (official)        │
│                      │ ──MCP──▶ │ Jira MCP         │
└──────────────────────┘         └──────────────────┘

MCP architecture

┌────────────────────────────────────────────────┐
│                                                │
│     Your App (MCP Client)                      │
│     ┌──────────────────┐                       │
│     │  MCP Client SDK  │                       │
│     └────────┬─────────┘                       │
│              │                                 │
│              │ Protocol messages               │
│              │ (stdio, HTTP, WebSocket)        │
│              ▼                                 │
│     ┌──────────────────┐                       │
│     │  MCP Server       │                       │
│     │  ┌────────────┐   │                       │
│     │  │ Tools      │   │ tools (functions)     │
│     │  │ Prompts    │   │ prompts (templates)  │
│     │  │ Resources  │   │ resources (data)     │
│     │  └────────────┘   │                       │
│     └──────────────────┘                       │
│              │                                 │
│              ▼                                 │
│     External service                           │
│     (GitHub API, DB, files, ...)               │
│                                                │
└────────────────────────────────────────────────┘

3 core concepts

1. Tools

Function Claude can call. Tương tự tool use Module 5, nhưng served qua MCP.

2. Prompts

Pre-built, high-quality prompt templates server provide. User pick prompt thay vì viết from scratch.

3. Resources

Data sources MCP server expose. Files, database records, documents. Client có thể read.

Module 8 cover từng piece.

MCP vs plain tool use

When MCP worth: > 5 integrations, long-term maintenance, team scale.

When plain OK: 1-3 tools cụ thể, MVP, tightly coupled to app.

Plain tool useMCP
SchemaBạn viếtServer provides
ImplementationBạn viếtServer implements
UpdatesBạn maintainServer provider updates
ReusePer-appAny MCP client can use
OverheadLow (1 app)Medium (need MCP client)
ScaleHardEasy (add servers)

Common questions

Ai viết MCP servers?

MCP khác gì API?

MCP khác gì tool use?

MCP tools → Claude vẫn dùng tool use pattern.

Ai invent MCP?

Anthropic. Công bố 11/2024. Open standard, cộng đồng contribute.

  • Service providers: GitHub, AWS, Google, Slack đã public MCP servers
  • Community: OSS devs wrap APIs
  • Bạn: custom business logic internal services
  • API: endpoints generic (REST, GraphQL)
  • MCP server: wraps API với AI-friendly tool schemas, structured for LLM consumption
  • Tool use: cơ chế Claude gọi function
  • MCP: where tool schemas + functions live

Ecosystem growing

(2026-04) đã có:

Registry: modelcontextprotocol.io

  • 100+ official servers: GitHub, Slack, Notion, Gmail, PostgreSQL, Stripe, ...
  • 500+ community servers: niche tools
  • Multiple clients: Claude Desktop, Claude Code, custom apps
  • SDKs: Python, TypeScript, Go, Rust

Use cases

🔧 Developer workflows

GitHub MCP + Filesystem MCP + Terminal MCP → Claude Code super power.

💼 Enterprise assistant

Gmail + Slack + Jira + Google Drive MCP → single chatbot interface mọi tools.

📊 Data analysis

Snowflake + Postgres + Google Sheets MCP → query + analyze across databases.

🏢 Custom business

Build internal MCP server cho CRM, ERP. Team dùng qua Claude Desktop hoặc custom chatbot.

Anti-patterns preview

❌ Build MCP server cho 1 internal tool

Overhead not worth. Plain tool use OK.

Fix: MCP khi > 3 integrations hoặc tool sẽ shared cross-app.

❌ Wrap existing API 1-to-1

MCP server thêm overhead. Nếu không AI-optimize, not adding value.

Fix: Design MCP tools theo AI use case, không phải mirror API.

❌ Ignore security

MCP server = executable code. Untrusted server = security risk.

Fix: Only connect to trusted servers.

Áp dụng ngay

Bài tập 1: Explore registry (10 phút)

Visit modelcontextprotocol.io. Browse servers. Identify 3 potentially useful cho app của bạn.

Bài tập 2: Plan MCP architecture (10 phút)

Cho app bạn xây trong khóa:

  • Tools cần: ___
  • MCP server hiện có match không?
  • Build custom hay reuse?

Tóm tắt

🎯 MCP = standard protocol cho AI-tool integration. Solve maintenance burden của 50+ integrations.

🎯 Client-server architecture. Client = your app. Server = tool provider.

🎯 3 concepts: Tools (functions), Prompts (templates), Resources (data).

🎯 MCP vs tool use: MCP is where tools live. Tool use is how Claude calls them.

🎯 Growing ecosystem 2026: 100+ official servers, industry adopting as standard.

Nội dung này có hữu ích không?