MCPcopy Index your code
hub / github.com/coder/coder / MCPServerConfig

Function MCPServerConfig

coderd/database/dbgen/dbgen.go:320–364  ·  view source on GitHub ↗
(t testing.TB, db database.Store, seed database.MCPServerConfig)

Source from the content-addressed store, hash-verified

318}
319
320func MCPServerConfig(t testing.TB, db database.Store, seed database.MCPServerConfig) database.MCPServerConfig {
321 t.Helper()
322
323 // CreatedBy and UpdatedBy are user FKs, so default fixtures create a user.
324 createdBy := seed.CreatedBy.UUID
325 if createdBy == uuid.Nil {
326 createdBy = User(t, db, database.User{}).ID
327 }
328 updatedBy := seed.UpdatedBy.UUID
329 if updatedBy == uuid.Nil {
330 updatedBy = createdBy
331 }
332
333 cfg, err := db.InsertMCPServerConfig(genCtx, database.InsertMCPServerConfigParams{
334 DisplayName: takeFirst(seed.DisplayName, "Test MCP Server"),
335 Slug: takeFirst(seed.Slug, testutil.GetRandomName(t)),
336 Description: seed.Description,
337 IconURL: seed.IconURL,
338 Transport: takeFirst(seed.Transport, "streamable_http"),
339 Url: takeFirst(seed.Url, "https://mcp.example.com"),
340 AuthType: takeFirst(seed.AuthType, "none"),
341 OAuth2ClientID: seed.OAuth2ClientID,
342 OAuth2ClientSecret: seed.OAuth2ClientSecret,
343 OAuth2ClientSecretKeyID: seed.OAuth2ClientSecretKeyID,
344 OAuth2AuthURL: seed.OAuth2AuthURL,
345 OAuth2TokenURL: seed.OAuth2TokenURL,
346 OAuth2Scopes: seed.OAuth2Scopes,
347 APIKeyHeader: seed.APIKeyHeader,
348 APIKeyValue: seed.APIKeyValue,
349 APIKeyValueKeyID: seed.APIKeyValueKeyID,
350 CustomHeaders: seed.CustomHeaders,
351 CustomHeadersKeyID: seed.CustomHeadersKeyID,
352 ToolAllowList: takeFirstSlice(seed.ToolAllowList, []string{}),
353 ToolDenyList: takeFirstSlice(seed.ToolDenyList, []string{}),
354 Availability: takeFirst(seed.Availability, "default_off"),
355 Enabled: takeFirst(seed.Enabled, true),
356 ModelIntent: seed.ModelIntent,
357 AllowInPlanMode: seed.AllowInPlanMode,
358 ForwardCoderHeaders: seed.ForwardCoderHeaders,
359 CreatedBy: createdBy,
360 UpdatedBy: updatedBy,
361 })
362 require.NoError(t, err, "insert MCP server config")
363 return cfg
364}
365
366func ConnectionLog(t testing.TB, db database.Store, seed database.UpsertConnectionLogParams) database.ConnectionLog {
367 arg := database.UpsertConnectionLogParams{

Calls 6

GetRandomNameFunction · 0.92
takeFirstSliceFunction · 0.85
UserFunction · 0.70
takeFirstFunction · 0.70
HelperMethod · 0.65
InsertMCPServerConfigMethod · 0.65