convertMCPServerConfig converts a database MCP server config to the SDK type. Secrets are never returned; only has_* booleans are set. Admin-only fields (OAuth2 client ID, auth URLs, etc.) are included.
(config database.MCPServerConfig)
| 1246 | // SDK type. Secrets are never returned; only has_* booleans are set. |
| 1247 | // Admin-only fields (OAuth2 client ID, auth URLs, etc.) are included. |
| 1248 | func convertMCPServerConfig(config database.MCPServerConfig) codersdk.MCPServerConfig { |
| 1249 | return codersdk.MCPServerConfig{ |
| 1250 | ID: config.ID, |
| 1251 | DisplayName: config.DisplayName, |
| 1252 | Slug: config.Slug, |
| 1253 | Description: config.Description, |
| 1254 | IconURL: config.IconURL, |
| 1255 | |
| 1256 | Transport: config.Transport, |
| 1257 | URL: config.Url, |
| 1258 | |
| 1259 | AuthType: config.AuthType, |
| 1260 | OAuth2ClientID: config.OAuth2ClientID, |
| 1261 | HasOAuth2Secret: config.OAuth2ClientSecret != "", |
| 1262 | OAuth2AuthURL: config.OAuth2AuthURL, |
| 1263 | OAuth2TokenURL: config.OAuth2TokenURL, |
| 1264 | OAuth2Scopes: config.OAuth2Scopes, |
| 1265 | |
| 1266 | APIKeyHeader: config.APIKeyHeader, |
| 1267 | HasAPIKey: config.APIKeyValue != "", |
| 1268 | |
| 1269 | HasCustomHeaders: len(config.CustomHeaders) > 0 && config.CustomHeaders != "{}", |
| 1270 | |
| 1271 | ToolAllowList: coalesceStringSlice(config.ToolAllowList), |
| 1272 | ToolDenyList: coalesceStringSlice(config.ToolDenyList), |
| 1273 | |
| 1274 | Availability: config.Availability, |
| 1275 | |
| 1276 | Enabled: config.Enabled, |
| 1277 | ModelIntent: config.ModelIntent, |
| 1278 | AllowInPlanMode: config.AllowInPlanMode, |
| 1279 | ForwardCoderHeaders: config.ForwardCoderHeaders, |
| 1280 | CreatedAt: config.CreatedAt, |
| 1281 | UpdatedAt: config.UpdatedAt, |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | // convertMCPServerConfigRedacted is the same as convertMCPServerConfig |
| 1286 | // but strips admin-only fields (OAuth2 details, API key header) for |
no test coverage detected