Sử dụng Servers có sẵn
Khái niệm cơ bản
Bạn không cần code từ đầu! Cộng đồng MCP đã xây dựng sẵn hàng trăm servers cho các dịch vụ phổ biến.
Cài đặt cơ bản (Claude Desktop)
Bước 1: Mở file config
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/claude/claude_desktop_config.json |
Bước 2: Thêm server config
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-xxx", ...args],
"env": {
"API_KEY": "your-key"
}
}
}
}Bước 3: Restart Claude Desktop
Tắt hoàn toàn (Cmd+Q / Alt+F4) và mở lại. Biểu tượng 🔌 sẽ xuất hiện.
Catalog: 15 Servers phổ biến nhất
File & Storage
| Server | NPM Package | Chức năng |
|---|---|---|
| Filesystem | @modelcontextprotocol/server-filesystem | Đọc/ghi local files |
| Google Drive | @anthropic/mcp-server-google-drive | Access Google Drive |
| S3 | @anthropic/mcp-server-aws-s3 | AWS S3 buckets |
Config Filesystem:
{
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem",
"/Users/me/Documents",
"/Users/me/Projects"]
}
}Database
| Server | NPM Package | Chức năng |
|---|---|---|
| PostgreSQL | @modelcontextprotocol/server-postgres | Query Postgres |
| SQLite | @modelcontextprotocol/server-sqlite | Query SQLite |
| MongoDB | @anthropic/mcp-server-mongodb | Query MongoDB |
Config PostgreSQL:
{
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
}
}
}Developer Tools
| Server | NPM Package | Chức năng |
|---|---|---|
| GitHub | @modelcontextprotocol/server-github | Repos, Issues, PRs |
| GitLab | @anthropic/mcp-server-gitlab | GitLab projects |
| Linear | @anthropic/mcp-server-linear | Issue tracking |
| Sentry | @anthropic/mcp-server-sentry | Error monitoring |
Config GitHub:
{
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxx"
}
}
}Communication
| Server | NPM Package | Chức năng |
|---|---|---|
| Slack | @modelcontextprotocol/server-slack | Messages, channels |
| Gmail | @anthropic/mcp-server-gmail | Read/send emails |
| Notion | @anthropic/mcp-server-notion | Pages, databases |
Config Slack:
{
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-xxxxx"
}
}
}Utilities
| Server | NPM Package | Chức năng |
|---|---|---|
| Memory | @modelcontextprotocol/server-memory | Persistent memory |
| Fetch | @modelcontextprotocol/server-fetch | HTTP requests |
| Puppeteer | @modelcontextprotocol/server-puppeteer | Browser automation |
Config Memory (quan trọng!):
{
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}Cấu hình nhiều servers cùng lúc
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/code"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {"GITHUB_TOKEN": "ghp_xxx"}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {"DATABASE_URL": "postgresql://..."}
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}Troubleshooting
Server không xuất hiện
- Kiểm tra JSON syntax: Dùng JSONLint
- Kiểm tra path: Đảm bảo npx có trong PATH
- Xem logs:
# macOS
tail -f ~/Library/Logs/Claude/mcp*.logPermission errors
- Đảm bảo folder có quyền read
- Với filesystem, thêm đúng path vào args
Server crash
- Test server riêng:
npx -y @modelcontextprotocol/server-filesystem /tmp- Nếu chạy được, vấn đề ở config
Bài tập thực hành
Mục tiêu
Setup 3 servers và sử dụng chúng cùng lúc.
Bước 1: Tạo config
{
"mcpServers": {
"docs": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/Documents"]
},
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"fetch": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"]
}
}
}Bước 2: Test từng server
- Filesystem: “Liệt kê files trong Documents”
- Memory: “Nhớ rằng tên tôi là Phúc” → “Tên tôi là gì?”
- Fetch: “Lấy weather data từ wttr.in/Hanoi?format=j1”
Bước 3: Kết hợp servers
“Đọc file report.md trong Documents, tóm tắt, và nhớ lại summary đó cho lần sau.”
Tóm tắt
| Server | Use case |
|---|---|
| Filesystem | Đọc local files |
| Memory | Claude nhớ thông tin |
| GitHub | Quản lý code |
| PostgreSQL | Query database |
| Fetch | Gọi APIs |
Bài tiếp theo: Custom Server - Viết server riêng.
Last updated on