modelcontextprotocol / modelcontextprotocol/servers

Security Audit: Unconstrained string parameters across all official servers

Open
#3,537 16 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

Summary

I ran automated security audits on 7 official MCP servers using mcp-security-audit. All servers scored Grade A or B (85-100/100), which is great. But there's one consistent finding across every server except mcp-server-fetch:

No string parameters use maxLength, pattern, or enum constraints.

Findings

Server Score Unconstrained Strings
Fetch 100/100 0
SQLite 95/100 5 (SQL queries, table names)
Time 95/100 4 (timezone identifiers)
GitHub 94/100 Multiple
Memory 92/100 1 (search query)
Git 90/100 18 (paths, messages, branches)
Filesystem 85/100 Multiple (paths)

Why this matters

  1. DoS vector — Unconstrained strings accept arbitrarily long input. A 10MB commit message or 50K-char file path must be processed by the server.
  2. No boundary validation — If an LLM is compromised via prompt injection, the tool schema provides no defense against malformed input.
  3. Network transports — With MCP supporting Streamable HTTP, servers may be network-exposed where these constraints become critical.

Suggested fix

One line per parameter:

{
  "name": "path",
  "type": "string",
  "maxLength": 4096
}

For known-format params:

{
  "name": "timezone",
  "type": "string",
  "pattern": "^[A-Za-z_/]+$",
  "maxLength": 50
}

Full reports

Individual JSON/text reports for each server: LuciferForge/mcp-audit-reports

The audit tool: pip install mcp-security-audit

Happy to discuss findings or help with fixes.

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 by reviewing the linked mcp-audit-reports for the seven official servers and reproducing the findings with mcp-security-audit. Inventory the unconstrained string parameters across SQLite, Time, GitHub, Memory, Git, and Filesystem, then verify that appropriate schema constraints address the reported findings without changing Fetch's already passing result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.