mcp-server-security
Skill này làm gì
Hướng dẫn này chỉ cách bảo mật các máy chủ kết nối AI với các công cụ và dữ liệu khác. Nó giúp ngăn hacker truy cập hoặc thao túng các máy chủ này.
Khi nào nên dùng
- ✓Khi bạn kết nối AI với các hệ thống quan trọng.
- ✓Khi bảo mật dữ liệu là yếu tố then chốt.
- ✓Khi bạn muốn ngăn chặn truy cập trái phép.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mcp-server-security/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để bảo vệ máy chủ AI của tôi khỏi hacker?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Hướng dẫn giải thích cách dùng mã hóa để bảo vệ việc truyền thông, xác minh ai được dùng công cụ, và ghi lại mọi hành động để kiểm toán.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
MCP Server Security
Comprehensive hardening guide for Model Context Protocol (MCP) servers. MCP is the open standard for connecting AI agents to external tools, data sources, and services. Because MCP servers execute real actions on real infrastructure, they are a high-value attack surface. This skill covers every layer of defense you need before exposing an MCP server to agents in production.
2. MCP Threat Model
Before hardening, understand what you are defending against.
| Threat | Vector | Impact |
|---|---|---|
| Unauthorized tool access | Agent calls tools the user should not have access to | Privilege escalation, data breach |
| Prompt injection via resources | Malicious content in MCP resources influences agent behavior | Arbitrary tool execution |
| Data exfiltration via results | Tool results leak sensitive data back to an untrusted agent | Data loss, compliance violation |
| SSRF via MCP tools | Agent tricks a tool into making internal network requests | Internal service compromise |
| Credential theft | API keys or tokens stored insecurely on the MCP server | Full account takeover |
| Denial of service | Agent floods server with tool calls or huge payloads | Service unavailability |
| Man-in-the-middle | Unencrypted transport between agent and MCP server | Eavesdropping, request tampering |
| Supply chain compromise | Malicious MCP server package or plugin | Arbitrary code execution |
3. Transport Security
3.1 TLS for Streamable HTTP and SSE Transports
Every MCP server exposed over HTTP must terminate TLS. Never run plain HTTP in production.
Nginx reverse proxy with TLS termination for an MCP server:
# /etc/nginx/sites-enabled/mcp-server.conf
server {
listen 443 ssl http2;
server_name mcp.internal.example.com;
ssl_certificate /etc/ssl/certs/mcp-server.crt;
ssl_certificate_key /etc/ssl/private/mcp-server.key;
ssl_protocols TLSv1.3;
ssl_ciphers TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256;
ssl_prefer_server_ciphers on;
ssl_session_timeout 1d;
ssl_session_tickets off;
# HSTS header
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# SSE-specific: disable buffering so events stream immediately
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 86400s;
}
}
3.2 mTLS Between Agent and Server
For high-security environments, require the agent (client) to present a certificate.
# Add to the server block above
ssl_client_certificate /etc/ssl/certs/agent-ca.crt;
ssl_verify_client on;
ssl_verify_depth 2;
Generate a client certificate for an agent:
# Create CA (one-time)
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 \
-days 365 -noenc -keyout ca-key.pem -out ca-cert.pem \
-subj "/CN=MCP Agent CA"
# Create agent client cert signed by the CA
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256 \
-noenc -keyout agent-key.pem -out agent-csr.pem \
-subj "/CN=agent-orchestrator-01"
openssl x509 -req -in agent-csr.pem -CA ca-cert.pem -CAkey ca-key.pem \
-CAcreateserial -out agent-cert.pem -days 90
3.3 Securing stdio Transport
For local stdio-based servers, the attack surface is the process boundary itself:
Use an already reviewed, version-pinned local server entrypoint and a separately enforced sandbox. Do not launch a moving npx -y package or describe Node flags as a complete host-permission boundary. The server needs runtime/module access in addition to its data root; network, process creation, links and writes need explicit platform controls. A configuration example is not permission to create or replace a user's host entry.
…
Câu hỏi thường gặp
MCP là gì?
MCP là tiêu chuẩn để kết nối AI với các công cụ và dữ liệu bên ngoài một cách an toàn.
Vì sao bảo mật máy chủ MCP quan trọng?
Máy chủ MCP có thể thực hiện các hành động thật trên hệ thống, nên chúng là mục tiêu tấn công có giá trị.
TLS và mTLS là gì?
TLS mã hóa việc truyền thông giữa agent và máy chủ. mTLS yêu cầu agent cũng phải xuất trình chứng chỉ bảo mật.
Chi tiết
Mô tả gốc của tác giả
Secure Model Context Protocol (MCP) servers with transport encryption, tool authorization, input validation, and audit logging for safe AI agent integrations.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5187
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
mcporter
394kGiúp agent của bạn liệt kê, gọi và kiểm tra các máy chủ MCP cùng công cụ của chúng qua HTTP hoặc stdio, và quản lý cài đặt đăng nhập.
fastmcp
260kGiúp bạn xây dựng, kiểm thử và triển khai một máy chủ MCP bằng Python, cấp cho trợ lý AI quyền truy cập API, cơ sở dữ liệu hoặc file của bạn dưới dạng công cụ.
mcp-oauth-remote-gateway
260kHướng dẫn bạn đăng nhập OAuth cho máy chủ MCP từ xa khi Hermes chạy trên máy chủ, nơi đăng nhập bằng trình duyệt thông thường không thể truy cập được.