Tôi viết một MCP server cho database internal, test trên Claude Desktop, ổn. Hôm sau một bạn trong team hỏi “tôi đang xài Cursor, dùng được không”. Tôi nhìn config Cursor lần đầu, thấy file .cursor/mcp.json với cùng format mcpServers, copy paste, restart, tools xuất hiện ngay trong Cursor agent. Không sửa một dòng code server nào.
Đó là điểm hấp dẫn nhất của MCP. Bạn build server một lần, các client khác nhau cùng connect được. Từ cuối 2025 sang 2026, MCP đã trở thành chuẩn chung. OpenAI donate (cùng Anthropic, Block) cho Linux Foundation, thành lập Agentic AI Foundation (AAIF), và adopt MCP trong tất cả product Codex, ChatGPT Developer Mode, Agents SDK, Responses API.
Bài này tôi đi qua 5 client phổ biến nhất ngoài Claude: Cursor, Windsurf, gptme, OpenAI Codex, Continue. Mỗi client setup nó, khác biệt feature support, và khi nào ship MCP server để dùng đa client.
MCP đã trở thành chuẩn ngành
Trước khi đi vào setup, một context ngắn để bạn hiểu vì sao bài này quan trọng.
Cuối 2025, Anthropic donate MCP cho Agentic AI Foundation dưới Linux Foundation. OpenAI co-founder cùng Anthropic và Block. Tới đầu 2026, AAIF báo cáo có hơn 10.000 public MCP server và hàng chục triệu SDK download mỗi tháng.
Adoption rất rộng: Anthropic, OpenAI, Microsoft, Amazon, Google (Gemini CLI), plus các IDE Cursor, Windsurf, Continue, Cline. Tháng 4 năm 2026 OpenAI ship Codex update với hơn 90 plugin mới, hầu hết là MCP server đóng gói lại.
Hệ quả thực tế cho bạn: nếu bạn build MCP server theo spec chuẩn (stdio hoặc Streamable HTTP transport, tool/resource/prompt entities), server đó chạy được với hầu hết client lớn. Không cần viết adapter riêng cho từng client.
Cursor
Cursor adopt MCP từ đầu 2025, là một trong những IDE đầu tiên ngoài Claude Desktop hỗ trợ protocol.
Setup config
Cursor có hai cấp config, giống Claude Code:
- Global:
~/.cursor/mcp.json(macOS/Linux) hoặc%USERPROFILE%\.cursor\mcp.json(Windows). Áp dụng cho tất cả project. - Project:
.cursor/mcp.jsonở root của workspace. Chỉ áp dụng cho project đó. Nếu trùng tên server với global, project thắng.
Format giống y hệt Claude Desktop. Đây là ví dụ wire một filesystem server:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/work"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx"
}
}
}
}
Sau khi save file, mở Cursor agent panel (Cmd+L), tool list sẽ refresh. Nếu không thấy, restart Cursor một lần.
Trần tool và dynamic context
Đây là chỗ Cursor khác Claude Desktop đáng kể. Cursor có ceiling 40 active tool trên toàn bộ MCP server gộp lại. Vượt ngưỡng, Cursor warning và silently bỏ tool dư. Agent không biết tool bị mất, gọi xong báo lỗi.
Workaround: chia nhỏ project-level config, mỗi project chỉ enable đúng server cần. Đừng bật toàn bộ 10 server global cho project nào cũng dùng cùng lúc.
Từ tháng 1 năm 2026, Cursor thêm dynamic context management, giảm token usage khoảng 47% khi chạy nhiều MCP server. Cơ chế: chỉ inject tool description vào prompt khi LLM thật sự cần, không inject toàn bộ tool list mỗi turn.
Feature support
Cursor hỗ trợ tools, resources, prompts. Sampling (server gọi ngược LLM) chưa hoàn thiện, dùng được nhưng ít người test.
Tools là phần dùng nhất, agent chủ động gọi khi cần. Resources hữu ích khi bạn muốn pin một file hoặc một bộ data làm context cho cả session, ví dụ schema database hoặc style guide nội bộ. Prompts xuất hiện trong slash menu của Cursor, user chủ động trigger workflow.
Một điểm Cursor cải tiến gần đây: tool execution có visualization riêng, hiển thị input/output rõ ràng trong agent panel. So với Claude Desktop trước đây thường ẩn detail, Cursor làm tốt hơn cho debug. Khi MCP server fail, bạn thấy ngay lỗi gì, payload gì sai. Đây là chi tiết nhỏ nhưng tiết kiệm thời gian debug rất nhiều.
Windsurf (Codeium)
Windsurf, IDE của Codeium, là client thứ hai adopt MCP đầu 2025.
Setup config
Windsurf đặt config ở ~/.codeium/windsurf/mcp_config.json (macOS/Linux) hoặc %USERPROFILE%\.codeium\windsurf\mcp_config.json (Windows).
Lưu ý: file không tự sinh ra khi cài Windsurf. Bạn tự tạo. Format y hệt Cursor:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/work"]
}
}
}
Trước khi server load, vào Settings → Cascade bật toggle Model Context Protocol (MCP). Cascade là agent mode của Windsurf, chỉ nó dùng MCP, không phải auto-complete.
Có ba cách thêm server:
- MCP Marketplace: click icon MCPs góc trên panel Cascade, browse server official có blue check, install một click.
- Manual config file: edit
mcp_config.jsonnhư trên. - Command Palette: Cmd+Shift+P, gõ “Windsurf: Configure MCP Servers”.
Trần tool
Windsurf có hard limit 100 tool active trong Cascade. Cao hơn Cursor (40) nhưng vẫn có giới hạn. Nếu bạn cộng dồn server expose hơn 100 tool, Windsurf không load số dư.
Feature support và transport
Windsurf hỗ trợ ba transport: stdio, Streamable HTTP, và SSE. Tools, resources, prompts đều support.
Thực tế dùng: trong test benchmark cuối 2025 với Composio MCP server (Linear + Slack), Cursor execute đầy đủ tool chain (tạo issue, label, message Slack), Windsurf fail vài step (không gọi list_states để lấy state_id, tạo issue thiếu label). Cả hai đều work, Cursor ổn định hơn ở multi-tool chain.
gptme
gptme là agent terminal nhỏ gọn open source, được dùng nhiều trong homelab local LLM stack. Tôi đã đi sâu nó trong Local LLM 2026, bài 4 và lưu lại vài kinh nghiệm trong memory cá nhân.
gptme hỗ trợ MCP từ phiên bản v0.20 trở đi, có thể discovery và dynamic load MCP server, cho agent access database, API, filesystem, và bất kỳ tool MCP-compatible nào.
Setup config
gptme đọc config từ ~/.config/gptme/config.toml. Để wire MCP server, thêm block:
[mcp]
enabled = true
[[mcp.servers]]
name = "filesystem"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/home/me/projects"]
[[mcp.servers]]
name = "github"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
[mcp.servers.env]
GITHUB_PERSONAL_ACCESS_TOKEN = "ghp_xxx"
Sau khi save, chạy gptme lại. Tool từ MCP server xuất hiện trong tool list, dùng được trong cuộc chat.
Khác biệt khi pair với local LLM
gptme thường pair với local LLM (Ollama, llama.cpp) thay vì cloud model. Đây là chỗ tricky:
- One-shot tool call: chạy ổn. gptme bắn một tool call, model trả response, gptme execute MCP, đưa output về.
- Agent loop: hay hang. Local model nhỏ (7B-13B) không biết khi nào dừng tool loop, lặp tool call vô tận. Lessons từ homelab tôi ghi lại: Gemma 7B chạy 2-4 tok/s trên Xeon E5 + Quadro K620, OpenClaw/OpenCode hang vì agent loop, gptme works one-shot.
Cho local LLM, dùng gptme + MCP cho task discrete, không cho task agent dài. Cho cloud model (Claude, GPT-4), gptme + MCP đầy đủ.
Một điểm nữa: gptme có hooks lifecycle (before_tool_call, after_tool_call, on_conversation_start). Bạn có thể inject custom logic, ví dụ log mọi MCP call ra file, hoặc rate-limit tool gọi từ một server cụ thể. Đây là feature mà Cursor và Windsurf không có (closed source), khá tiện cho debug và observability.
Tôi đã dùng gptme + MCP cho workflow local ETL: gptme chạy trên homelab, kết nối tới một MCP server custom expose internal database. Câu lệnh shell và data query chạy không qua cloud. Đối với dữ liệu nhạy cảm (compliance, healthcare, finance), đây là pattern đáng tham khảo.
OpenAI Codex và ChatGPT Developer Mode
Đây là phần thay đổi lớn nhất giữa 2025 và 2026. Cuối 2025, OpenAI dứt khoát adopt MCP. Tới tháng 4 năm 2026, Codex ship hơn 90 plugin mới, hầu hết là MCP server đóng gói.
MCP trong layer nào của OpenAI
OpenAI weave MCP vào tất cả surface:
| Layer | MCP role |
|---|---|
| Responses API | Backend integration, server-side tool calling |
| Agents SDK | Autonomous agent build với MCP tool |
| ChatGPT Developer Mode | Interactive tool use, user-controlled |
| Apps SDK | Build UI interactive trong ChatGPT, MCP làm data layer |
| Codex | AI-assisted coding, MCP plugin tools |
Setup MCP trong ChatGPT Developer Mode
Bật Developer Mode trong ChatGPT Settings. Sau đó vào tab MCP servers, add server URL (Streamable HTTP) hoặc command (stdio). Format y chang Cursor:
{
"name": "my-database",
"url": "https://mcp.mycompany.com/sse",
"headers": {
"Authorization": "Bearer xxx"
}
}
ChatGPT discovery tool từ server, hiện trong tool picker. Một số use case nội bộ company hay dùng: MCP server query internal database, MCP server đọc Slack archive, MCP server gọi Jira.
MCP trong OpenAI Agents SDK
Python SDK của OpenAI Agents có MCP client built-in. Code wire một server:
from openai_agents import Agent, MCPServer
mcp = MCPServer(
command="npx",
args=["-y", "@modelcontextprotocol/server-filesystem", "/work"]
)
agent = Agent(
model="gpt-4.1",
mcp_servers=[mcp],
instructions="You are a coding assistant."
)
response = agent.run("List files in /work and summarize")
SDK tự handle discovery, tool call routing, response handling. Bạn không thấy MCP protocol detail, chỉ thấy tool xuất hiện sẵn.
Codex plugin
Codex (CLI và web) có plugin store. Mỗi plugin bundle: optional skill, app integration, và MCP server. Khi user enable plugin, Codex auto-spawn MCP server và expose tool. Đây là cách OpenAI distribute MCP cho user không tech: chỉ một click install, không edit JSON file.
Đáng chú ý là OpenAI cũng adopt Skills từ Anthropic (donate cùng MCP cho AAIF). Một plugin Codex thường gồm: skill (procedural knowledge cho model), MCP server (tools), và app integration (UI wrapper). Ba layer này phối hợp: skill biết khi nào gọi tool, MCP execute, app render output. Đây là pattern lớn dần sẽ trở thành chuẩn cho mọi AI assistant trên thị trường.
Đối với developer build MCP server muốn distribute, một con đường là package thành Codex plugin (qua manifest YAML chuẩn), submit lên Codex marketplace. User Codex chỉ một click là dùng được. So với việc bắt user edit JSON config (Cursor, Windsurf), trải nghiệm này dễ tiếp cận hơn nhiều, gần như “App Store cho AI tool”.
Continue (VS Code, JetBrains)
Continue là extension open source cho VS Code và JetBrains, hỗ trợ MCP từ giữa 2025.
Setup config
Continue dùng folder .continue/mcpServers/ ở root workspace. Mỗi server một file YAML:
# .continue/mcpServers/filesystem.yaml
name: filesystem
version: 1.0.0
schema: v1
command: npx
args:
- -y
- "@modelcontextprotocol/server-filesystem"
- /Users/me/work
Nếu bạn đã có config JSON kiểu Cursor/Claude Desktop, copy nguyên file vào .continue/mcpServers/, Continue auto-pickup.
Transport
Continue support stdio (local), SSE (legacy), và Streamable HTTP (cho remote server cloud). MCP server chỉ dùng được trong agent mode, không phải chat mode hay edit mode.
Secrets
Continue cho phép store secret local hoặc qua Continue Mission Control (cloud secret store của Continue). Dùng ${{ secrets.GITHUB_TOKEN }} syntax trong config để reference.
Lưu ý nhỏ trên Windows WSL: Continue trước đây có bug tìm cmd.exe thay vì bash khi spawn MCP server trong WSL workspace (issue 9151 trên GitHub). Đã fix trong version mới hơn, nhưng nếu bạn dùng WSL và thấy MCP server không khởi động, check version Continue và update.
Feature support Continue
Continue support đầy đủ tools, resources, prompts. Sampling thì chưa, đa số use case bạn không cần. Một điểm hay của Continue là format YAML rõ ràng hơn JSON cho server complex (nhiều env var, nhiều args). Đặc biệt với team nhiều người, đọc YAML diff trong PR review dễ hơn JSON.
Bảng so sánh nhanh
| Client | Config path | Trần tool | Transport | Sampling |
|---|---|---|---|---|
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json | None | stdio, SSE | Yes |
| Cursor | ~/.cursor/mcp.json hoặc .cursor/mcp.json | 40 | stdio, SSE, HTTP | Partial |
| Windsurf | ~/.codeium/windsurf/mcp_config.json | 100 | stdio, SSE, HTTP | Partial |
| gptme | ~/.config/gptme/config.toml | None | stdio | No |
| ChatGPT Dev Mode | UI add | None | stdio, HTTP | No |
| OpenAI Agents SDK | Code | None | stdio, HTTP | Yes |
| Continue | .continue/mcpServers/*.yaml | None | stdio, SSE, HTTP | No |
Sampling chỉ Claude Desktop và OpenAI Agents SDK support đầy đủ. Cursor và Windsurf đang dần rollout. Đa số use case bạn không cần sampling, nên đừng lo.
Khi nào nên ship MCP để dùng đa client
Câu hỏi business: bạn build MCP server cho team, có nên ship chuẩn protocol thay vì hardcode tool vào agent?
Ship MCP server khi:
- Có ít nhất 2 client khác nhau sẽ dùng. Một bạn xài Cursor, một bạn xài Claude Code, một bạn xài ChatGPT Developer Mode.
- Tool stateless hoặc state minimal. State thuộc về client, không phải server, đã bàn ở bài MCP gốc.
- Bạn muốn share với community hoặc public registry sau này.
Hardcode tool trực tiếp khi:
- Chỉ một agent duy nhất dùng, không có khả năng share.
- Tool cần state phức tạp hoặc real-time bidirectional (WebSocket).
- Performance critical, không chịu được overhead MCP RPC.
Trong thực tế tôi thấy số tool đáng wire qua MCP nhiều hơn số người nghĩ. Một MCP server cho database internal, deploy một lần, cả team Cursor + Claude Code + Continue + Codex dùng chung. ROI cao hơn nhiều so với mỗi agent tự wire.
Khác biệt feature support khi build MCP server đa client
Khi build server muốn chạy đa client, vài feature MCP không support đều. Bạn nên biết để tránh design tool dựa vào feature mà 80% client chưa hỗ trợ.
Tools: tất cả client support. An toàn.
Resources: Claude Desktop, Windsurf, Cursor, Continue đều support đầy đủ. gptme và ChatGPT Developer Mode hỗ trợ một phần (resource dạng static, không subscribe real-time). Khi build server, để tools làm phần chính, resources cho static data.
Prompts: Claude Desktop, Windsurf, Continue support. Cursor support partial (chỉ thấy trong slash menu, không inject vào system prompt). gptme và Codex chưa thấy support đầy đủ. Nếu bạn dùng prompts làm workflow chính, server sẽ không universal.
Sampling: chỉ Claude Desktop và OpenAI Agents SDK support. Đây là feature cao cấp (server gọi ngược LLM của client để generate text). Đừng design dependency vào sampling cho server muốn dùng đa client.
Streamable HTTP transport: từ giữa 2025 trở đi đa số client support. stdio vẫn là baseline, dùng cho local. Streamable HTTP cho remote server cloud.
Auth: OAuth 2.0 đã thành chuẩn (RFC 9728 Resource Indicators), đã bàn ở bài 4. Tất cả client lớn support, ngoại trừ gptme có config OAuth thủ công.
Hệ quả thiết kế: nếu muốn server max compatible, focus vào tools + resources, transport stdio và Streamable HTTP, auth OAuth 2.0 (cho remote). Tránh prompts làm phần chính, tránh sampling.
Pitfall thường gặp khi multi-client
Một số bài học sau khi tôi ship MCP server dùng đa client:
Tool name namespacing. Nếu nhiều server cùng expose query, client confused. Prefix tool name: pg_query, mysql_query, redis_query. Đa số client không namespace tự động.
Trần tool limit. Cursor 40, Windsurf 100. Server expose 50 tool sẽ ăn hết slot Cursor, không còn chỗ cho server khác. Pruning tool list khi build server, đừng expose tool ít dùng.
Path absolute trong stdio. Khi config command: npx, đường PATH client thấy có thể khác shell user. Cursor và Windsurf hay không tìm thấy npx nếu user dùng nvm. Workaround: dùng absolute path command: /Users/me/.nvm/versions/node/v22/bin/npx.
Restart không refresh. Một số client cache tool list. Sau khi edit MCP config, restart hoàn toàn (kill process, không reload window).
Secret leak qua env. Khi share config file, đừng push token vào git. Dùng env var reference, lấy từ shell, hoặc dùng secret manager của client (Continue Mission Control, Cursor settings store).
Version mismatch SDK. Client A có thể dùng MCP SDK v1.0, client B v1.2. Một số tool method được rename hoặc deprecated giữa version. Khi build server, pin MCP SDK version cụ thể (đừng dùng * hoặc latest), test với MCP Inspector trước khi public release.
Concurrent connection. Một số client (Cursor, Windsurf) connect lại server mỗi lần chat mới. Một số khác (Claude Desktop) duy trì connection. Nếu server có resource tốn kém để khởi động (database connection pool, large model), thiết kế để init nhanh, hoặc lazy-init khi tool đầu tiên được gọi.
Lời kết
MCP là một protocol, không phải feature của Claude Desktop. Khi bạn build MCP server theo chuẩn, server đó chạy với Cursor, Windsurf, gptme, ChatGPT Developer Mode, Codex, Continue, và còn nhiều client khác sẽ adopt trong tương lai.
Phần khó không phải code server, mà là design tool sao cho universal. Tránh state server, tránh tool quá nhiều (trần Cursor), namespace tool name, handle PATH absolute. Mấy điều này không có trong spec MCP, chỉ học qua thực hành.
Series MCP từ zero sắp khép lại. Bài 13 sẽ tổng kết: MCP roadmap 2026-2027 dưới AAIF Linux Foundation, các spec sắp ra (auth scoping per-tool, batch tool call, streaming response), và bạn nên đầu tư thêm vào đâu nếu đang serious về MCP.