From cdf4d750ef0b87f96686ec6f599654809b879518 Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Mon, 31 Aug 2026 16:54:21 -0700 Subject: [PATCH] Make MCP working-directory validation regex-portable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the 1.1.0 `cwd` regular expression with direct `anyOf` alternatives for the forms defined by ยง7.2.1. Use `const` for exact `${PLUGIN_ROOT}` and `${PLUGIN_DATA}` values and simple prefix patterns for rooted paths so validators do not depend on noncapturing groups or engine-specific `$` behavior. --- schemas/1.1.0/mcp.schema.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/schemas/1.1.0/mcp.schema.json b/schemas/1.1.0/mcp.schema.json index b9367db..4a1e425 100644 --- a/schemas/1.1.0/mcp.schema.json +++ b/schemas/1.1.0/mcp.schema.json @@ -64,7 +64,23 @@ }, "cwd": { "type": "string", - "pattern": "^(?:\\./|\\$\\{PLUGIN_ROOT\\}(?:/|$)|\\$\\{PLUGIN_DATA\\}(?:/|$))", + "anyOf": [ + { + "pattern": "^\\./" + }, + { + "const": "${PLUGIN_ROOT}" + }, + { + "pattern": "^\\$\\{PLUGIN_ROOT\\}/" + }, + { + "const": "${PLUGIN_DATA}" + }, + { + "pattern": "^\\$\\{PLUGIN_DATA\\}/" + } + ], "description": "Plugin-relative, PLUGIN_ROOT-rooted, or PLUGIN_DATA-rooted working directory. Filesystem containment is validated separately." } },