Use when securing MCP servers, preventing prompt injection, implementing authorization, validating user input, or building secure multi-agent pipelines. Provides 5-layer defense architecture patterns.
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/security-compliance/skills/mcp-security/SKILL.mdThis skill enforces security best practices for MCP servers and multi-agent pipelines.
# Always validate and sanitize inputs
def sanitize_input(user_input: str) -> str:
# Remove potential injection patterns
# Escape special characters
# Limit length
pass
# Never directly concatenate user input into prompts
# ❌ Bad
prompt = f"Process this: {user_input}"
# ✅ Good
prompt = sanitize_input(user_input)
validated_prompt = validate_against_schema(prompt)@dataclass
class UserContext:
user_id: str
roles: list[str]
permissions: list[str]
tenant_id: str
# Pass context through all pipeline stages
async def process_request(context: UserContext, request: Request):
# Validate permissions at each step
if not has_permission(context, "read:data"):
raise AuthorizationError()ROLE_PERMISSIONS = {
"admin": ["read", "write", "delete", "admin"],
"editor": ["read", "write"],
"viewer": ["read"],
}def can_access(user: User, resource: Resource) -> bool:
return (
user.department == resource.department
and user.clearance >= resource.sensitivity
)jpoutrin/product-forge
0ebe7ae
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.