mcp-security

Validate MCP tool schemas and handlers against security risks.

20|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/thejefflarson/soundcheck --skill mcp-security-thejefflarson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-security
Source: https://github.com/thejefflarson/soundcheck/tree/main/.claude/skills/mcp-security
Command: npx skills add https://github.com/thejefflarson/soundcheck --skill mcp-security-thejefflarson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents MCP tool handlers from being exploited via malicious inputs, hardcoded secrets, unrestricted file access, or shell injection.

Core Features & Use Cases

  • Enforces strict input validation on tool schemas (string parameters with maxLength, pattern, or enum)
  • Canonicalizes and confines file paths to a trusted base directory to prevent path traversal
  • Uses argument lists for shell execution to avoid shell=True with user input
  • Ensures secrets are sourced from the environment or a secrets manager rather than hardcoded
  • Audits and logs every invocation for accountability and traceability

Quick Start

Configure your MCP tool definitions to validate inputs, restrict filesystem access, and enable audit logging.

Frequently Asked Questions about mcp-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure MCP tool handlers against shell injection and path traversal?

To secure MCP tool handlers, constrain string parameters with maxLength or pattern validation, canonicalize file paths to a trusted base directory, and execute shell commands via argument lists instead of shell=True.

What is the best way to prevent malicious inputs from exploiting MCP server definitions?

Preventing malicious inputs in MCP server definitions requires strict schema validation using enum constraints for string parameters, ensuring tool schemas reject unrestricted or unvalidated user data before it reaches handlers.

How do I manage secrets in MCP tool configurations without hardcoding them?

Managing secrets in MCP tool configurations safely means sourcing sensitive values from the environment or a dedicated secrets manager rather than embedding them directly in server definitions or handler code.

Can I add audit logging to MCP tool invocations for accountability?

Yes, you can add audit logging to MCP tool invocations by configuring server definitions to record every handler call, ensuring traceability and accountability for tool access involving file system, shell, or network operations.

Does this approach work with MCP servers that expose file system and network access in Claude Code?

Yes, this approach specifically targets MCP servers exposing file system, shell, or network access in Claude Code by confining file paths to trusted directories and validating inputs to prevent exploitation of those handlers.

Why do my MCP tool schemas allow unrestricted file access and how do I restrict it?

Unrestricted file access often occurs when tool schemas lack path canonicalization; restricting it requires confining file paths to a trusted base directory and applying strict input validation to prevent path traversal attacks.