@@ -106,6 +106,10 @@ func TimeoutPositive(timeout int, fieldName, jsonPath string) *ValidationError {
106106
107107// MountFormat validates a mount specification in the format "source:dest:mode"
108108// Returns nil if valid, *ValidationError if invalid
109+ // Per MCP Gateway specification v1.7.0 section 4.1.5:
110+ // - Host path MUST be an absolute path
111+ // - Container path MUST be an absolute path
112+ // - Mode MUST be either "ro" (read-only) or "rw" (read-write)
109113func MountFormat (mount , jsonPath string , index int ) * ValidationError {
110114 parts := strings .Split (mount , ":" )
111115 if len (parts ) != 3 {
@@ -125,7 +129,17 @@ func MountFormat(mount, jsonPath string, index int) *ValidationError {
125129 Field : "mounts" ,
126130 Message : fmt .Sprintf ("mount source cannot be empty in '%s'" , mount ),
127131 JSONPath : fmt .Sprintf ("%s.mounts[%d]" , jsonPath , index ),
128- Suggestion : "Provide a valid source path" ,
132+ Suggestion : "Provide a valid absolute source path (e.g., '/host/path')" ,
133+ }
134+ }
135+
136+ // Validate source is an absolute path (MCP spec requirement)
137+ if ! strings .HasPrefix (source , "/" ) {
138+ return & ValidationError {
139+ Field : "mounts" ,
140+ Message : fmt .Sprintf ("mount source must be an absolute path, got '%s'" , source ),
141+ JSONPath : fmt .Sprintf ("%s.mounts[%d]" , jsonPath , index ),
142+ Suggestion : "Use an absolute path starting with '/' (e.g., '/var/data' instead of 'data')" ,
129143 }
130144 }
131145
@@ -135,7 +149,17 @@ func MountFormat(mount, jsonPath string, index int) *ValidationError {
135149 Field : "mounts" ,
136150 Message : fmt .Sprintf ("mount destination cannot be empty in '%s'" , mount ),
137151 JSONPath : fmt .Sprintf ("%s.mounts[%d]" , jsonPath , index ),
138- Suggestion : "Provide a valid destination path" ,
152+ Suggestion : "Provide a valid absolute destination path (e.g., '/app/data')" ,
153+ }
154+ }
155+
156+ // Validate dest is an absolute path (MCP spec requirement)
157+ if ! strings .HasPrefix (dest , "/" ) {
158+ return & ValidationError {
159+ Field : "mounts" ,
160+ Message : fmt .Sprintf ("mount destination must be an absolute path, got '%s'" , dest ),
161+ JSONPath : fmt .Sprintf ("%s.mounts[%d]" , jsonPath , index ),
162+ Suggestion : "Use an absolute path starting with '/' (e.g., '/app/data' instead of 'app/data')" ,
139163 }
140164 }
141165
0 commit comments