modelcontextprotocol / modelcontextprotocol/servers

Security Audit: 2 finding(s) in mcp-server-filesystem

Open
#3,317 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

AgentAudit Security Audit Report

Metric Value
Package @modelcontextprotocol/server-filesystem
Version 0.6.3
Risk Score 2/100
Result safe
Findings 4 total (0 critical, 0 high, 0 medium, 2 low)
Overall Assessment

The MCP filesystem server is well-designed with strong security practices. The codebase demonstrates professional security implementation including:

✅ Comprehensive path validation with symlink resolution
✅ Strict directory access control via allowlist
✅ Atomic file operations preventing race conditions
✅ Proper handling of null bytes and path traversal attempts
✅ Detailed security comments explaining design decisions

The 2 low-severity findings are minor improvements that don't represent exploitable vulnerabilities.

Real Findings (2 low-severity issues)
1. LOW: Error messages expose internal path information

File: src/filesystem/lib.ts:87
Issue: Error messages include full filesystem paths when validation fails
Impact: Could leak directory structure in shared environments
Remediation: Consider sanitizing error messages in production mode

2. LOW: NPX usage without version pinning in documentation

File: README.md:243
Issue: Documentation shows npx -y @modelcontextprotocol/server-filesystem without version pinning
Impact: Supply chain risk if malicious version published
Remediation: Update docs to recommend version pinning for production: npx -y @modelcontextprotocol/server-filesystem@0.6.3

By-Design Security Patterns (Informational)

These are intentional features that require careful user configuration but are not vulnerabilities:

  1. Broad filesystem permissions - By design for an MCP filesystem server. Users control allowed directories via configuration.
  2. Arbitrary path operations - Necessary functionality for AI agent file operations. Protected by path validation.
Recommendations
  1. For Documentation: Add version pinning examples to README
  2. For Error Handling: Implement a debug mode flag to toggle verbose vs. sanitized errors
  3. For Users: Always restrict allowed directories to minimum necessary paths; use Docker read-only mounts where possible
Full Report

View the complete audit report with code-level details and evidence:
AgentAudit Report


This audit was performed automatically by AgentAudit, the security registry for AI agent packages. The findings are based on code review of commit 70c549b.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/filesystem/lib.ts:87 to inspect how validation errors expose full paths, then review README.md:243 for the unpinned npx example. Done means the error handling has an agreed production-safe behavior and the documentation recommends a pinned package version.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
documentation, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.