Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Mcp Server Security?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-mcp-server-security)
---
description: Harden MCP servers against SSRF, path traversal, prompt injection, excessive capabilities, and missing audit logs
profile: standard
tags: mcp, security, agents, ai
---
# MCP server security
Use when designing, exposing, or auditing Model Context Protocol servers and tools.
## Least privilege and input safety
- Default tools to read-only operations and narrow JSON schemas (enums, max lengths, bounded pagination limits).
- Canonicalize file paths with `realpath` and reject paths outside the configured workspace root or matching `.env` / secret patterns.
- Validate outbound URLs against private IP ranges, loopback, and cloud metadata addresses (`169.254.169.254`) after DNS resolution to block SSRF.
## Isolation and auditability
- Treat external data returned by MCP tools as untrusted: mark boundaries clearly and never evaluate tool outputs as shell commands.
- Bind local HTTP/SSE transports to loopback with origin validation; require scoped auth tokens for remote MCP endpoints.
- Log every tool invocation with caller identity, duration, and outcome without logging secrets or raw credentials.
## Verify
Test traversal payloads, blocked secret reads, rejected schema violations, and audit log output cleanly.