Skip to content

Commit 04fb522

Browse files
authored
feat: mcp url (#4186)
2 parents 34aa1da + 07f2f2d commit 04fb522

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

internal/start/start.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ type kongConfig struct {
7979
RestId string
8080
RealtimeId string
8181
StorageId string
82+
StudioId string
8283
PgmetaId string
8384
EdgeRuntimeId string
8485
LogflareId string
@@ -340,6 +341,7 @@ EOF
340341
RestId: utils.RestId,
341342
RealtimeId: utils.Config.Realtime.TenantId,
342343
StorageId: utils.StorageId,
344+
StudioId: utils.StudioId,
343345
PgmetaId: utils.PgmetaId,
344346
EdgeRuntimeId: utils.EdgeRuntimeId,
345347
LogflareId: utils.LogflareId,

internal/start/templates/kong.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,13 @@ services:
226226
add:
227227
headers:
228228
- "Authorization: {{ .BearerToken }}"
229+
- name: mcp
230+
_comment: "MCP: /mcp -> http://studio:3000/api/mcp"
231+
url: http://{{ .StudioId }}:3000/api/mcp
232+
routes:
233+
- name: mcp
234+
strip_path: true
235+
paths:
236+
- /mcp
237+
plugins:
238+
- name: cors

internal/status/status.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type CustomName struct {
2828
ApiURL string `env:"api.url,default=API_URL"`
2929
GraphqlURL string `env:"api.graphql_url,default=GRAPHQL_URL"`
3030
StorageS3URL string `env:"api.storage_s3_url,default=STORAGE_S3_URL"`
31+
McpURL string `env:"api.mcp_url,default=MCP_URL"`
3132
DbURL string `env:"db.url,default=DB_URL"`
3233
StudioURL string `env:"studio.url,default=STUDIO_URL"`
3334
InbucketURL string `env:"inbucket.url,default=INBUCKET_URL,deprecated"`
@@ -46,25 +47,35 @@ func (c *CustomName) toValues(exclude ...string) map[string]string {
4647
values := map[string]string{
4748
c.DbURL: fmt.Sprintf("postgresql://%s@%s:%d/postgres", url.UserPassword("postgres", utils.Config.Db.Password), utils.Config.Hostname, utils.Config.Db.Port),
4849
}
49-
if utils.Config.Api.Enabled && !utils.SliceContains(exclude, utils.RestId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Api.Image)) {
50+
51+
apiEnabled := utils.Config.Api.Enabled && !utils.SliceContains(exclude, utils.RestId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Api.Image))
52+
studioEnabled := utils.Config.Studio.Enabled && !utils.SliceContains(exclude, utils.StudioId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Studio.Image))
53+
authEnabled := utils.Config.Auth.Enabled && !utils.SliceContains(exclude, utils.GotrueId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Auth.Image))
54+
inbucketEnabled := utils.Config.Inbucket.Enabled && !utils.SliceContains(exclude, utils.InbucketId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Inbucket.Image))
55+
storageEnabled := utils.Config.Storage.Enabled && !utils.SliceContains(exclude, utils.StorageId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Storage.Image))
56+
57+
if apiEnabled {
5058
values[c.ApiURL] = utils.Config.Api.ExternalUrl
5159
values[c.GraphqlURL] = utils.GetApiUrl("/graphql/v1")
60+
if studioEnabled {
61+
values[c.McpURL] = utils.GetApiUrl("/mcp")
62+
}
5263
}
53-
if utils.Config.Studio.Enabled && !utils.SliceContains(exclude, utils.StudioId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Studio.Image)) {
64+
if studioEnabled {
5465
values[c.StudioURL] = fmt.Sprintf("http://%s:%d", utils.Config.Hostname, utils.Config.Studio.Port)
5566
}
56-
if utils.Config.Auth.Enabled && !utils.SliceContains(exclude, utils.GotrueId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Auth.Image)) {
67+
if authEnabled {
5768
values[c.PublishableKey] = utils.Config.Auth.PublishableKey.Value
5869
values[c.SecretKey] = utils.Config.Auth.SecretKey.Value
5970
values[c.JWTSecret] = utils.Config.Auth.JwtSecret.Value
6071
values[c.AnonKey] = utils.Config.Auth.AnonKey.Value
6172
values[c.ServiceRoleKey] = utils.Config.Auth.ServiceRoleKey.Value
6273
}
63-
if utils.Config.Inbucket.Enabled && !utils.SliceContains(exclude, utils.InbucketId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Inbucket.Image)) {
74+
if inbucketEnabled {
6475
values[c.MailpitURL] = fmt.Sprintf("http://%s:%d", utils.Config.Hostname, utils.Config.Inbucket.Port)
6576
values[c.InbucketURL] = fmt.Sprintf("http://%s:%d", utils.Config.Hostname, utils.Config.Inbucket.Port)
6677
}
67-
if utils.Config.Storage.Enabled && !utils.SliceContains(exclude, utils.StorageId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Storage.Image)) {
78+
if storageEnabled {
6879
values[c.StorageS3URL] = utils.GetApiUrl("/storage/v1/s3")
6980
values[c.StorageS3AccessKeyId] = utils.Config.Storage.S3Credentials.AccessKeyId
7081
values[c.StorageS3SecretAccessKey] = utils.Config.Storage.S3Credentials.SecretAccessKey
@@ -202,6 +213,7 @@ func PrettyPrint(w io.Writer, exclude ...string) {
202213
ApiURL: " " + utils.Aqua("API URL"),
203214
GraphqlURL: " " + utils.Aqua("GraphQL URL"),
204215
StorageS3URL: " " + utils.Aqua("S3 Storage URL"),
216+
McpURL: " " + utils.Aqua("MCP URL"),
205217
DbURL: " " + utils.Aqua("Database URL"),
206218
StudioURL: " " + utils.Aqua("Studio URL"),
207219
InbucketURL: " " + utils.Aqua("Inbucket URL"),

pkg/config/templates/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM library/kong:2.8.1 AS kong
55
FROM axllent/mailpit:v1.22.3 AS mailpit
66
FROM postgrest/postgrest:v13.0.7 AS postgrest
77
FROM supabase/postgres-meta:v0.91.6 AS pgmeta
8-
FROM supabase/studio:2025.09.22-sha-7b3007d AS studio
8+
FROM supabase/studio:2025.09.23-sha-081a753 AS studio
99
FROM darthsim/imgproxy:v3.8.0 AS imgproxy
1010
FROM supabase/edge-runtime:v1.69.12 AS edgeruntime
1111
FROM timberio/vector:0.28.1-alpine AS vector

0 commit comments

Comments
 (0)