🐞 Bug Summary
When registering an authless MCP server (no authentication needed), the API returns:
String should match pattern '^[a-zA-Z_][a-zA-Z0-9_\-]*$'
This validation error comes from the auth_query_param_key field in GatewayCreate and GatewayUpdate schemas.
🧩 Affected Component
Select the area of the project impacted:
🔁 Steps to Reproduce
#### UI Reproduction Steps
- Access the admin UI
- Navigate to the Gateways tab
- Fill the MCP form with a valid MCP server, with authentication type=none and no CA certificate
- Submit the form
- Verify the form validation errors
#### API Reproduction Steps
-
Generate a valid JWT token for authentication:
export TOKEN=$(python -m mcpgateway.utils.create_jwt_token --username admin@example.com --exp 10080 --secret your-secret-key)
-
Attempt to register an authless MCP server via POST /gateways:
curl -X POST http://localhost:4444/gateways \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "test-authless-server",
"url": "http://localhost:9000",
"auth_type": "none"
}'
-
Observe the validation error response:
{"detail":[{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%
-
Confirm the same error occurs with explicit null:
# With explicit null
curl -X POST http://localhost:8000/gateways \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "test-authless-server",
"url": "http://localhost:9000",
"auth_type": "none",
"auth_query_param_key": null
}'
- Observe the validation error response:
{"detail":[{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%
- Confirm the validation error occurs with an empty string:
# With empty string
curl -X POST http://localhost:8000/gateways \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "test-authless-server",
"url": "http://localhost:9000",
"auth_type": "none",
"auth_query_param_key": ""
}'
- Observe the validation error response:
{"detail":[{"type":"string_pattern_mismatch","loc":["body","auth_query_param_key"],"msg":"String should match pattern '^[a-zA-Z_][a-zA-Z0-9_\\-]*$'","input":"","ctx":{"pattern":"^[a-zA-Z_][a-zA-Z0-9_\\-]*$"}},{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%
🤔 Expected Behavior
The MCP server should be registered successfully.
🐞 Bug Summary
When registering an authless MCP server (no authentication needed), the API returns:
This validation error comes from the
auth_query_param_keyfield inGatewayCreateandGatewayUpdateschemas.🧩 Affected Component
Select the area of the project impacted:
mcpgateway- APImcpgateway- UI (admin panel)mcpgateway.wrapper- stdio wrapper🔁 Steps to Reproduce
#### UI Reproduction Steps
#### API Reproduction Steps
Generate a valid JWT token for authentication:
export TOKEN=$(python -m mcpgateway.utils.create_jwt_token --username admin@example.com --exp 10080 --secret your-secret-key)Attempt to register an authless MCP server via POST /gateways:
Observe the validation error response:
{"detail":[{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%Confirm the same error occurs with explicit null:
{"detail":[{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%{"detail":[{"type":"string_pattern_mismatch","loc":["body","auth_query_param_key"],"msg":"String should match pattern '^[a-zA-Z_][a-zA-Z0-9_\\-]*$'","input":"","ctx":{"pattern":"^[a-zA-Z_][a-zA-Z0-9_\\-]*$"}},{"type":"value_error","loc":["body","auth_value"],"msg":"Value error, Invalid 'auth_type'. Must be one of: basic, bearer, oauth, authheaders, or query_param.","input":null,"ctx":{"error":{}}}]}%🤔 Expected Behavior
The MCP server should be registered successfully.