Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor!: drop the mode-contents half of GetMCPInfo (#21324)

Vincent Huang3ce47ef2a127
diff --git a/backend/api/auth/mcp_ceiling.go b/backend/api/auth/mcp_ceiling.go
index 907a3479ac..8048287bac 100644
--- a/backend/api/auth/mcp_ceiling.go
+++ b/backend/api/auth/mcp_ceiling.go
@@ -5,10 +5,10 @@ import storepb "github.com/bytebase/bytebase/backend/generated-go/store"
// MCPCeilingVerdict is what a read of a workspace's MCP capability ceiling
// means to a caller deciding whether to proceed. Every reader of the setting
// decides from it — the consent, the token endpoint, the /mcp connection gate,
-// the per-request gate, and the mode-contents read — so no two can disagree
-// about a workspace. Every door but the mode-contents read says so with
-// Refusal; that one answers the policy verdicts in its response body and keeps
-// Refusal for the outage (BOT-106).
+// the per-request gate, and the MCP info read — so no two can disagree about a
+// workspace. Every door but the info read says so with Refusal; that one
+// answers the policy verdicts in its response body and keeps Refusal for the
+// outage (BOT-106).
type MCPCeilingVerdict int
// Each value names what an admin would have to do about it, which is what the
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 7a7d2cb6fd..1664d7f4ac 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -8084,9 +8084,8 @@ paths:
- bytebase.v1.WorkspaceService
summary: |-
Gets what MCP (Model Context Protocol) does in this workspace: the
- capability ceiling in force, what each ceiling serves, and the per-engine
- facts a read-only session depends on. The workspace is resolved from the
- authenticated session.
+ capability ceiling in force, and whether masking narrows what a session
+ reads under it. The workspace is resolved from the authenticated session.
description: |-
Served to MCP sessions. An agent asking what it may do here is the point:
the response says nothing a session's own denials do not already say, one
@@ -15616,21 +15615,6 @@ components:
title: LogoutRequest
additionalProperties: false
description: Request to logout current user session.
- bytebase.v1.MCPCapabilityMode:
- type: object
- properties:
- capability:
- title: capability
- $ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'
- servedClasses:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPMethodClass'
- title: served_classes
- description: Empty means the ceiling serves nothing, which is what DISABLED is.
- title: MCPCapabilityMode
- additionalProperties: false
- description: MCPCapabilityMode is one ceiling and the method classes it serves.
bytebase.v1.MCPDelegation:
type: object
properties:
@@ -15703,49 +15687,6 @@ components:
that contradicts its class. Neither is expressible now, and the one check
left — the reason belongs to the class it is used on — is a table the gate
already keeps for the wording.
- bytebase.v1.MCPEngineEnforcement:
- type: object
- properties:
- engine:
- title: engine
- $ref: '#/components/schemas/bytebase.v1.Engine'
- readOnlyDepth:
- title: read_only_depth
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth'
- masking:
- title: masking
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement.Masking'
- note:
- type: string
- title: note
- description: |-
- Where the answers above are the floor rather than the whole story. Empty
- for most engines.
- title: MCPEngineEnforcement
- additionalProperties: false
- description: |-
- MCPEngineEnforcement is what the read-only ceiling and the masking toggle
- reach on one database engine.
- bytebase.v1.MCPEngineEnforcement.Masking:
- type: string
- title: Masking
- enum:
- - MASKING_UNSPECIFIED
- - NONE
- - COLUMN
- - DOCUMENT
- description: |-
- How Bytebase masks results on this engine, which is what decides whether
- ignoring masking exemptions changes anything here.
- bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth:
- type: string
- title: ReadOnlyDepth
- enum:
- - READ_ONLY_DEPTH_UNSPECIFIED
- - UNSUPPORTED
- - STATEMENT
- - STATEMENT_AND_SESSION
- description: How much of a read-only ceiling this engine can be held to.
bytebase.v1.MCPInfo:
type: object
properties:
@@ -15759,106 +15700,37 @@ components:
capability:
title: capability
description: |-
- The ceiling in force for this workspace. A value no row in modes serves,
- CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
- the stored row and every MCP connection is refused.
+ The ceiling in force for this workspace. Any value outside the enum this
+ build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+ resolved from the stored row and every MCP connection is refused. A stored
+ name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+ release wrote arrives verbatim.
$ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'
- modes:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPCapabilityMode'
- title: modes
- description: |-
- What each ceiling serves, including the one in force, so an admin can
- compare the choices rather than only read the current answer.
- methods:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPMethod'
- title: methods
- description: |-
- Every API method some ceiling serves. A mode serves a method when the
- method's class is one of that mode's served_classes, which is the ceiling
- rule the gate evaluates. Methods no ceiling serves are absent.
-
- Being listed is necessary, not sufficient. The caller still needs the
- permission, and two further rules narrow what a served method does: a
- handful of methods are refused on the shape of the request (an issue that
- would grant a permission, a rollout that skips approval), and under
- READ_ONLY every statement SQLService/Query runs must classify as a read.
- engines:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement'
- title: engines
- description: |-
- What a read-only session and the masking toggle actually reach, per engine.
- Both are engine-conditional in ways the ceiling alone does not show.
ignoreMaskingExemptions:
type: boolean
title: ignore_masking_exemptions
description: |-
Whether this workspace stops applying the caller's own unmasking
- provisioning to MCP requests. It decides which branch of each engine's
- masking state a caller is in, and no other API tells an MCP session:
- SettingService/GetSetting is served by no ceiling.
+ provisioning to MCP requests. It narrows what a session reads only where
+ Bytebase masks by column and consults exemptions; elsewhere it suppresses
+ nothing.
dataMaskingAvailable:
type: boolean
title: data_masking_available
description: |-
Whether data masking is licensed for this workspace. When false nothing is
- masked whatever an engine supports, so the masking states below describe a
- mechanism that does not run. Licensing can also be set per instance, so a
- true here is the workspace answer, not a promise about every instance.
+ masked whatever an engine supports, so the toggle above suppresses nothing.
+ Licensing can also be set per instance, so a true here is the workspace
+ answer, not a promise about every instance.
title: MCPInfo
additionalProperties: false
description: |-
- MCPInfo is what MCP does in this workspace: the ceiling in force, what each
- ceiling serves, and the per-engine facts a read-only session depends on.
+ MCPInfo is what MCP does in this workspace: the ceiling in force, and
+ whether masking narrows what a session reads under it.
- Everything here is resolved when the request is served, never from a stored
- copy: the method list comes off the compiled API descriptors and the engine
- answers off the code that enforces them, so a build whose rules changed
- cannot describe the rules of the build before it.
- bytebase.v1.MCPMethod:
- type: object
- properties:
- method:
- type: string
- title: method
- description: |-
- The method as an audit entry names it, so a denial can be found by it.
- Example: /bytebase.v1.SQLService/Query
- operationId:
- type: string
- title: operation_id
- description: |-
- The same method as call_api takes it.
- Example: bytebase.v1.SQLService.Query
- class:
- title: class
- $ref: '#/components/schemas/bytebase.v1.MCPMethodClass'
- permission:
- type: string
- title: permission
- description: |-
- The IAM permission the method declares. The ceiling never grants: a session
- may call a served method only where the person it acts for could.
-
- Empty means the method declares no permission, which is NOT the same as
- needing none — a method that authorizes inside its handler declares nothing
- here. auth_method says which case an empty value is.
- authMethod:
- title: auth_method
- description: |-
- How the method authorizes. IAM means the permission above is the primary
- rule, though not always the only one — an update carrying allow_missing
- additionally requires the matching create permission. CUSTOM means the
- handler decides and the permission field is silent.
- $ref: '#/components/schemas/bytebase.v1.AuthMethod'
- title: MCPMethod
- additionalProperties: false
- description: MCPMethod is one API method an MCP session can reach, and what decides it.
+ This is the only API a served MCP session or the consent page can read the
+ ceiling from. SettingService/GetSetting is served by no ceiling, and its
+ answer is cached besides.
bytebase.v1.MCPMethodClass:
type: string
title: MCPMethodClass
diff --git a/backend/api/mcp/tool_query.go b/backend/api/mcp/tool_query.go
index cfb5f88c0e..852cb8c2e0 100644
--- a/backend/api/mcp/tool_query.go
+++ b/backend/api/mcp/tool_query.go
@@ -60,7 +60,7 @@ query_database(database="employee", instance="projects/hr/instances/prod-pg", st
**Notes:**
- Masked data: a masked column reads back as "******". That is a placeholder, not a value anything holds, so never write it back and never filter on it. Any statement containing it is refused.
-- Workspace ceiling: the workspace's MCP policy decides what is served here, and under a read-only ceiling any statement that is not a read is refused whole. Read it with call_api(operationId="bytebase.v1.WorkspaceService.GetMCPInfo") — it also reports how deeply read-only is enforced on each engine.`
+- Workspace ceiling: the workspace's MCP policy decides what is served here, and under a read-only ceiling any statement that is not a read is refused whole. Read it with call_api(operationId="bytebase.v1.WorkspaceService.GetMCPInfo").`
func (s *Server) registerQueryTool() {
mcp.AddTool(s.mcpServer, &mcp.Tool{
diff --git a/backend/api/v1/audit_redact_inventory_test.go b/backend/api/v1/audit_redact_inventory_test.go
index 622f89be84..2337851ff4 100644
--- a/backend/api/v1/audit_redact_inventory_test.go
+++ b/backend/api/v1/audit_redact_inventory_test.go
@@ -691,11 +691,7 @@ var auditRecordedFields = []string{
"bytebase.v1.MCPDelegation.correlation_id",
"bytebase.v1.MCPDelegation.resource",
"bytebase.v1.MCPDelegation.scope",
- "bytebase.v1.MCPEngineEnforcement.note",
"bytebase.v1.MCPInfo.workspace",
- "bytebase.v1.MCPMethod.method",
- "bytebase.v1.MCPMethod.operation_id",
- "bytebase.v1.MCPMethod.permission",
"bytebase.v1.MaskingExemptionPolicy.Exemption.members",
"bytebase.v1.MaskingReason.algorithm",
"bytebase.v1.MaskingReason.context",
diff --git a/backend/api/v1/common.go b/backend/api/v1/common.go
index 67601a03b4..5a5500ac2d 100644
--- a/backend/api/v1/common.go
+++ b/backend/api/v1/common.go
@@ -209,7 +209,12 @@ func normalizeFilter(filter string) (string, []string, error) {
}
func convertToEngine(engine storepb.Engine) v1pb.Engine {
+ // A missing arm reports as unspecified, which reads as "Bytebase does not
+ // know this engine". golangci checks only switches that ask for it
+ // (.golangci.yaml, explicit-exhaustive-switch).
+ //exhaustive:enforce
switch engine {
+ case storepb.Engine_ENGINE_UNSPECIFIED:
case storepb.Engine_CLICKHOUSE:
return v1pb.Engine_CLICKHOUSE
case storepb.Engine_MYSQL:
diff --git a/backend/api/v1/document_masking_test.go b/backend/api/v1/document_masking_test.go
new file mode 100644
index 0000000000..ffc0f3eb4f
--- /dev/null
+++ b/backend/api/v1/document_masking_test.go
@@ -0,0 +1,32 @@
+package v1
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/backend/common"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+)
+
+// TestMaskersAreDisjoint holds the two masking registries apart across every
+// engine the build knows.
+//
+// The query path checks the document masker first and reaches the column masker
+// only in the else arm of queryRetry's masking block (sql_service.go), so an
+// engine in both sets would take the document path and never be column-masked
+// there. Nothing else asserts this; the branch order alone decides it.
+func TestMaskersAreDisjoint(t *testing.T) {
+ values := storepb.Engine(0).Descriptor().Values()
+ document := 0
+ for i := range values.Len() {
+ engine := storepb.Engine(values.Get(i).Number())
+ if getDocumentMasker(engine) == nil {
+ continue
+ }
+ document++
+ require.False(t, common.EngineSupportMasking(engine),
+ "%v routes to the document masker, so the column masker is never reached", engine)
+ }
+ require.Equal(t, 3, document, "cosmosdb, mongodb, elasticsearch")
+}
diff --git a/backend/api/v1/mcp_info.go b/backend/api/v1/mcp_info.go
index 6191551a8c..12eefe4ef8 100644
--- a/backend/api/v1/mcp_info.go
+++ b/backend/api/v1/mcp_info.go
@@ -1,35 +1,25 @@
package v1
import (
- "cmp"
"context"
"log/slog"
- "slices"
- "strings"
"connectrpc.com/connect"
"github.com/pkg/errors"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/types/descriptorpb"
"github.com/bytebase/bytebase/backend/api/auth"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
- parserbase "github.com/bytebase/bytebase/backend/plugin/parser/base"
)
-// GetMCPInfo reports what MCP does in this workspace.
+// GetMCPInfo reports the MCP ceiling in force in this workspace and whether
+// masking narrows what a session reads under it.
//
-// Everything is resolved when the request is served. The method list comes off
-// the compiled descriptors — the same place the gate reads a method's class —
-// and the engine answers off the code that enforces them, so this cannot
-// describe rules the build does not run. A stored list would drift silently:
-// the first sign would be an admin acting on a mode that no longer means what
-// the page said.
+// It is the only API a served MCP session or the consent page can read the
+// ceiling from: SettingService/GetSetting is served by no ceiling, and answers
+// from the generic cache besides.
func (s *WorkspaceService) GetMCPInfo(ctx context.Context, _ *connect.Request[v1pb.GetMCPInfoRequest]) (*connect.Response[v1pb.MCPInfo], error) {
workspaceID := common.GetWorkspaceIDFromContext(ctx)
if workspaceID == "" {
@@ -37,10 +27,11 @@ func (s *WorkspaceService) GetMCPInfo(ctx context.Context, _ *connect.Request[v1
}
settings, err := s.mcpSettingsForInfo(ctx, workspaceID)
// Every verdict but an outage is answered, the refusing ceilings included:
- // the mode contents never come from the stored row, so a workspace whose
- // ceiling nothing serves still owes the repairing admin the comparison, and
- // the consent page a policy to disclose (BOT-106). capability carries the
- // refusal, as a value no row in modes serves.
+ // a workspace whose ceiling nothing serves still owes the repairing admin
+ // the value in force, and the consent page a policy to disclose (BOT-106).
+ // capability carries the refusal by arriving as a value this build does not
+ // serve — CAPABILITY_UNSPECIFIED for a stored name nothing resolves, the
+ // stored number itself for one a newer release wrote.
switch verdict := auth.ClassifyMCPCeiling(settings, err); verdict {
case auth.MCPCeilingServes, auth.MCPCeilingDisabled, auth.MCPCeilingUnserved:
default:
@@ -58,9 +49,6 @@ func (s *WorkspaceService) GetMCPInfo(ctx context.Context, _ *connect.Request[v1
return connect.NewResponse(&v1pb.MCPInfo{
Workspace: common.FormatWorkspace(workspaceID),
Capability: convertToV1MCPCapability(settings.Capability),
- Modes: mcpCapabilityModes(),
- Methods: mcpServedMethods(protoregistry.GlobalFiles),
- Engines: mcpEngineEnforcement(),
IgnoreMaskingExemptions: settings.IgnoreMaskingExemptions,
DataMaskingAvailable: s.licenseService.IsFeatureEnabled(ctx, workspaceID, v1pb.PlanFeature_FEATURE_DATA_MASKING) == nil,
}), nil
@@ -71,183 +59,11 @@ func (s *WorkspaceService) GetMCPInfo(ctx context.Context, _ *connect.Request[v1
// On the internal MCP chain the gate already resolved them and stamped them on
// the context; reading again could answer with a ceiling the request was not
// admitted under, which is the rule mcp_gate.go states and the clamp and the
-// masking check both follow. Off that chain — the console, an admin opening the
-// settings page — nothing is stamped and the store is read.
+// masking check both follow. Off that chain — the consent page, which reads
+// this before it discloses anything — nothing is stamped and the store is read.
func (s *WorkspaceService) mcpSettingsForInfo(ctx context.Context, workspaceID string) (*storepb.MCPSetting, error) {
if settings, ok := mcpSettingsFromContext(ctx); ok {
return settings, nil
}
return s.store.GetMCPSettingsUncached(ctx, workspaceID)
}
-
-// mcpCapabilityModes renders the serving table the gate evaluates, one row per
-// ceiling. It reads mcpServingClasses rather than restating it, so a mode that
-// starts or stops serving a class cannot leave this stale.
-func mcpCapabilityModes() []*v1pb.MCPCapabilityMode {
- modes := make([]*v1pb.MCPCapabilityMode, 0, len(mcpServingClasses))
- for capability, served := range mcpServingClasses {
- modes = append(modes, &v1pb.MCPCapabilityMode{
- Capability: convertToV1MCPCapability(capability),
- // Cloned: the response must not hand out the slice the gate
- // evaluates against on every request.
- ServedClasses: slices.Clone(served),
- })
- }
- slices.SortFunc(modes, func(a, b *v1pb.MCPCapabilityMode) int { return cmp.Compare(a.Capability, b.Capability) })
- return modes
-}
-
-// fileRanger is the descriptor set to resolve classifications from.
-// *protoregistry.Files satisfies it; a test supplies its own, which is what
-// lets "the response follows the descriptors" be shown rather than asserted.
-type fileRanger interface {
- RangeFiles(func(protoreflect.FileDescriptor) bool)
-}
-
-// mcpServedMethods reads every bytebase.v1 RPC's classification off the
-// descriptors and returns the ones some ceiling serves, sorted by procedure.
-//
-// Methods no ceiling serves are left out: the response answers "what can be
-// done here", and an agent handed the refused list would have to be told
-// separately that those entries are not offers.
-func mcpServedMethods(files fileRanger) []*v1pb.MCPMethod {
- var methods []*v1pb.MCPMethod
- files.RangeFiles(func(fd protoreflect.FileDescriptor) bool {
- if fd.Package() != "bytebase.v1" {
- return true
- }
- services := fd.Services()
- for i := range services.Len() {
- sd := services.Get(i)
- descriptors := sd.Methods()
- for j := range descriptors.Len() {
- md := descriptors.Get(j)
- options, ok := md.Options().(*descriptorpb.MethodOptions)
- if !ok {
- continue
- }
- class, ok := proto.GetExtension(options, v1pb.E_McpMethodClass).(v1pb.MCPMethodClass)
- if !ok {
- // A malformed annotation is not a classification. CI
- // rejects one, and no ceiling serves what it resolves to.
- continue
- }
- if auth.MCPClassIsRefused(class) {
- continue
- }
- method := &v1pb.MCPMethod{
- Method: "/" + string(sd.FullName()) + "/" + string(md.Name()),
- OperationId: string(sd.FullName()) + "." + string(md.Name()),
- Class: class,
- }
- if permission, ok := proto.GetExtension(options, v1pb.E_Permission).(string); ok {
- method.Permission = permission
- }
- if authMethod, ok := proto.GetExtension(options, v1pb.E_AuthMethod).(v1pb.AuthMethod); ok {
- method.AuthMethod = authMethod
- }
- methods = append(methods, method)
- }
- }
- return true
- })
- slices.SortFunc(methods, func(a, b *v1pb.MCPMethod) int { return strings.Compare(a.Method, b.Method) })
- return methods
-}
-
-// mcpEngineEnforcement answers, per engine, how deep a read-only ceiling goes
-// and whether masking reaches anything — the two facts the ceiling alone does
-// not show. Every engine the build knows appears, in declaration order.
-func mcpEngineEnforcement() []*v1pb.MCPEngineEnforcement {
- values := storepb.Engine(0).Descriptor().Values()
- engines := make([]*v1pb.MCPEngineEnforcement, 0, values.Len())
- for i := range values.Len() {
- engine := storepb.Engine(values.Get(i).Number())
- if engine == storepb.Engine_ENGINE_UNSPECIFIED {
- continue
- }
- engines = append(engines, &v1pb.MCPEngineEnforcement{
- Engine: convertToEngine(engine),
- ReadOnlyDepth: mcpReadOnlyDepth(engine),
- Masking: mcpMaskingSupport(engine),
- Note: mcpEngineNote(engine),
- })
- }
- return engines
-}
-
-// mcpReadOnlyDepth reports how much of a read-only ceiling this engine can be
-// held to.
-//
-// The classifier half is asked, not mirrored: parserbase.HasQueryValidator is
-// the same registry the clamp consults, so an engine that gains or loses a
-// validator moves here on the same commit.
-func mcpReadOnlyDepth(engine storepb.Engine) v1pb.MCPEngineEnforcement_ReadOnlyDepth {
- if !parserbase.HasQueryValidator(engine) {
- return v1pb.MCPEngineEnforcement_UNSUPPORTED
- }
- if readOnlyDriverSession(engine) {
- return v1pb.MCPEngineEnforcement_STATEMENT_AND_SESSION
- }
- return v1pb.MCPEngineEnforcement_STATEMENT
-}
-
-// readOnlyDriverSession reports whether this engine's driver always turns
-// ConnectionContext.ReadOnly into a read-only database session, by setting
-// default_transaction_read_only on the connection it opens. Two always do:
-// postgres and cockroachdb. Redshift does too, but only outside a datashare
-// database, which cannot run a read-only transaction — that is per database,
-// off its metadata, and this answer is per engine, so redshift is reported at
-// its floor and its note carries the rest (plugin/db/pg, /cockroachdb,
-// /redshift).
-//
-// It mirrors the drivers rather than asking them, because a driver reports this
-// by acting on a flag when a connection is opened and no connection exists
-// here. A driver that starts honoring the flag without a row here understates
-// its own depth, which is the safe way for this to be wrong.
-func readOnlyDriverSession(engine storepb.Engine) bool {
- switch engine {
- case storepb.Engine_POSTGRES, storepb.Engine_COCKROACHDB:
- return true
- default:
- return false
- }
-}
-
-// mcpMaskingSupport reports how Bytebase masks results on this engine, which is
-// what decides whether ignoring masking exemptions changes anything.
-//
-// Document first, because that is the order the query path checks them
-// (sql_service.go): an engine with a document masker never reaches the column
-// masker. Exemptions are a column-masking mechanism — the document masker's
-// interface carries neither the user nor their exemptions — so on a document
-// engine the toggle has nothing to suppress (BOT-95).
-func mcpMaskingSupport(engine storepb.Engine) v1pb.MCPEngineEnforcement_Masking {
- switch {
- case getDocumentMasker(engine) != nil:
- return v1pb.MCPEngineEnforcement_DOCUMENT
- case common.EngineSupportMasking(engine):
- return v1pb.MCPEngineEnforcement_COLUMN
- default:
- return v1pb.MCPEngineEnforcement_NONE
- }
-}
-
-// mcpEngineNote carries the cases where a per-engine answer is the floor rather
-// than the whole story.
-//
-// The console does not render this string: it keys off the engine and reads
-// settings.mcp.contents.notes.<engine> so the caveat is translated. Reword here
-// and the locale files need the same edit. Adding a note for a new engine
-// without its locale entry degrades to a line saying a caveat exists and to
-// reload, which is also what an older bundle shows against a newer server — it
-// never puts this English in a non-English console. An agent reading
-// GetMCPInfo does get this text, which is why it stays prose rather than
-// becoming an enum.
-func mcpEngineNote(engine storepb.Engine) string {
- if engine == storepb.Engine_REDSHIFT {
- return "Outside a datashare database the driver also opens the session read-only. " +
- "A datashare database cannot run a read-only transaction, so there it is statement classification alone."
- }
- return ""
-}
diff --git a/backend/api/v1/mcp_info_test.go b/backend/api/v1/mcp_info_test.go
index 6a10a36cc5..401c20442b 100644
--- a/backend/api/v1/mcp_info_test.go
+++ b/backend/api/v1/mcp_info_test.go
@@ -7,13 +7,7 @@ import (
"connectrpc.com/connect"
"github.com/stretchr/testify/require"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protodesc"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/types/descriptorpb"
- "github.com/bytebase/bytebase/backend/api/auth"
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/testcontainer"
"github.com/bytebase/bytebase/backend/component/config"
@@ -21,302 +15,14 @@ import (
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
"github.com/bytebase/bytebase/backend/migrator"
- parserbase "github.com/bytebase/bytebase/backend/plugin/parser/base"
"github.com/bytebase/bytebase/backend/store"
)
-// TestMCPInfoResolvesMethodsLive shows that the served-method list follows the
-// descriptors rather than any copy of them: the same resolver, run over two
-// descriptor sets differing only in one method's mcp_method_class annotation,
-// answers differently.
-//
-// This is the property the API exists for. A stored or hand-kept list would
-// pass every assertion below on the day it was written and drift silently
-// afterwards, and the first sign would be an admin choosing a mode from a page
-// that described the build before this one.
-func TestMCPInfoResolvesMethodsLive(t *testing.T) {
- asRead := mcpServedMethods(descriptorsClassifying(t, v1pb.MCPMethodClass_READ))
- require.Len(t, asRead, 1)
- require.Equal(t, "/bytebase.v1.LiveResolutionService/Probe", asRead[0].Method)
- require.Equal(t, v1pb.MCPMethodClass_READ, asRead[0].Class)
- require.Equal(t, "bb.probes.get", asRead[0].Permission)
-
- asWrite := mcpServedMethods(descriptorsClassifying(t, v1pb.MCPMethodClass_WRITE))
- require.Len(t, asWrite, 1)
- require.Equal(t, v1pb.MCPMethodClass_WRITE, asWrite[0].Class,
- "the response must move when the annotation moves")
-
- // A refused class leaves the method out entirely: the response answers what
- // can be done, so a refused entry would read as an offer.
- for _, class := range []v1pb.MCPMethodClass{
- v1pb.MCPMethodClass_FORBIDDEN,
- v1pb.MCPMethodClass_EXCLUDED,
- v1pb.MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED,
- } {
- require.Empty(t, mcpServedMethods(descriptorsClassifying(t, class)),
- "%v is served by no ceiling", class)
- }
-}
-
-// descriptorsClassifying builds a descriptor set holding one bytebase.v1
-// service with one method carrying the given classification. The file is
-// compiled the same way the real ones are, so the resolver reads a real
-// annotation off a real descriptor, not a stand-in for one.
-func descriptorsClassifying(t *testing.T, class v1pb.MCPMethodClass) *protoregistry.Files {
- t.Helper()
-
- options := &descriptorpb.MethodOptions{}
- proto.SetExtension(options, v1pb.E_McpMethodClass, class)
- proto.SetExtension(options, v1pb.E_Permission, "bb.probes.get")
- if class == v1pb.MCPMethodClass_FORBIDDEN || class == v1pb.MCPMethodClass_EXCLUDED {
- // The build's own lint requires a reason on a refused method; keep the
- // synthetic file consistent with that rule.
- proto.SetExtension(options, v1pb.E_McpDenialReason, v1pb.MCPDenialReason_ADMINISTERS_THE_WORKSPACE)
- }
-
- probe := &descriptorpb.FileDescriptorProto{
- Name: proto.String("test/live_resolution.proto"),
- Package: proto.String("bytebase.v1"),
- Syntax: proto.String("proto3"),
- Dependency: []string{
- "v1/annotation.proto",
- },
- MessageType: []*descriptorpb.DescriptorProto{
- {Name: proto.String("ProbeRequest")},
- {Name: proto.String("ProbeResponse")},
- },
- Service: []*descriptorpb.ServiceDescriptorProto{{
- Name: proto.String("LiveResolutionService"),
- Method: []*descriptorpb.MethodDescriptorProto{{
- Name: proto.String("Probe"),
- InputType: proto.String(".bytebase.v1.ProbeRequest"),
- OutputType: proto.String(".bytebase.v1.ProbeResponse"),
- Options: options,
- }},
- }},
- }
-
- set := &descriptorpb.FileDescriptorSet{File: append(fileAndDependencies(t, "v1/annotation.proto"), probe)}
- files, err := protodesc.NewFiles(set)
- require.NoError(t, err)
- return files
-}
-
-// fileAndDependencies returns the given compiled file and everything it imports,
-// dependencies first, as descriptor protos.
-func fileAndDependencies(t *testing.T, path string) []*descriptorpb.FileDescriptorProto {
- t.Helper()
- seen := map[string]bool{}
- var out []*descriptorpb.FileDescriptorProto
- var walk func(fd protoreflect.FileDescriptor)
- walk = func(fd protoreflect.FileDescriptor) {
- if seen[fd.Path()] {
- return
- }
- seen[fd.Path()] = true
- imports := fd.Imports()
- for i := range imports.Len() {
- walk(imports.Get(i).FileDescriptor)
- }
- out = append(out, protodesc.ToFileDescriptorProto(fd))
- }
- fd, err := protoregistry.GlobalFiles.FindFileByPath(path)
- require.NoError(t, err)
- walk(fd)
- return out
-}
-
-// TestMCPInfoServedMethodsMatchTheServingTable holds the real response against
-// the gate's own serving table: every method it lists must be one some ceiling
-// serves, and every method the annotations classify as served must be listed.
-func TestMCPInfoServedMethodsMatchTheServingTable(t *testing.T) {
- methods := mcpServedMethods(protoregistry.GlobalFiles)
- require.NotEmpty(t, methods)
-
- listed := map[string]v1pb.MCPMethodClass{}
- for _, m := range methods {
- require.False(t, auth.MCPClassIsRefused(m.Class),
- "%s is %v, which no ceiling serves, so it must not be advertised", m.Method, m.Class)
- listed[m.Method] = m.Class
- }
-
- byMethod := map[string]*v1pb.MCPMethod{}
- for _, m := range methods {
- byMethod[m.Method] = m
- }
- for _, row := range mcpClassificationsFromDescriptors(t) {
- if auth.MCPClassIsRefused(row.class) {
- require.NotContains(t, listed, row.procedure)
- continue
- }
- require.Equal(t, row.class, listed[row.procedure],
- "%s is classified %v and must be listed as such", row.procedure, row.class)
- // The permission is the part an agent acts on to predict a denial, so
- // it is checked on every real method, not only on a synthetic one.
- require.Equal(t, row.permission, byMethod[row.procedure].Permission,
- "%s must report the permission its descriptor declares", row.procedure)
- }
-
- // The order is the response's contract: protoregistry's RangeFiles order is
- // unspecified, so without the sort the list would flap between requests.
- for range 4 {
- next := mcpServedMethods(protoregistry.GlobalFiles)
- require.Len(t, next, len(methods))
- for i := range methods {
- require.Equal(t, methods[i].Method, next[i].Method, "method order must be stable")
- }
- }
-}
-
-// TestMCPInfoModesMatchTheServingTable pins that the modes the response
-// describes are the gate's, not a second copy of them.
-func TestMCPInfoModesMatchTheServingTable(t *testing.T) {
- modes := mcpCapabilityModes()
- require.Len(t, modes, len(mcpServingClasses))
-
- got := map[storepb.MCPSetting_Capability][]v1pb.MCPMethodClass{}
- for _, mode := range modes {
- capability := convertToStoreMCPCapability(mode.Capability)
- _, known := mcpServingClasses[capability]
- require.True(t, known, "%v is not a ceiling the gate decides about", mode.Capability)
- got[capability] = mode.ServedClasses
- }
-
- // Spelled out rather than compared against the table, so flipping what a
- // mode serves fails here instead of agreeing with itself.
- require.Empty(t, got[storepb.MCPSetting_DISABLED])
- require.Equal(t, []v1pb.MCPMethodClass{v1pb.MCPMethodClass_READ}, got[storepb.MCPSetting_READ_ONLY])
- require.Equal(t,
- []v1pb.MCPMethodClass{v1pb.MCPMethodClass_READ, v1pb.MCPMethodClass_WRITE},
- got[storepb.MCPSetting_READ_WRITE])
-
- // And not the gate's own slice: a response that aliases the serving table
- // lets anything downstream write into the ceiling.
- for _, mode := range modes {
- served := mcpServingClasses[convertToStoreMCPCapability(mode.Capability)]
- if len(served) > 0 && len(mode.ServedClasses) > 0 {
- require.NotSame(t, &served[0], &mode.ServedClasses[0],
- "%v hands out the table the gate evaluates", mode.Capability)
- }
- }
-
- // The order is the response's contract: Go randomizes map iteration, so
- // without the sort every request would return a different one.
- for range 8 {
- next := mcpCapabilityModes()
- require.Len(t, next, len(modes))
- for i := range modes {
- require.Equal(t, modes[i].Capability, next[i].Capability, "mode order must be stable")
- }
- }
-}
-
-// TestMCPInfoReadOnlyDepthMirrorsTheDrivers holds the reported depth against
-// the two things that decide it.
-//
-// The classifier half is asked, not mirrored: HasQueryValidator is the registry
-// the clamp itself consults, so an engine gaining or losing a validator moves
-// here on the same commit and this test follows it.
-//
-// The session half cannot be asked — a driver reports it by acting on a flag
-// when a connection opens, and none exists here — so readOnlyDriverSession
-// mirrors the drivers by hand. What this pins is that mcpReadOnlyDepth reports
-// that table faithfully, NOT that the table matches the drivers: a fourth
-// driver that starts honoring the flag leaves both unchanged and this green.
-// Nothing in a unit test can catch that; the safe direction is that an
-// unmirrored driver understates its own depth rather than overstating it.
-func TestMCPInfoReadOnlyDepthMirrorsTheDrivers(t *testing.T) {
- // readOnlyDriverSession's table, restated so an unmirrored edit to it fails.
- sessionDepth := map[storepb.Engine]bool{
- storepb.Engine_POSTGRES: true,
- storepb.Engine_COCKROACHDB: true,
- }
-
- values := storepb.Engine(0).Descriptor().Values()
- for i := range values.Len() {
- engine := storepb.Engine(values.Get(i).Number())
- if engine == storepb.Engine_ENGINE_UNSPECIFIED {
- continue
- }
- got := mcpReadOnlyDepth(engine)
- switch {
- case !parserbase.HasQueryValidator(engine):
- require.Equal(t, v1pb.MCPEngineEnforcement_UNSUPPORTED, got,
- "%v has no read-only classifier, so a read-only session is refused every statement", engine)
- case sessionDepth[engine]:
- require.Equal(t, v1pb.MCPEngineEnforcement_STATEMENT_AND_SESSION, got, "%v", engine)
- default:
- require.Equal(t, v1pb.MCPEngineEnforcement_STATEMENT, got, "%v", engine)
- }
- }
-
- require.NotEmpty(t, mcpEngineNote(storepb.Engine_REDSHIFT),
- "redshift's floor is only honest with the datashare exception said out loud")
-}
-
-// TestMCPInfoMaskingMirrorsTheMaskers holds the three masking states against
-// the two functions the query path branches on.
-//
-// It does not pin the branch ORDER, and cannot: it also pins that the two
-// predicates are disjoint, which is what makes the order unobservable. That
-// disjointness is the real invariant — an engine in both sets would make
-// document-first the only correct order, and the assertion below is what would
-// catch one appearing.
-//
-// The third state is the one worth having: a document engine masks, so it is
-// not "no masking", but the document masker's interface carries neither the
-// user nor their exemptions, so ignoring exemptions changes nothing there
-// (BOT-95). Collapsing it into either neighbour would overclaim.
-func TestMCPInfoMaskingMirrorsTheMaskers(t *testing.T) {
- values := storepb.Engine(0).Descriptor().Values()
- var column, document, none int
- for i := range values.Len() {
- engine := storepb.Engine(values.Get(i).Number())
- if engine == storepb.Engine_ENGINE_UNSPECIFIED {
- continue
- }
- got := mcpMaskingSupport(engine)
- switch {
- case getDocumentMasker(engine) != nil:
- require.Equal(t, v1pb.MCPEngineEnforcement_DOCUMENT, got, "%v", engine)
- require.False(t, common.EngineSupportMasking(engine),
- "%v routes to the document masker, so the column masker is never reached", engine)
- document++
- case common.EngineSupportMasking(engine):
- require.Equal(t, v1pb.MCPEngineEnforcement_COLUMN, got, "%v", engine)
- column++
- default:
- require.Equal(t, v1pb.MCPEngineEnforcement_NONE, got, "%v", engine)
- none++
- }
- }
- require.Equal(t, 3, document, "cosmosdb, mongodb, elasticsearch")
- require.NotZero(t, column)
- require.NotZero(t, none)
-}
-
-// TestMCPInfoCoversEveryEngine pins that the response leaves no engine out: an
-// admin choosing read-only must not have to guess about the one engine the
-// table skipped.
-func TestMCPInfoCoversEveryEngine(t *testing.T) {
- engines := mcpEngineEnforcement()
- values := storepb.Engine(0).Descriptor().Values()
- require.Len(t, engines, values.Len()-1, "every engine but the unspecified zero value")
-
- seen := map[v1pb.Engine]bool{}
- for _, e := range engines {
- require.NotEqual(t, v1pb.Engine_ENGINE_UNSPECIFIED, e.Engine,
- "an engine the v1 converter does not know would report as unspecified")
- require.False(t, seen[e.Engine], "%v listed twice", e.Engine)
- seen[e.Engine] = true
- }
-}
-
-// TestGetMCPInfoHandler drives the RPC itself, which the helper tests above
-// cannot: they each hand mcpServedMethods a descriptor source, so nothing they
-// assert pins that the handler passes the real registry rather than a cached or
-// stored set — the one property this API exists to guarantee. They also leave
-// every error branch unexercised.
+// TestGetMCPInfoHandler drives the RPC against a real store, across the ways a
+// stored row resolves: served, disabled, a name nothing resolves, a number
+// nothing serves, and a row that does not unmarshal. capability is the whole
+// answer now, and the consent page derives its three states from it alone, so
+// this is the backend receipt for what the page may disclose.
func TestGetMCPInfoHandler(t *testing.T) {
ctx := context.Background()
container := testcontainer.GetTestPgContainer(ctx, t)
@@ -366,23 +72,6 @@ func TestGetMCPInfoHandler(t *testing.T) {
require.Equal(t, v1pb.MCPSetting_READ_ONLY, info.Capability,
"a new workspace is seeded READ_ONLY; only a workspace with no row at all falls back to READ_WRITE")
require.False(t, info.IgnoreMaskingExemptions)
-
- // The list is the live registry's, not a fixture: every entry must be a
- // method this build actually compiled, and the count must match what
- // the descriptors classify as served right now.
- require.Equal(t, len(mcpServedMethods(protoregistry.GlobalFiles)), len(info.Methods))
- byMethod := map[string]*v1pb.MCPMethod{}
- for _, m := range info.Methods {
- byMethod[m.Method] = m
- }
- query := byMethod["/bytebase.v1.SQLService/Query"]
- require.NotNil(t, query, "the handler must resolve from the compiled descriptors")
- require.Equal(t, "bytebase.v1.SQLService.Query", query.OperationId)
- require.NotContains(t, byMethod, "/bytebase.v1.AuthService/Login",
- "a FORBIDDEN method must never be advertised as reachable")
-
- require.Len(t, info.Modes, 3)
- require.NotEmpty(t, info.Engines)
})
t.Run("the toggle reaches the response", func(t *testing.T) {
@@ -399,25 +88,20 @@ func TestGetMCPInfoHandler(t *testing.T) {
info, err := get(workspaceCtx())
require.NoError(t, err)
require.Equal(t, v1pb.MCPSetting_DISABLED, info.Capability)
- require.NotEmpty(t, info.Modes,
- "an admin with MCP off is exactly who needs to see what the other modes contain")
})
// The two subtests below are BOT-106. Both ceilings refuse every MCP
- // connection and both used to refuse this call whole, which took the mode
- // comparison away from the admin repairing the row and left the consent
- // page with no policy to disclose.
+ // connection and both used to refuse this call whole, which left the admin
+ // repairing the row with no reading of what is stored, and the consent page
+ // with no policy to disclose.
t.Run("a ceiling this build cannot read is described, not refused", func(t *testing.T) {
setCeiling(t, `{"capability":"READ_ONLYY"}`)
info, err := get(workspaceCtx())
- require.NoError(t, err, "none of the mode contents come from the stored row")
+ require.NoError(t, err, "the ceiling is described, not refused")
require.Equal(t, v1pb.MCPSetting_CAPABILITY_UNSPECIFIED, info.Capability,
"a ceiling nobody can resolve must not arrive as a mode, least of all the permissive one")
require.False(t, info.IgnoreMaskingExemptions,
"no MCP request runs under this ceiling, so the toggle carries neither the row's value nor a decision")
- require.Len(t, info.Modes, 3, "the comparison this page exists for")
- require.Equal(t, len(mcpServedMethods(protoregistry.GlobalFiles)), len(info.Methods))
- require.NotEmpty(t, info.Engines)
})
// The subtest above covers a mistyped enum NAME, which unmarshals away to
@@ -443,23 +127,16 @@ func TestGetMCPInfoHandler(t *testing.T) {
}
})
- t.Run("a ceiling no mode serves is described by the value nobody serves", func(t *testing.T) {
+ t.Run("a ceiling this build does not serve arrives as the stored number", func(t *testing.T) {
// The reserved 2, or a value a newer release wrote. It parses, so the
- // number is the answer and needs no field of its own: modes has no row
- // for it, which is what tells a client this ceiling serves nothing.
+ // number is the answer: a client that has no name for it is exactly the
+ // client that must not disclose it, and the number is what tells it so.
setCeiling(t, `{"capability":2}`)
info, err := get(workspaceCtx())
require.NoError(t, err)
require.NotEqual(t, v1pb.MCPSetting_CAPABILITY_UNSPECIFIED, info.Capability,
- "it parsed; the number is the answer")
+ "it parsed; the number is the answer, not a fallback to unresolvable")
require.Equal(t, v1pb.MCPSetting_Capability(2), info.Capability)
- // Len first: the loop below passes vacuously on an empty table, and an
- // empty table is what turns every consent page into this same card.
- require.Len(t, info.Modes, 3, "the comparison this page exists for")
- for _, mode := range info.Modes {
- require.NotEqual(t, v1pb.MCPSetting_Capability(2), mode.Capability)
- }
- require.NotEmpty(t, info.Engines)
})
t.Run("the gate's resolution wins over a second read", func(t *testing.T) {
diff --git a/backend/generated-go/v1/v1connect/workspace_service.connect.go b/backend/generated-go/v1/v1connect/workspace_service.connect.go
index d5e78d7db7..1203fcd5dc 100644
--- a/backend/generated-go/v1/v1connect/workspace_service.connect.go
+++ b/backend/generated-go/v1/v1connect/workspace_service.connect.go
@@ -89,9 +89,8 @@ type WorkspaceServiceClient interface {
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *connect.Request[v1.SetIamPolicyRequest]) (*connect.Response[v1.IamPolicy], error)
// Gets what MCP (Model Context Protocol) does in this workspace: the
- // capability ceiling in force, what each ceiling serves, and the per-engine
- // facts a read-only session depends on. The workspace is resolved from the
- // authenticated session.
+ // capability ceiling in force, and whether masking narrows what a session
+ // reads under it. The workspace is resolved from the authenticated session.
//
// Served to MCP sessions. An agent asking what it may do here is the point:
// the response says nothing a session's own denials do not already say, one
@@ -261,9 +260,8 @@ type WorkspaceServiceHandler interface {
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *connect.Request[v1.SetIamPolicyRequest]) (*connect.Response[v1.IamPolicy], error)
// Gets what MCP (Model Context Protocol) does in this workspace: the
- // capability ceiling in force, what each ceiling serves, and the per-engine
- // facts a read-only session depends on. The workspace is resolved from the
- // authenticated session.
+ // capability ceiling in force, and whether masking narrows what a session
+ // reads under it. The workspace is resolved from the authenticated session.
//
// Served to MCP sessions. An agent asking what it may do here is the point:
// the response says nothing a session's own denials do not already say, one
diff --git a/backend/generated-go/v1/workspace_service.pb.go b/backend/generated-go/v1/workspace_service.pb.go
index 6b206d0652..6137326a09 100644
--- a/backend/generated-go/v1/workspace_service.pb.go
+++ b/backend/generated-go/v1/workspace_service.pb.go
@@ -23,130 +23,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
-// How much of a read-only ceiling this engine can be held to.
-type MCPEngineEnforcement_ReadOnlyDepth int32
-
-const (
- MCPEngineEnforcement_READ_ONLY_DEPTH_UNSPECIFIED MCPEngineEnforcement_ReadOnlyDepth = 0
- // Bytebase has no read-only classifier for this engine, so a read-only
- // session is refused every statement on it, including a plain SELECT.
- MCPEngineEnforcement_UNSUPPORTED MCPEngineEnforcement_ReadOnlyDepth = 1
- // Every statement is classified before it runs and a request holding one
- // that is not a read is refused whole. Nothing below that: the driver does
- // not open a read-only database session, except where the note says
- // otherwise.
- MCPEngineEnforcement_STATEMENT MCPEngineEnforcement_ReadOnlyDepth = 2
- // Statement classification, and the driver opens the database session
- // read-only as well, so the engine refuses most writes the classifier
- // missed. Not a proof: a statement that classifies as a read can still call
- // a function that switches the session setting back off.
- MCPEngineEnforcement_STATEMENT_AND_SESSION MCPEngineEnforcement_ReadOnlyDepth = 3
-)
-
-// Enum value maps for MCPEngineEnforcement_ReadOnlyDepth.
-var (
- MCPEngineEnforcement_ReadOnlyDepth_name = map[int32]string{
- 0: "READ_ONLY_DEPTH_UNSPECIFIED",
- 1: "UNSUPPORTED",
- 2: "STATEMENT",
- 3: "STATEMENT_AND_SESSION",
- }
- MCPEngineEnforcement_ReadOnlyDepth_value = map[string]int32{
- "READ_ONLY_DEPTH_UNSPECIFIED": 0,
- "UNSUPPORTED": 1,
- "STATEMENT": 2,
- "STATEMENT_AND_SESSION": 3,
- }
-)
-
-func (x MCPEngineEnforcement_ReadOnlyDepth) Enum() *MCPEngineEnforcement_ReadOnlyDepth {
- p := new(MCPEngineEnforcement_ReadOnlyDepth)
- *p = x
- return p
-}
-
-func (x MCPEngineEnforcement_ReadOnlyDepth) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (MCPEngineEnforcement_ReadOnlyDepth) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_workspace_service_proto_enumTypes[0].Descriptor()
-}
-
-func (MCPEngineEnforcement_ReadOnlyDepth) Type() protoreflect.EnumType {
- return &file_v1_workspace_service_proto_enumTypes[0]
-}
-
-func (x MCPEngineEnforcement_ReadOnlyDepth) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use MCPEngineEnforcement_ReadOnlyDepth.Descriptor instead.
-func (MCPEngineEnforcement_ReadOnlyDepth) EnumDescriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{4, 0}
-}
-
-// How Bytebase masks results on this engine, which is what decides whether
-// ignoring masking exemptions changes anything here.
-type MCPEngineEnforcement_Masking int32
-
-const (
- MCPEngineEnforcement_MASKING_UNSPECIFIED MCPEngineEnforcement_Masking = 0
- // Bytebase does not mask on this engine. Nothing narrows what a session
- // reads, and ignoring masking exemptions does nothing.
- MCPEngineEnforcement_NONE MCPEngineEnforcement_Masking = 1
- // Column masking. A masking policy substitutes values in query results,
- // and the exemptions granted to the caller are what let them see the real
- // value — which is what ignoring exemptions suppresses.
- MCPEngineEnforcement_COLUMN MCPEngineEnforcement_Masking = 2
- // Document masking. Results are masked, but exemptions are never consulted
- // on this path, so ignoring them changes nothing here either.
- MCPEngineEnforcement_DOCUMENT MCPEngineEnforcement_Masking = 3
-)
-
-// Enum value maps for MCPEngineEnforcement_Masking.
-var (
- MCPEngineEnforcement_Masking_name = map[int32]string{
- 0: "MASKING_UNSPECIFIED",
- 1: "NONE",
- 2: "COLUMN",
- 3: "DOCUMENT",
- }
- MCPEngineEnforcement_Masking_value = map[string]int32{
- "MASKING_UNSPECIFIED": 0,
- "NONE": 1,
- "COLUMN": 2,
- "DOCUMENT": 3,
- }
-)
-
-func (x MCPEngineEnforcement_Masking) Enum() *MCPEngineEnforcement_Masking {
- p := new(MCPEngineEnforcement_Masking)
- *p = x
- return p
-}
-
-func (x MCPEngineEnforcement_Masking) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (MCPEngineEnforcement_Masking) Descriptor() protoreflect.EnumDescriptor {
- return file_v1_workspace_service_proto_enumTypes[1].Descriptor()
-}
-
-func (MCPEngineEnforcement_Masking) Type() protoreflect.EnumType {
- return &file_v1_workspace_service_proto_enumTypes[1]
-}
-
-func (x MCPEngineEnforcement_Masking) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use MCPEngineEnforcement_Masking.Descriptor instead.
-func (MCPEngineEnforcement_Masking) EnumDescriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{4, 1}
-}
-
type GetMCPInfoRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
@@ -183,48 +59,33 @@ func (*GetMCPInfoRequest) Descriptor() ([]byte, []int) {
return file_v1_workspace_service_proto_rawDescGZIP(), []int{0}
}
-// MCPInfo is what MCP does in this workspace: the ceiling in force, what each
-// ceiling serves, and the per-engine facts a read-only session depends on.
+// MCPInfo is what MCP does in this workspace: the ceiling in force, and
+// whether masking narrows what a session reads under it.
//
-// Everything here is resolved when the request is served, never from a stored
-// copy: the method list comes off the compiled API descriptors and the engine
-// answers off the code that enforces them, so a build whose rules changed
-// cannot describe the rules of the build before it.
+// This is the only API a served MCP session or the consent page can read the
+// ceiling from. SettingService/GetSetting is served by no ceiling, and its
+// answer is cached besides.
type MCPInfo struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The workspace this describes. Format: workspaces/{workspace}. Not this
// message's own resource name — MCPInfo is not a named resource and there is
// nothing to get it by.
Workspace string `protobuf:"bytes,1,opt,name=workspace,proto3" json:"workspace,omitempty"`
- // The ceiling in force for this workspace. A value no row in modes serves,
- // CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
- // the stored row and every MCP connection is refused.
+ // The ceiling in force for this workspace. Any value outside the enum this
+ // build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+ // resolved from the stored row and every MCP connection is refused. A stored
+ // name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+ // release wrote arrives verbatim.
Capability MCPSetting_Capability `protobuf:"varint,2,opt,name=capability,proto3,enum=bytebase.v1.MCPSetting_Capability" json:"capability,omitempty"`
- // What each ceiling serves, including the one in force, so an admin can
- // compare the choices rather than only read the current answer.
- Modes []*MCPCapabilityMode `protobuf:"bytes,3,rep,name=modes,proto3" json:"modes,omitempty"`
- // Every API method some ceiling serves. A mode serves a method when the
- // method's class is one of that mode's served_classes, which is the ceiling
- // rule the gate evaluates. Methods no ceiling serves are absent.
- //
- // Being listed is necessary, not sufficient. The caller still needs the
- // permission, and two further rules narrow what a served method does: a
- // handful of methods are refused on the shape of the request (an issue that
- // would grant a permission, a rollout that skips approval), and under
- // READ_ONLY every statement SQLService/Query runs must classify as a read.
- Methods []*MCPMethod `protobuf:"bytes,4,rep,name=methods,proto3" json:"methods,omitempty"`
- // What a read-only session and the masking toggle actually reach, per engine.
- // Both are engine-conditional in ways the ceiling alone does not show.
- Engines []*MCPEngineEnforcement `protobuf:"bytes,5,rep,name=engines,proto3" json:"engines,omitempty"`
// Whether this workspace stops applying the caller's own unmasking
- // provisioning to MCP requests. It decides which branch of each engine's
- // masking state a caller is in, and no other API tells an MCP session:
- // SettingService/GetSetting is served by no ceiling.
+ // provisioning to MCP requests. It narrows what a session reads only where
+ // Bytebase masks by column and consults exemptions; elsewhere it suppresses
+ // nothing.
IgnoreMaskingExemptions bool `protobuf:"varint,6,opt,name=ignore_masking_exemptions,json=ignoreMaskingExemptions,proto3" json:"ignore_masking_exemptions,omitempty"`
// Whether data masking is licensed for this workspace. When false nothing is
- // masked whatever an engine supports, so the masking states below describe a
- // mechanism that does not run. Licensing can also be set per instance, so a
- // true here is the workspace answer, not a promise about every instance.
+ // masked whatever an engine supports, so the toggle above suppresses nothing.
+ // Licensing can also be set per instance, so a true here is the workspace
+ // answer, not a promise about every instance.
DataMaskingAvailable bool `protobuf:"varint,7,opt,name=data_masking_available,json=dataMaskingAvailable,proto3" json:"data_masking_available,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -274,27 +135,6 @@ func (x *MCPInfo) GetCapability() MCPSetting_Capability {
return MCPSetting_CAPABILITY_UNSPECIFIED
}
-func (x *MCPInfo) GetModes() []*MCPCapabilityMode {
- if x != nil {
- return x.Modes
- }
- return nil
-}
-
-func (x *MCPInfo) GetMethods() []*MCPMethod {
- if x != nil {
- return x.Methods
- }
- return nil
-}
-
-func (x *MCPInfo) GetEngines() []*MCPEngineEnforcement {
- if x != nil {
- return x.Engines
- }
- return nil
-}
-
func (x *MCPInfo) GetIgnoreMaskingExemptions() bool {
if x != nil {
return x.IgnoreMaskingExemptions
@@ -309,223 +149,6 @@ func (x *MCPInfo) GetDataMaskingAvailable() bool {
return false
}
-// MCPCapabilityMode is one ceiling and the method classes it serves.
-type MCPCapabilityMode struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Capability MCPSetting_Capability `protobuf:"varint,1,opt,name=capability,proto3,enum=bytebase.v1.MCPSetting_Capability" json:"capability,omitempty"`
- // Empty means the ceiling serves nothing, which is what DISABLED is.
- ServedClasses []MCPMethodClass `protobuf:"varint,2,rep,packed,name=served_classes,json=servedClasses,proto3,enum=bytebase.v1.MCPMethodClass" json:"served_classes,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *MCPCapabilityMode) Reset() {
- *x = MCPCapabilityMode{}
- mi := &file_v1_workspace_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *MCPCapabilityMode) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*MCPCapabilityMode) ProtoMessage() {}
-
-func (x *MCPCapabilityMode) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use MCPCapabilityMode.ProtoReflect.Descriptor instead.
-func (*MCPCapabilityMode) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *MCPCapabilityMode) GetCapability() MCPSetting_Capability {
- if x != nil {
- return x.Capability
- }
- return MCPSetting_CAPABILITY_UNSPECIFIED
-}
-
-func (x *MCPCapabilityMode) GetServedClasses() []MCPMethodClass {
- if x != nil {
- return x.ServedClasses
- }
- return nil
-}
-
-// MCPMethod is one API method an MCP session can reach, and what decides it.
-type MCPMethod struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The method as an audit entry names it, so a denial can be found by it.
- // Example: /bytebase.v1.SQLService/Query
- Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
- // The same method as call_api takes it.
- // Example: bytebase.v1.SQLService.Query
- OperationId string `protobuf:"bytes,4,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
- Class MCPMethodClass `protobuf:"varint,2,opt,name=class,proto3,enum=bytebase.v1.MCPMethodClass" json:"class,omitempty"`
- // The IAM permission the method declares. The ceiling never grants: a session
- // may call a served method only where the person it acts for could.
- //
- // Empty means the method declares no permission, which is NOT the same as
- // needing none — a method that authorizes inside its handler declares nothing
- // here. auth_method says which case an empty value is.
- Permission string `protobuf:"bytes,3,opt,name=permission,proto3" json:"permission,omitempty"`
- // How the method authorizes. IAM means the permission above is the primary
- // rule, though not always the only one — an update carrying allow_missing
- // additionally requires the matching create permission. CUSTOM means the
- // handler decides and the permission field is silent.
- AuthMethod AuthMethod `protobuf:"varint,5,opt,name=auth_method,json=authMethod,proto3,enum=bytebase.v1.AuthMethod" json:"auth_method,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *MCPMethod) Reset() {
- *x = MCPMethod{}
- mi := &file_v1_workspace_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *MCPMethod) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*MCPMethod) ProtoMessage() {}
-
-func (x *MCPMethod) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[3]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use MCPMethod.ProtoReflect.Descriptor instead.
-func (*MCPMethod) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *MCPMethod) GetMethod() string {
- if x != nil {
- return x.Method
- }
- return ""
-}
-
-func (x *MCPMethod) GetOperationId() string {
- if x != nil {
- return x.OperationId
- }
- return ""
-}
-
-func (x *MCPMethod) GetClass() MCPMethodClass {
- if x != nil {
- return x.Class
- }
- return MCPMethodClass_MCP_METHOD_CLASS_UNSPECIFIED
-}
-
-func (x *MCPMethod) GetPermission() string {
- if x != nil {
- return x.Permission
- }
- return ""
-}
-
-func (x *MCPMethod) GetAuthMethod() AuthMethod {
- if x != nil {
- return x.AuthMethod
- }
- return AuthMethod_AUTH_METHOD_UNSPECIFIED
-}
-
-// MCPEngineEnforcement is what the read-only ceiling and the masking toggle
-// reach on one database engine.
-type MCPEngineEnforcement struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Engine Engine `protobuf:"varint,1,opt,name=engine,proto3,enum=bytebase.v1.Engine" json:"engine,omitempty"`
- ReadOnlyDepth MCPEngineEnforcement_ReadOnlyDepth `protobuf:"varint,2,opt,name=read_only_depth,json=readOnlyDepth,proto3,enum=bytebase.v1.MCPEngineEnforcement_ReadOnlyDepth" json:"read_only_depth,omitempty"`
- Masking MCPEngineEnforcement_Masking `protobuf:"varint,3,opt,name=masking,proto3,enum=bytebase.v1.MCPEngineEnforcement_Masking" json:"masking,omitempty"`
- // Where the answers above are the floor rather than the whole story. Empty
- // for most engines.
- Note string `protobuf:"bytes,4,opt,name=note,proto3" json:"note,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *MCPEngineEnforcement) Reset() {
- *x = MCPEngineEnforcement{}
- mi := &file_v1_workspace_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *MCPEngineEnforcement) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*MCPEngineEnforcement) ProtoMessage() {}
-
-func (x *MCPEngineEnforcement) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[4]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use MCPEngineEnforcement.ProtoReflect.Descriptor instead.
-func (*MCPEngineEnforcement) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *MCPEngineEnforcement) GetEngine() Engine {
- if x != nil {
- return x.Engine
- }
- return Engine_ENGINE_UNSPECIFIED
-}
-
-func (x *MCPEngineEnforcement) GetReadOnlyDepth() MCPEngineEnforcement_ReadOnlyDepth {
- if x != nil {
- return x.ReadOnlyDepth
- }
- return MCPEngineEnforcement_READ_ONLY_DEPTH_UNSPECIFIED
-}
-
-func (x *MCPEngineEnforcement) GetMasking() MCPEngineEnforcement_Masking {
- if x != nil {
- return x.Masking
- }
- return MCPEngineEnforcement_MASKING_UNSPECIFIED
-}
-
-func (x *MCPEngineEnforcement) GetNote() string {
- if x != nil {
- return x.Note
- }
- return ""
-}
-
type RotateDirectorySyncTokenRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The workspace whose directory sync token is rotated.
@@ -537,7 +160,7 @@ type RotateDirectorySyncTokenRequest struct {
func (x *RotateDirectorySyncTokenRequest) Reset() {
*x = RotateDirectorySyncTokenRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[5]
+ mi := &file_v1_workspace_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -549,7 +172,7 @@ func (x *RotateDirectorySyncTokenRequest) String() string {
func (*RotateDirectorySyncTokenRequest) ProtoMessage() {}
func (x *RotateDirectorySyncTokenRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[5]
+ mi := &file_v1_workspace_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -562,7 +185,7 @@ func (x *RotateDirectorySyncTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use RotateDirectorySyncTokenRequest.ProtoReflect.Descriptor instead.
func (*RotateDirectorySyncTokenRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{2}
}
func (x *RotateDirectorySyncTokenRequest) GetName() string {
@@ -582,7 +205,7 @@ type RotateDirectorySyncTokenResponse struct {
func (x *RotateDirectorySyncTokenResponse) Reset() {
*x = RotateDirectorySyncTokenResponse{}
- mi := &file_v1_workspace_service_proto_msgTypes[6]
+ mi := &file_v1_workspace_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -594,7 +217,7 @@ func (x *RotateDirectorySyncTokenResponse) String() string {
func (*RotateDirectorySyncTokenResponse) ProtoMessage() {}
func (x *RotateDirectorySyncTokenResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[6]
+ mi := &file_v1_workspace_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -607,7 +230,7 @@ func (x *RotateDirectorySyncTokenResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use RotateDirectorySyncTokenResponse.ProtoReflect.Descriptor instead.
func (*RotateDirectorySyncTokenResponse) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{3}
}
func (x *RotateDirectorySyncTokenResponse) GetToken() string {
@@ -625,7 +248,7 @@ type ListWorkspacesRequest struct {
func (x *ListWorkspacesRequest) Reset() {
*x = ListWorkspacesRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[7]
+ mi := &file_v1_workspace_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -637,7 +260,7 @@ func (x *ListWorkspacesRequest) String() string {
func (*ListWorkspacesRequest) ProtoMessage() {}
func (x *ListWorkspacesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[7]
+ mi := &file_v1_workspace_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -650,7 +273,7 @@ func (x *ListWorkspacesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspacesRequest.ProtoReflect.Descriptor instead.
func (*ListWorkspacesRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{4}
}
type ListWorkspacesResponse struct {
@@ -662,7 +285,7 @@ type ListWorkspacesResponse struct {
func (x *ListWorkspacesResponse) Reset() {
*x = ListWorkspacesResponse{}
- mi := &file_v1_workspace_service_proto_msgTypes[8]
+ mi := &file_v1_workspace_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -674,7 +297,7 @@ func (x *ListWorkspacesResponse) String() string {
func (*ListWorkspacesResponse) ProtoMessage() {}
func (x *ListWorkspacesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[8]
+ mi := &file_v1_workspace_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -687,7 +310,7 @@ func (x *ListWorkspacesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspacesResponse.ProtoReflect.Descriptor instead.
func (*ListWorkspacesResponse) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{8}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{5}
}
func (x *ListWorkspacesResponse) GetWorkspaces() []*Workspace {
@@ -708,7 +331,7 @@ type GetWorkspaceRequest struct {
func (x *GetWorkspaceRequest) Reset() {
*x = GetWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[9]
+ mi := &file_v1_workspace_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -720,7 +343,7 @@ func (x *GetWorkspaceRequest) String() string {
func (*GetWorkspaceRequest) ProtoMessage() {}
func (x *GetWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[9]
+ mi := &file_v1_workspace_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -733,7 +356,7 @@ func (x *GetWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*GetWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{9}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{6}
}
func (x *GetWorkspaceRequest) GetName() string {
@@ -756,7 +379,7 @@ type Workspace struct {
func (x *Workspace) Reset() {
*x = Workspace{}
- mi := &file_v1_workspace_service_proto_msgTypes[10]
+ mi := &file_v1_workspace_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -768,7 +391,7 @@ func (x *Workspace) String() string {
func (*Workspace) ProtoMessage() {}
func (x *Workspace) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[10]
+ mi := &file_v1_workspace_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -781,7 +404,7 @@ func (x *Workspace) ProtoReflect() protoreflect.Message {
// Deprecated: Use Workspace.ProtoReflect.Descriptor instead.
func (*Workspace) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{10}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{7}
}
func (x *Workspace) GetName() string {
@@ -815,7 +438,7 @@ type DeleteWorkspaceRequest struct {
func (x *DeleteWorkspaceRequest) Reset() {
*x = DeleteWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[11]
+ mi := &file_v1_workspace_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -827,7 +450,7 @@ func (x *DeleteWorkspaceRequest) String() string {
func (*DeleteWorkspaceRequest) ProtoMessage() {}
func (x *DeleteWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[11]
+ mi := &file_v1_workspace_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -840,7 +463,7 @@ func (x *DeleteWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*DeleteWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{11}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{8}
}
func (x *DeleteWorkspaceRequest) GetName() string {
@@ -860,7 +483,7 @@ type UpdateWorkspaceRequest struct {
func (x *UpdateWorkspaceRequest) Reset() {
*x = UpdateWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[12]
+ mi := &file_v1_workspace_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -872,7 +495,7 @@ func (x *UpdateWorkspaceRequest) String() string {
func (*UpdateWorkspaceRequest) ProtoMessage() {}
func (x *UpdateWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[12]
+ mi := &file_v1_workspace_service_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -885,7 +508,7 @@ func (x *UpdateWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*UpdateWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{12}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{9}
}
func (x *UpdateWorkspaceRequest) GetWorkspace() *Workspace {
@@ -912,7 +535,7 @@ type LeaveWorkspaceRequest struct {
func (x *LeaveWorkspaceRequest) Reset() {
*x = LeaveWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[13]
+ mi := &file_v1_workspace_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -924,7 +547,7 @@ func (x *LeaveWorkspaceRequest) String() string {
func (*LeaveWorkspaceRequest) ProtoMessage() {}
func (x *LeaveWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[13]
+ mi := &file_v1_workspace_service_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -937,7 +560,7 @@ func (x *LeaveWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use LeaveWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*LeaveWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{13}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{10}
}
func (x *LeaveWorkspaceRequest) GetName() string {
@@ -951,48 +574,15 @@ var File_v1_workspace_service_proto protoreflect.FileDescriptor
const file_v1_workspace_service_proto_rawDesc = "" +
"\n" +
- "\x1av1/workspace_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\x1a\x13v1/annotation.proto\x1a\x15v1/auth_service.proto\x1a\x0fv1/common.proto\x1a\x13v1/iam_policy.proto\x1a\x18v1/setting_service.proto\"\x13\n" +
- "\x11GetMCPInfoRequest\"\xa5\x03\n" +
+ "\x1av1/workspace_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\x1a\x13v1/annotation.proto\x1a\x15v1/auth_service.proto\x1a\x13v1/iam_policy.proto\x1a\x18v1/setting_service.proto\"\x13\n" +
+ "\x11GetMCPInfoRequest\"\x9c\x02\n" +
"\aMCPInfo\x12!\n" +
"\tworkspace\x18\x01 \x01(\tB\x03\xe0A\x03R\tworkspace\x12G\n" +
"\n" +
"capability\x18\x02 \x01(\x0e2\".bytebase.v1.MCPSetting.CapabilityB\x03\xe0A\x03R\n" +
- "capability\x129\n" +
- "\x05modes\x18\x03 \x03(\v2\x1e.bytebase.v1.MCPCapabilityModeB\x03\xe0A\x03R\x05modes\x125\n" +
- "\amethods\x18\x04 \x03(\v2\x16.bytebase.v1.MCPMethodB\x03\xe0A\x03R\amethods\x12@\n" +
- "\aengines\x18\x05 \x03(\v2!.bytebase.v1.MCPEngineEnforcementB\x03\xe0A\x03R\aengines\x12?\n" +
+ "capability\x12?\n" +
"\x19ignore_masking_exemptions\x18\x06 \x01(\bB\x03\xe0A\x03R\x17ignoreMaskingExemptions\x129\n" +
- "\x16data_masking_available\x18\a \x01(\bB\x03\xe0A\x03R\x14dataMaskingAvailable\"\x9b\x01\n" +
- "\x11MCPCapabilityMode\x12B\n" +
- "\n" +
- "capability\x18\x01 \x01(\x0e2\".bytebase.v1.MCPSetting.CapabilityR\n" +
- "capability\x12B\n" +
- "\x0eserved_classes\x18\x02 \x03(\x0e2\x1b.bytebase.v1.MCPMethodClassR\rservedClasses\"\xd3\x01\n" +
- "\tMCPMethod\x12\x16\n" +
- "\x06method\x18\x01 \x01(\tR\x06method\x12!\n" +
- "\foperation_id\x18\x04 \x01(\tR\voperationId\x121\n" +
- "\x05class\x18\x02 \x01(\x0e2\x1b.bytebase.v1.MCPMethodClassR\x05class\x12\x1e\n" +
- "\n" +
- "permission\x18\x03 \x01(\tR\n" +
- "permission\x128\n" +
- "\vauth_method\x18\x05 \x01(\x0e2\x17.bytebase.v1.AuthMethodR\n" +
- "authMethod\"\xaa\x03\n" +
- "\x14MCPEngineEnforcement\x12+\n" +
- "\x06engine\x18\x01 \x01(\x0e2\x13.bytebase.v1.EngineR\x06engine\x12W\n" +
- "\x0fread_only_depth\x18\x02 \x01(\x0e2/.bytebase.v1.MCPEngineEnforcement.ReadOnlyDepthR\rreadOnlyDepth\x12C\n" +
- "\amasking\x18\x03 \x01(\x0e2).bytebase.v1.MCPEngineEnforcement.MaskingR\amasking\x12\x12\n" +
- "\x04note\x18\x04 \x01(\tR\x04note\"k\n" +
- "\rReadOnlyDepth\x12\x1f\n" +
- "\x1bREAD_ONLY_DEPTH_UNSPECIFIED\x10\x00\x12\x0f\n" +
- "\vUNSUPPORTED\x10\x01\x12\r\n" +
- "\tSTATEMENT\x10\x02\x12\x19\n" +
- "\x15STATEMENT_AND_SESSION\x10\x03\"F\n" +
- "\aMasking\x12\x17\n" +
- "\x13MASKING_UNSPECIFIED\x10\x00\x12\b\n" +
- "\x04NONE\x10\x01\x12\n" +
- "\n" +
- "\x06COLUMN\x10\x02\x12\f\n" +
- "\bDOCUMENT\x10\x03\"U\n" +
+ "\x16data_masking_available\x18\a \x01(\bB\x03\xe0A\x03R\x14dataMaskingAvailableJ\x04\b\x03\x10\x04J\x04\b\x04\x10\x05J\x04\b\x05\x10\x06R\x05modesR\amethodsR\aengines\"U\n" +
"\x1fRotateDirectorySyncTokenRequest\x122\n" +
"\x04name\x18\x01 \x01(\tB\x1e\xe0A\x02\xfaA\x18\n" +
"\x16bytebase.com/WorkspaceR\x04name\"A\n" +
@@ -1042,73 +632,54 @@ func file_v1_workspace_service_proto_rawDescGZIP() []byte {
return file_v1_workspace_service_proto_rawDescData
}
-var file_v1_workspace_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
+var file_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_v1_workspace_service_proto_goTypes = []any{
- (MCPEngineEnforcement_ReadOnlyDepth)(0), // 0: bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth
- (MCPEngineEnforcement_Masking)(0), // 1: bytebase.v1.MCPEngineEnforcement.Masking
- (*GetMCPInfoRequest)(nil), // 2: bytebase.v1.GetMCPInfoRequest
- (*MCPInfo)(nil), // 3: bytebase.v1.MCPInfo
- (*MCPCapabilityMode)(nil), // 4: bytebase.v1.MCPCapabilityMode
- (*MCPMethod)(nil), // 5: bytebase.v1.MCPMethod
- (*MCPEngineEnforcement)(nil), // 6: bytebase.v1.MCPEngineEnforcement
- (*RotateDirectorySyncTokenRequest)(nil), // 7: bytebase.v1.RotateDirectorySyncTokenRequest
- (*RotateDirectorySyncTokenResponse)(nil), // 8: bytebase.v1.RotateDirectorySyncTokenResponse
- (*ListWorkspacesRequest)(nil), // 9: bytebase.v1.ListWorkspacesRequest
- (*ListWorkspacesResponse)(nil), // 10: bytebase.v1.ListWorkspacesResponse
- (*GetWorkspaceRequest)(nil), // 11: bytebase.v1.GetWorkspaceRequest
- (*Workspace)(nil), // 12: bytebase.v1.Workspace
- (*DeleteWorkspaceRequest)(nil), // 13: bytebase.v1.DeleteWorkspaceRequest
- (*UpdateWorkspaceRequest)(nil), // 14: bytebase.v1.UpdateWorkspaceRequest
- (*LeaveWorkspaceRequest)(nil), // 15: bytebase.v1.LeaveWorkspaceRequest
- (MCPSetting_Capability)(0), // 16: bytebase.v1.MCPSetting.Capability
- (MCPMethodClass)(0), // 17: bytebase.v1.MCPMethodClass
- (AuthMethod)(0), // 18: bytebase.v1.AuthMethod
- (Engine)(0), // 19: bytebase.v1.Engine
- (*fieldmaskpb.FieldMask)(nil), // 20: google.protobuf.FieldMask
- (*GetIamPolicyRequest)(nil), // 21: bytebase.v1.GetIamPolicyRequest
- (*SetIamPolicyRequest)(nil), // 22: bytebase.v1.SetIamPolicyRequest
- (*IamPolicy)(nil), // 23: bytebase.v1.IamPolicy
- (*LoginResponse)(nil), // 24: bytebase.v1.LoginResponse
+ (*GetMCPInfoRequest)(nil), // 0: bytebase.v1.GetMCPInfoRequest
+ (*MCPInfo)(nil), // 1: bytebase.v1.MCPInfo
+ (*RotateDirectorySyncTokenRequest)(nil), // 2: bytebase.v1.RotateDirectorySyncTokenRequest
+ (*RotateDirectorySyncTokenResponse)(nil), // 3: bytebase.v1.RotateDirectorySyncTokenResponse
+ (*ListWorkspacesRequest)(nil), // 4: bytebase.v1.ListWorkspacesRequest
+ (*ListWorkspacesResponse)(nil), // 5: bytebase.v1.ListWorkspacesResponse
+ (*GetWorkspaceRequest)(nil), // 6: bytebase.v1.GetWorkspaceRequest
+ (*Workspace)(nil), // 7: bytebase.v1.Workspace
+ (*DeleteWorkspaceRequest)(nil), // 8: bytebase.v1.DeleteWorkspaceRequest
+ (*UpdateWorkspaceRequest)(nil), // 9: bytebase.v1.UpdateWorkspaceRequest
+ (*LeaveWorkspaceRequest)(nil), // 10: bytebase.v1.LeaveWorkspaceRequest
+ (MCPSetting_Capability)(0), // 11: bytebase.v1.MCPSetting.Capability
+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
+ (*GetIamPolicyRequest)(nil), // 13: bytebase.v1.GetIamPolicyRequest
+ (*SetIamPolicyRequest)(nil), // 14: bytebase.v1.SetIamPolicyRequest
+ (*IamPolicy)(nil), // 15: bytebase.v1.IamPolicy
+ (*LoginResponse)(nil), // 16: bytebase.v1.LoginResponse
}
var file_v1_workspace_service_proto_depIdxs = []int32{
- 16, // 0: bytebase.v1.MCPInfo.capability:type_name -> bytebase.v1.MCPSetting.Capability
- 4, // 1: bytebase.v1.MCPInfo.modes:type_name -> bytebase.v1.MCPCapabilityMode
- 5, // 2: bytebase.v1.MCPInfo.methods:type_name -> bytebase.v1.MCPMethod
- 6, // 3: bytebase.v1.MCPInfo.engines:type_name -> bytebase.v1.MCPEngineEnforcement
- 16, // 4: bytebase.v1.MCPCapabilityMode.capability:type_name -> bytebase.v1.MCPSetting.Capability
- 17, // 5: bytebase.v1.MCPCapabilityMode.served_classes:type_name -> bytebase.v1.MCPMethodClass
- 17, // 6: bytebase.v1.MCPMethod.class:type_name -> bytebase.v1.MCPMethodClass
- 18, // 7: bytebase.v1.MCPMethod.auth_method:type_name -> bytebase.v1.AuthMethod
- 19, // 8: bytebase.v1.MCPEngineEnforcement.engine:type_name -> bytebase.v1.Engine
- 0, // 9: bytebase.v1.MCPEngineEnforcement.read_only_depth:type_name -> bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth
- 1, // 10: bytebase.v1.MCPEngineEnforcement.masking:type_name -> bytebase.v1.MCPEngineEnforcement.Masking
- 12, // 11: bytebase.v1.ListWorkspacesResponse.workspaces:type_name -> bytebase.v1.Workspace
- 12, // 12: bytebase.v1.UpdateWorkspaceRequest.workspace:type_name -> bytebase.v1.Workspace
- 20, // 13: bytebase.v1.UpdateWorkspaceRequest.update_mask:type_name -> google.protobuf.FieldMask
- 11, // 14: bytebase.v1.WorkspaceService.GetWorkspace:input_type -> bytebase.v1.GetWorkspaceRequest
- 9, // 15: bytebase.v1.WorkspaceService.ListWorkspaces:input_type -> bytebase.v1.ListWorkspacesRequest
- 14, // 16: bytebase.v1.WorkspaceService.UpdateWorkspace:input_type -> bytebase.v1.UpdateWorkspaceRequest
- 21, // 17: bytebase.v1.WorkspaceService.GetIamPolicy:input_type -> bytebase.v1.GetIamPolicyRequest
- 13, // 18: bytebase.v1.WorkspaceService.DeleteWorkspace:input_type -> bytebase.v1.DeleteWorkspaceRequest
- 15, // 19: bytebase.v1.WorkspaceService.LeaveWorkspace:input_type -> bytebase.v1.LeaveWorkspaceRequest
- 22, // 20: bytebase.v1.WorkspaceService.SetIamPolicy:input_type -> bytebase.v1.SetIamPolicyRequest
- 2, // 21: bytebase.v1.WorkspaceService.GetMCPInfo:input_type -> bytebase.v1.GetMCPInfoRequest
- 7, // 22: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:input_type -> bytebase.v1.RotateDirectorySyncTokenRequest
- 12, // 23: bytebase.v1.WorkspaceService.GetWorkspace:output_type -> bytebase.v1.Workspace
- 10, // 24: bytebase.v1.WorkspaceService.ListWorkspaces:output_type -> bytebase.v1.ListWorkspacesResponse
- 12, // 25: bytebase.v1.WorkspaceService.UpdateWorkspace:output_type -> bytebase.v1.Workspace
- 23, // 26: bytebase.v1.WorkspaceService.GetIamPolicy:output_type -> bytebase.v1.IamPolicy
- 24, // 27: bytebase.v1.WorkspaceService.DeleteWorkspace:output_type -> bytebase.v1.LoginResponse
- 24, // 28: bytebase.v1.WorkspaceService.LeaveWorkspace:output_type -> bytebase.v1.LoginResponse
- 23, // 29: bytebase.v1.WorkspaceService.SetIamPolicy:output_type -> bytebase.v1.IamPolicy
- 3, // 30: bytebase.v1.WorkspaceService.GetMCPInfo:output_type -> bytebase.v1.MCPInfo
- 8, // 31: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:output_type -> bytebase.v1.RotateDirectorySyncTokenResponse
- 23, // [23:32] is the sub-list for method output_type
- 14, // [14:23] is the sub-list for method input_type
- 14, // [14:14] is the sub-list for extension type_name
- 14, // [14:14] is the sub-list for extension extendee
- 0, // [0:14] is the sub-list for field type_name
+ 11, // 0: bytebase.v1.MCPInfo.capability:type_name -> bytebase.v1.MCPSetting.Capability
+ 7, // 1: bytebase.v1.ListWorkspacesResponse.workspaces:type_name -> bytebase.v1.Workspace
+ 7, // 2: bytebase.v1.UpdateWorkspaceRequest.workspace:type_name -> bytebase.v1.Workspace
+ 12, // 3: bytebase.v1.UpdateWorkspaceRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 6, // 4: bytebase.v1.WorkspaceService.GetWorkspace:input_type -> bytebase.v1.GetWorkspaceRequest
+ 4, // 5: bytebase.v1.WorkspaceService.ListWorkspaces:input_type -> bytebase.v1.ListWorkspacesRequest
+ 9, // 6: bytebase.v1.WorkspaceService.UpdateWorkspace:input_type -> bytebase.v1.UpdateWorkspaceRequest
+ 13, // 7: bytebase.v1.WorkspaceService.GetIamPolicy:input_type -> bytebase.v1.GetIamPolicyRequest
+ 8, // 8: bytebase.v1.WorkspaceService.DeleteWorkspace:input_type -> bytebase.v1.DeleteWorkspaceRequest
+ 10, // 9: bytebase.v1.WorkspaceService.LeaveWorkspace:input_type -> bytebase.v1.LeaveWorkspaceRequest
+ 14, // 10: bytebase.v1.WorkspaceService.SetIamPolicy:input_type -> bytebase.v1.SetIamPolicyRequest
+ 0, // 11: bytebase.v1.WorkspaceService.GetMCPInfo:input_type -> bytebase.v1.GetMCPInfoRequest
+ 2, // 12: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:input_type -> bytebase.v1.RotateDirectorySyncTokenRequest
+ 7, // 13: bytebase.v1.WorkspaceService.GetWorkspace:output_type -> bytebase.v1.Workspace
+ 5, // 14: bytebase.v1.WorkspaceService.ListWorkspaces:output_type -> bytebase.v1.ListWorkspacesResponse
+ 7, // 15: bytebase.v1.WorkspaceService.UpdateWorkspace:output_type -> bytebase.v1.Workspace
+ 15, // 16: bytebase.v1.WorkspaceService.GetIamPolicy:output_type -> bytebase.v1.IamPolicy
+ 16, // 17: bytebase.v1.WorkspaceService.DeleteWorkspace:output_type -> bytebase.v1.LoginResponse
+ 16, // 18: bytebase.v1.WorkspaceService.LeaveWorkspace:output_type -> bytebase.v1.LoginResponse
+ 15, // 19: bytebase.v1.WorkspaceService.SetIamPolicy:output_type -> bytebase.v1.IamPolicy
+ 1, // 20: bytebase.v1.WorkspaceService.GetMCPInfo:output_type -> bytebase.v1.MCPInfo
+ 3, // 21: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:output_type -> bytebase.v1.RotateDirectorySyncTokenResponse
+ 13, // [13:22] is the sub-list for method output_type
+ 4, // [4:13] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
}
func init() { file_v1_workspace_service_proto_init() }
@@ -1118,7 +689,6 @@ func file_v1_workspace_service_proto_init() {
}
file_v1_annotation_proto_init()
file_v1_auth_service_proto_init()
- file_v1_common_proto_init()
file_v1_iam_policy_proto_init()
file_v1_setting_service_proto_init()
type x struct{}
@@ -1126,14 +696,13 @@ func file_v1_workspace_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_workspace_service_proto_rawDesc), len(file_v1_workspace_service_proto_rawDesc)),
- NumEnums: 2,
- NumMessages: 14,
+ NumEnums: 0,
+ NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_v1_workspace_service_proto_goTypes,
DependencyIndexes: file_v1_workspace_service_proto_depIdxs,
- EnumInfos: file_v1_workspace_service_proto_enumTypes,
MessageInfos: file_v1_workspace_service_proto_msgTypes,
}.Build()
File_v1_workspace_service_proto = out.File
diff --git a/backend/generated-go/v1/workspace_service_equal.pb.go b/backend/generated-go/v1/workspace_service_equal.pb.go
index f7f95ff316..d7d7d7205a 100644
--- a/backend/generated-go/v1/workspace_service_equal.pb.go
+++ b/backend/generated-go/v1/workspace_service_equal.pb.go
@@ -31,30 +31,6 @@ func (x *MCPInfo) Equal(y *MCPInfo) bool {
if x.Capability != y.Capability {
return false
}
- if len(x.Modes) != len(y.Modes) {
- return false
- }
- for i := 0; i < len(x.Modes); i++ {
- if !x.Modes[i].Equal(y.Modes[i]) {
- return false
- }
- }
- if len(x.Methods) != len(y.Methods) {
- return false
- }
- for i := 0; i < len(x.Methods); i++ {
- if !x.Methods[i].Equal(y.Methods[i]) {
- return false
- }
- }
- if len(x.Engines) != len(y.Engines) {
- return false
- }
- for i := 0; i < len(x.Engines); i++ {
- if !x.Engines[i].Equal(y.Engines[i]) {
- return false
- }
- }
if x.IgnoreMaskingExemptions != y.IgnoreMaskingExemptions {
return false
}
@@ -64,74 +40,6 @@ func (x *MCPInfo) Equal(y *MCPInfo) bool {
return true
}
-func (x *MCPCapabilityMode) Equal(y *MCPCapabilityMode) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Capability != y.Capability {
- return false
- }
- if len(x.ServedClasses) != len(y.ServedClasses) {
- return false
- }
- for i := 0; i < len(x.ServedClasses); i++ {
- if x.ServedClasses[i] != y.ServedClasses[i] {
- return false
- }
- }
- return true
-}
-
-func (x *MCPMethod) Equal(y *MCPMethod) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Method != y.Method {
- return false
- }
- if x.OperationId != y.OperationId {
- return false
- }
- if x.Class != y.Class {
- return false
- }
- if x.Permission != y.Permission {
- return false
- }
- if x.AuthMethod != y.AuthMethod {
- return false
- }
- return true
-}
-
-func (x *MCPEngineEnforcement) Equal(y *MCPEngineEnforcement) bool {
- if x == y {
- return true
- }
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if x.Engine != y.Engine {
- return false
- }
- if x.ReadOnlyDepth != y.ReadOnlyDepth {
- return false
- }
- if x.Masking != y.Masking {
- return false
- }
- if x.Note != y.Note {
- return false
- }
- return true
-}
-
func (x *RotateDirectorySyncTokenRequest) Equal(y *RotateDirectorySyncTokenRequest) bool {
if x == y {
return true
diff --git a/backend/generated-go/v1/workspace_service_grpc.pb.go b/backend/generated-go/v1/workspace_service_grpc.pb.go
index 31e827368e..ce503e1291 100644
--- a/backend/generated-go/v1/workspace_service_grpc.pb.go
+++ b/backend/generated-go/v1/workspace_service_grpc.pb.go
@@ -61,9 +61,8 @@ type WorkspaceServiceClient interface {
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(ctx context.Context, in *SetIamPolicyRequest, opts ...grpc.CallOption) (*IamPolicy, error)
// Gets what MCP (Model Context Protocol) does in this workspace: the
- // capability ceiling in force, what each ceiling serves, and the per-engine
- // facts a read-only session depends on. The workspace is resolved from the
- // authenticated session.
+ // capability ceiling in force, and whether masking narrows what a session
+ // reads under it. The workspace is resolved from the authenticated session.
//
// Served to MCP sessions. An agent asking what it may do here is the point:
// the response says nothing a session's own denials do not already say, one
@@ -209,9 +208,8 @@ type WorkspaceServiceServer interface {
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *SetIamPolicyRequest) (*IamPolicy, error)
// Gets what MCP (Model Context Protocol) does in this workspace: the
- // capability ceiling in force, what each ceiling serves, and the per-engine
- // facts a read-only session depends on. The workspace is resolved from the
- // authenticated session.
+ // capability ceiling in force, and whether masking narrows what a session
+ // reads under it. The workspace is resolved from the authenticated session.
//
// Served to MCP sessions. An agent asking what it may do here is the point:
// the response says nothing a session's own denials do not already say, one
diff --git a/frontend/scripts/check-react-i18n.mjs b/frontend/scripts/check-react-i18n.mjs
index 65d249612d..9ee0d71683 100644
--- a/frontend/scripts/check-react-i18n.mjs
+++ b/frontend/scripts/check-react-i18n.mjs
@@ -78,12 +78,11 @@ const DYNAMIC_PREFIXES = [
"settings.mcp.policy.unserved.description",
"settings.mcp.policy.unserved.title",
// Built as `…undisclosed.${reason}.<suffix>` over a reason the consent page
- // derives: title, description and line for all four, plus retry for the two
- // that offer one. Listed per reason rather than as one subtree, which would
- // also exempt the two sibling keys named literally.
- "oauth2.consent.mcp.undisclosed.outdated.",
+ // derives: title, description and line for both, plus retry for the one that
+ // offers it. Listed per reason rather than as one subtree, which would also
+ // exempt the two sibling keys named literally.
+ "oauth2.consent.mcp.undisclosed.undisclosable.",
"oauth2.consent.mcp.undisclosed.unknown.",
- "oauth2.consent.mcp.undisclosed.unserved.",
// Keys consumed by SHARED non-React `.ts` modules that translate via
// `@/lib/i18n` (the same react-i18next instance — vue-i18n is gone), but
// live OUTSIDE this checker's React-only scan, so they read as unused. They
diff --git a/frontend/src/components/mcp/MCPModeContentsSheet.test.tsx b/frontend/src/components/mcp/MCPModeContentsSheet.test.tsx
deleted file mode 100644
index 668552d676..0000000000
--- a/frontend/src/components/mcp/MCPModeContentsSheet.test.tsx
+++ /dev/null
@@ -1,191 +0,0 @@
-import type { ReactElement } from "react";
-import { act } from "react";
-import { createRoot } from "react-dom/client";
-import { afterEach, describe, expect, test, vi } from "vitest";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";
-import { MCPEngineEnforcement_ReadOnlyDepth } from "@/types/proto-es/v1/workspace_service_pb";
-import { MCPMethodClass } from "@/types/proto-es/v1/annotation_pb";
-import { MCPModeContentsSheet } from "./MCPModeContentsSheet";
-
-(
- globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }
-).IS_REACT_ACT_ENVIRONMENT = true;
-
-vi.mock("react-i18next", () => ({
- useTranslation: () => ({ t: (key: string) => key }),
- initReactI18next: { type: "3rdParty", init: () => {} },
-}));
-
-const REDSHIFT_NOTE =
- "Outside a datashare database the driver also opens the session read-only. " +
- "A datashare database cannot run a read-only transaction, so there it is " +
- "statement classification alone.";
-
-const info = {
- workspace: "workspaces/ws",
- capability: MCPSetting_Capability.READ_ONLY,
- modes: [
- {
- capability: MCPSetting_Capability.READ_ONLY,
- servedClasses: [MCPMethodClass.READ],
- },
- ],
- methods: [
- {
- method: "/bytebase.v1.SQLService/Query",
- operationId: "bytebase.v1.SQLService.Query",
- class: MCPMethodClass.READ,
- permission: "bb.sql.select",
- authMethod: 0,
- },
- {
- method: "/bytebase.v1.ActuatorService/GetActuatorInfo",
- operationId: "bytebase.v1.ActuatorService.GetActuatorInfo",
- class: MCPMethodClass.READ,
- permission: "",
- authMethod: 0,
- },
- ],
- engines: [
- {
- engine: Engine.REDSHIFT,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT,
- masking: 0,
- note: REDSHIFT_NOTE,
- },
- ],
- ignoreMaskingExemptions: false,
- dataMaskingAvailable: true,
-} as unknown as Parameters<typeof MCPModeContentsSheet>[0]["info"];
-
-// The sheet portals, so the container is attached to the document.
-const renderSheet = (element: ReactElement) => {
- const container = document.createElement("div");
- document.body.appendChild(container);
- const root = createRoot(container);
- act(() => root.render(element));
- return () => {
- act(() => root.unmount());
- container.remove();
- };
-};
-
-afterEach(() => {
- document.body.innerHTML = "";
-});
-
-describe("MCPModeContentsSheet", () => {
- // Codex, #21236: engine.note is server-authored English (mcp_info.go
- // mcpEngineNote). Rendering it raw shows English in every other locale, which
- // is the rule at AGENTS.md:146-150. The server owns whether an engine has a
- // caveat; the words are the frontend's.
- test("translates the engine note instead of rendering the server's prose", () => {
- const unmount = renderSheet(
- <MCPModeContentsSheet
- open
- capability={MCPSetting_Capability.READ_ONLY}
- info={info}
- modeLabel="Read-only"
- ignoreMaskingExemptions={false}
- onClose={() => {}}
- />
- );
-
- expect(document.body.textContent).toContain(
- "settings.mcp.contents.notes.redshift"
- );
- expect(document.body.textContent).not.toContain("datashare");
-
- unmount();
- });
-
- // Codex, #21236: a newer backend can attach a note to an engine this bundle
- // has no wording for. Returning the server's sentence put English prose in
- // every locale; dropping it lost a caveat that is the only place a
- // per-engine floor is stated. It announces the caveat in the viewer's
- // language and names the remedy instead.
- test("an engine with no wording announces the caveat rather than quoting it", () => {
- const future = {
- ...info,
- engines: [
- {
- engine: Engine.SPANNER,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT,
- masking: 0,
- note: "Spanner does something this build has never heard of.",
- },
- ],
- } as unknown as Parameters<typeof MCPModeContentsSheet>[0]["info"];
-
- const unmount = renderSheet(
- <MCPModeContentsSheet
- open
- capability={MCPSetting_Capability.READ_ONLY}
- info={future}
- modeLabel="Read-only"
- ignoreMaskingExemptions={false}
- onClose={() => {}}
- />
- );
-
- expect(document.body.textContent).toContain(
- "settings.mcp.contents.notes.unavailable"
- );
- expect(document.body.textContent).not.toContain("never heard of");
-
- unmount();
- });
-
- test("the masking description follows the value it is given", () => {
- const unmount = renderSheet(
- <MCPModeContentsSheet
- open
- capability={MCPSetting_Capability.READ_ONLY}
- info={info}
- modeLabel="Read-only"
- ignoreMaskingExemptions
- onClose={() => {}}
- />
- );
-
- // Not info.ignoreMaskingExemptions, which is false above.
- expect(document.body.textContent).toContain(
- "settings.mcp.contents.masking.description-on"
- );
- expect(document.body.textContent).not.toContain(
- "settings.mcp.contents.masking.description-off"
- );
-
- unmount();
- });
-
- // Codex, #21236: the permission lived in a native title on a Badge, which is
- // a span — unfocusable, so a keyboard user could never read it, and it
- // appeared nowhere else. It is rendered now.
- test("renders each method's permission rather than hiding it in a tooltip", () => {
- const unmount = renderSheet(
- <MCPModeContentsSheet
- open
- capability={MCPSetting_Capability.READ_ONLY}
- info={info}
- modeLabel="Read-only"
- ignoreMaskingExemptions={false}
- onClose={() => {}}
- />
- );
-
- expect(document.body.textContent).toContain("bb.sql.select");
- // A method that authorizes in its handler says so, rather than blank.
- expect(document.body.textContent).toContain(
- "settings.mcp.contents.methods.handler"
- );
- // Nothing depends on hover: no title attribute carries the information.
- const titled = [...document.querySelectorAll("[title]")].filter((n) =>
- n.getAttribute("title")?.includes("bb.")
- );
- expect(titled).toHaveLength(0);
-
- unmount();
- });
-});
diff --git a/frontend/src/components/mcp/MCPModeContentsSheet.tsx b/frontend/src/components/mcp/MCPModeContentsSheet.tsx
deleted file mode 100644
index c80d47d85b..0000000000
--- a/frontend/src/components/mcp/MCPModeContentsSheet.tsx
+++ /dev/null
@@ -1,273 +0,0 @@
-import { useMemo } from "react";
-import { useTranslation } from "react-i18next";
-import { Separator } from "@/components/ui/separator";
-import {
- Sheet,
- SheetBody,
- SheetContent,
- SheetDescription,
- SheetHeader,
- SheetTitle,
-} from "@/components/ui/sheet";
-import { cn } from "@/lib/utils";
-import { MCPMethodClass } from "@/types/proto-es/v1/annotation_pb";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";
-import type { MCPInfo } from "@/types/proto-es/v1/workspace_service_pb";
-import {
- MCPEngineEnforcement_Masking,
- MCPEngineEnforcement_ReadOnlyDepth,
-} from "@/types/proto-es/v1/workspace_service_pb";
-import { engineNameV1 } from "@/utils/v1/instance";
-import {
- engineNotes,
- groupEnginesByMasking,
- groupEnginesByReadOnlyDepth,
- groupMethodsByService,
- methodsServedBy,
- modeFor,
-} from "./mcpPolicy";
-
-const engineLabel = (engine: Engine): string =>
- engineNameV1(engine) || Engine[engine] || String(engine);
-
-interface Props {
- readonly open: boolean;
- readonly capability: MCPSetting_Capability;
- /**
- * Required, and every caller gates its trigger on having it. An optional one
- * would let a pending or failed GetMCPInfo render as a mode that serves
- * nothing — "0 of 0" over a workspace whose ceiling this drawer exists to
- * explain. A broken ceiling is answered rather than refused (BOT-106), so
- * the drawer is available on the repair path; an outage still is not.
- */
- readonly info: MCPInfo;
- readonly modeLabel: string;
- /**
- * The masking answer this drawer describes. Required, not defaulted from
- * `info`: the settings form previews a candidate policy the admin has not
- * saved, the consent page describes the one in force, and defaulting to
- * either silently gives the other consumer the wrong one.
- */
- readonly ignoreMaskingExemptions: boolean;
- readonly onClose: () => void;
-}
-
-export function MCPModeContentsSheet({
- open,
- capability,
- info,
- modeLabel,
- ignoreMaskingExemptions,
- onClose,
-}: Props) {
- const { t } = useTranslation();
-
- const served = useMemo(
- () => methodsServedBy(modeFor(info, capability), info.methods),
- [info, capability]
- );
- const groups = useMemo(() => groupMethodsByService(served), [served]);
- // What this mode adds over Read-only: the WRITE class is the only one a
- // lower ceiling does not serve, so highlighting it is the mode delta.
- const writeCount = useMemo(
- () => served.filter((m) => m.class === MCPMethodClass.WRITE).length,
- [served]
- );
- const depthGroups = useMemo(
- () => groupEnginesByReadOnlyDepth(info.engines),
- [info]
- );
- const maskingGroups = useMemo(
- () => groupEnginesByMasking(info.engines),
- [info]
- );
- const notes = useMemo(() => engineNotes(info.engines), [info]);
-
- const depthText = (depth: MCPEngineEnforcement_ReadOnlyDepth): string => {
- switch (depth) {
- case MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION:
- return t("settings.mcp.contents.depth.statement-and-session");
- case MCPEngineEnforcement_ReadOnlyDepth.STATEMENT:
- return t("settings.mcp.contents.depth.statement");
- case MCPEngineEnforcement_ReadOnlyDepth.UNSUPPORTED:
- return t("settings.mcp.contents.depth.unsupported");
- default:
- return t("settings.mcp.contents.depth.unspecified");
- }
- };
-
- // The server's note is English prose and is never rendered. The console keys
- // off the engine, which is what keeps the caveat translated — and a newer
- // backend can carry a note for an engine this bundle has no wording for, so
- // the caveat is still announced rather than dropped or shown in English.
- // The caller only passes engines that have a note (engineNotes filters).
- const noteText = (engine: Engine): string =>
- engine === Engine.REDSHIFT
- ? t("settings.mcp.contents.notes.redshift")
- : t("settings.mcp.contents.notes.unavailable");
-
- const maskingText = (masking: MCPEngineEnforcement_Masking): string => {
- switch (masking) {
- case MCPEngineEnforcement_Masking.COLUMN:
- return t("settings.mcp.contents.masking.column");
- case MCPEngineEnforcement_Masking.DOCUMENT:
- return t("settings.mcp.contents.masking.document");
- case MCPEngineEnforcement_Masking.NONE:
- return t("settings.mcp.contents.masking.none");
- default:
- return t("settings.mcp.contents.masking.unspecified");
- }
- };
-
- return (
- <Sheet open={open} onOpenChange={(next) => !next && onClose()}>
- <SheetContent width="standard">
- <SheetHeader>
- <SheetTitle>
- {t("settings.mcp.contents.title", { mode: modeLabel })}
- </SheetTitle>
- <SheetDescription>
- {t("settings.mcp.contents.methods.count", {
- served: served.length,
- total: info?.methods.length ?? 0,
- })}
- {writeCount > 0 && (
- <>
- {" "}
- {t("settings.mcp.contents.methods.write-legend", {
- count: writeCount,
- })}
- </>
- )}
- </SheetDescription>
- </SheetHeader>
-
- <SheetBody>
- <div className="flex flex-col gap-y-6">
- <section className="flex flex-col gap-y-4">
- {groups.length === 0 ? (
- <p className="textinfolabel">
- {t("settings.mcp.contents.methods.none")}
- </p>
- ) : (
- groups.map((group) => (
- <div key={group.service} className="flex flex-col gap-y-2">
- <h4 className="text-xs font-medium tracking-wide text-control-light">
- {group.service}
- </h4>
- {/* The permission is rendered, not hovered. It used to sit
- in a native title on a Badge, which is a span: a keyboard
- user could never open it, and it was the only place the
- permission appeared. */}
- <div className="flex flex-col gap-y-1">
- {group.methods.map((method) => (
- <div
- key={method.method}
- className="grid grid-cols-[1fr_auto] items-baseline gap-x-4 text-xs"
- >
- <span
- className={cn(
- "font-mono",
- method.class === MCPMethodClass.WRITE
- ? "text-warning"
- : "text-main"
- )}
- >
- {method.operationId.split(".").pop()}
- </span>
- <span className="font-mono text-control-light">
- {method.permission ||
- t("settings.mcp.contents.methods.handler")}
- </span>
- </div>
- ))}
- </div>
- </div>
- ))
- )}
- </section>
-
- {capability === MCPSetting_Capability.READ_ONLY && (
- <>
- <Separator />
- <section className="flex flex-col gap-y-3">
- <div className="flex flex-col gap-y-1">
- <h3 className="text-base font-medium">
- {t("settings.mcp.contents.depth.title")}
- </h3>
- <p className="textinfolabel">
- {t("settings.mcp.contents.depth.description")}
- </p>
- </div>
- {depthGroups.map((group) => (
- <div key={group.value} className="flex flex-col gap-y-1">
- <p className="text-sm text-main">
- {depthText(group.value)}
- </p>
- <p className="text-sm text-control-light">
- {group.engines.map(engineLabel).join(", ")}
- </p>
- </div>
- ))}
- <p className="textinfolabel">
- {t("settings.mcp.contents.depth.not-a-proof")}
- </p>
- </section>
- </>
- )}
-
- <Separator />
- <section className="flex flex-col gap-y-3">
- <div className="flex flex-col gap-y-1">
- <h3 className="text-base font-medium">
- {t("settings.mcp.contents.masking.title")}
- </h3>
- <p className="textinfolabel">
- {ignoreMaskingExemptions
- ? t("settings.mcp.contents.masking.description-on")
- : t("settings.mcp.contents.masking.description-off")}
- </p>
- </div>
- {!info.dataMaskingAvailable && (
- <p className="text-sm text-warning">
- {t("settings.mcp.policy.masking.unavailable")}
- </p>
- )}
- {maskingGroups.map((group) => (
- <div key={group.value} className="flex flex-col gap-y-1">
- <p className="text-sm text-main">
- {maskingText(group.value)}
- </p>
- <p className="text-sm text-control-light">
- {group.engines.map(engineLabel).join(", ")}
- </p>
- </div>
- ))}
- </section>
-
- {notes.length > 0 && (
- <>
- <Separator />
- <section className="flex flex-col gap-y-2">
- <h3 className="text-base font-medium">
- {t("settings.mcp.contents.notes.title")}
- </h3>
- {notes.map((engine) => (
- <p key={engine.engine} className="text-sm text-control">
- <span className="font-medium">
- {engineLabel(engine.engine)}
- </span>
- {": "}
- {noteText(engine.engine)}
- </p>
- ))}
- </section>
- </>
- )}
- </div>
- </SheetBody>
- </SheetContent>
- </Sheet>
- );
-}
diff --git a/frontend/src/components/mcp/mcpPolicy.test.ts b/frontend/src/components/mcp/mcpPolicy.test.ts
index 5900fd6846..14142b1dde 100644
--- a/frontend/src/components/mcp/mcpPolicy.test.ts
+++ b/frontend/src/components/mcp/mcpPolicy.test.ts
@@ -1,26 +1,34 @@
import { create } from "@bufbuild/protobuf";
import { describe, expect, test } from "vitest";
-import { MCPMethodClass } from "@/types/proto-es/v1/annotation_pb";
-import { Engine } from "@/types/proto-es/v1/common_pb";
import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";
+import { MCPInfoSchema } from "@/types/proto-es/v1/workspace_service_pb";
import {
- MCPCapabilityModeSchema,
- MCPEngineEnforcement_Masking,
- MCPEngineEnforcement_ReadOnlyDepth,
- MCPEngineEnforcementSchema,
- MCPInfoSchema,
- MCPMethodSchema,
-} from "@/types/proto-es/v1/workspace_service_pb";
-import {
- groupEnginesByMasking,
- groupEnginesByReadOnlyDepth,
- groupMethodsByService,
isMCPMode,
- methodsServedBy,
+ MCP_CAPABILITY_CHOICES,
readConsentCeiling,
- serviceOfMethod,
} from "./mcpPolicy";
+describe("MCP_CAPABILITY_CHOICES", () => {
+ // This list is the bundle's copy of the gate's serving table
+ // (mcpServingClasses, backend/api/v1/mcp_gate.go), and it decides two things:
+ // which ceilings the settings radio offers, and which ones the consent page
+ // will disclose. A capability a release adds to the enum and forgets here
+ // ships a settings page that cannot select it and a consent page that
+ // withholds Allow on every workspace using it. Nothing on the Go side notices
+ // a TypeScript omission, so the generated enum is the counterpart to check.
+ test("covers every capability the enum offers", () => {
+ const declared = Object.values(MCPSetting_Capability).filter(
+ (value): value is MCPSetting_Capability => typeof value === "number"
+ );
+ // 0 is the absence of a ceiling, not a ceiling. The reserved 2 needs no
+ // exclusion: a reserved number generates no enum member.
+ const selectable = declared.filter(
+ (value) => value !== MCPSetting_Capability.CAPABILITY_UNSPECIFIED
+ );
+ expect([...MCP_CAPABILITY_CHOICES].sort()).toEqual(selectable.sort());
+ });
+});
+
describe("isMCPMode", () => {
test("accepts only selectable capabilities", () => {
expect(isMCPMode(MCPSetting_Capability.DISABLED)).toBe(true);
@@ -32,176 +40,7 @@ describe("isMCPMode", () => {
});
});
-describe("methodsServedBy", () => {
- const query = create(MCPMethodSchema, {
- method: "/bytebase.v1.SQLService/Query",
- operationId: "bytebase.v1.SQLService.Query",
- class: MCPMethodClass.READ,
- });
- const createSheet = create(MCPMethodSchema, {
- method: "/bytebase.v1.SheetService/CreateSheet",
- operationId: "bytebase.v1.SheetService.CreateSheet",
- class: MCPMethodClass.WRITE,
- });
-
- test("a mode serves a method when it serves the method's class", () => {
- const readOnly = create(MCPCapabilityModeSchema, {
- capability: MCPSetting_Capability.READ_ONLY,
- servedClasses: [MCPMethodClass.READ],
- });
- expect(methodsServedBy(readOnly, [query, createSheet])).toEqual([query]);
- });
-
- test("a mode that serves nothing serves nothing", () => {
- const disabled = create(MCPCapabilityModeSchema, {
- capability: MCPSetting_Capability.DISABLED,
- servedClasses: [],
- });
- expect(methodsServedBy(disabled, [query, createSheet])).toEqual([]);
- expect(methodsServedBy(undefined, [query, createSheet])).toEqual([]);
- });
-});
-
-describe("grouping", () => {
- test("methods group under their service's short name", () => {
- const rows = [
- create(MCPMethodSchema, {
- method: "/bytebase.v1.SQLService/Query",
- operationId: "bytebase.v1.SQLService.Query",
- }),
- create(MCPMethodSchema, {
- method: "/bytebase.v1.SQLService/Export",
- operationId: "bytebase.v1.SQLService.Export",
- }),
- create(MCPMethodSchema, {
- method: "/bytebase.v1.DatabaseService/GetDatabase",
- operationId: "bytebase.v1.DatabaseService.GetDatabase",
- }),
- ];
- expect(serviceOfMethod(rows[0])).toBe("SQLService");
- expect(groupMethodsByService(rows)).toEqual([
- { service: "DatabaseService", methods: [rows[2]] },
- { service: "SQLService", methods: [rows[1], rows[0]] },
- ]);
- });
-
- // Codex, #21236: a bundle in an open tab can outlive a backend upgrade, and
- // the server answers with the depth it computed, not the ones this build was
- // compiled against. Filtering the known order dropped the group entirely, so
- // the engine left the page rather than being described imprecisely — and both
- // renderers already have a default arm for exactly this.
- test("a depth this build does not know sorts last instead of vanishing", () => {
- const future = 99 as MCPEngineEnforcement_ReadOnlyDepth;
- const engines = [
- create(MCPEngineEnforcementSchema, {
- engine: Engine.SPANNER,
- readOnlyDepth: future,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.POSTGRES,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION,
- }),
- ];
- expect(groupEnginesByReadOnlyDepth(engines)).toEqual([
- {
- value: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION,
- engines: [Engine.POSTGRES],
- },
- { value: future, engines: [Engine.SPANNER] },
- ]);
- });
-
- test("a masking mode this build does not know sorts last too", () => {
- const future = 99 as MCPEngineEnforcement_Masking;
- const engines = [
- create(MCPEngineEnforcementSchema, {
- engine: Engine.SPANNER,
- masking: future,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.POSTGRES,
- masking: MCPEngineEnforcement_Masking.COLUMN,
- }),
- ];
- expect(groupEnginesByMasking(engines)).toEqual([
- {
- value: MCPEngineEnforcement_Masking.COLUMN,
- engines: [Engine.POSTGRES],
- },
- { value: future, engines: [Engine.SPANNER] },
- ]);
- });
-
- test("engines group by read-only depth, deepest first", () => {
- const engines = [
- create(MCPEngineEnforcementSchema, {
- engine: Engine.MYSQL,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.POSTGRES,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.DATABRICKS,
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth.UNSUPPORTED,
- }),
- ];
- expect(groupEnginesByReadOnlyDepth(engines)).toEqual([
- {
- value: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION,
- engines: [Engine.POSTGRES],
- },
- {
- value: MCPEngineEnforcement_ReadOnlyDepth.STATEMENT,
- engines: [Engine.MYSQL],
- },
- {
- value: MCPEngineEnforcement_ReadOnlyDepth.UNSUPPORTED,
- engines: [Engine.DATABRICKS],
- },
- ]);
- });
-
- test("masking keeps three states, never two", () => {
- // An engine Bytebase does not mask and an engine that masks without
- // consulting exemptions are different answers to "does ignoring exemptions
- // change anything here", and the copy must not flatten them.
- const engines = [
- create(MCPEngineEnforcementSchema, {
- engine: Engine.REDIS,
- masking: MCPEngineEnforcement_Masking.NONE,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.MONGODB,
- masking: MCPEngineEnforcement_Masking.DOCUMENT,
- }),
- create(MCPEngineEnforcementSchema, {
- engine: Engine.POSTGRES,
- masking: MCPEngineEnforcement_Masking.COLUMN,
- }),
- ];
- expect(groupEnginesByMasking(engines).map((group) => group.value)).toEqual([
- MCPEngineEnforcement_Masking.COLUMN,
- MCPEngineEnforcement_Masking.DOCUMENT,
- MCPEngineEnforcement_Masking.NONE,
- ]);
- });
-});
-
-// The serving table every real response carries, one row per ceiling the gate
-// evaluates. DISABLED is a row rather than an omission: it is a mode that
-// decided to serve nothing, which is not the same as a mode nobody decided
-// about (backend/api/v1/mcp_gate.go, mcpServingClasses).
-const SERVED_MODES = [1, 3, 4];
-
-const infoWith = (fields: Partial<{ capability: number; modes: number[] }>) =>
- create(MCPInfoSchema, {
- capability: fields.capability ?? MCPSetting_Capability.READ_ONLY,
- modes: (fields.modes ?? SERVED_MODES).map((capability) =>
- create(MCPCapabilityModeSchema, { capability })
- ),
- });
+const infoWith = (capability: number) => create(MCPInfoSchema, { capability });
describe("readConsentCeiling", () => {
test("no response is the policy being unknown, not absent", () => {
@@ -209,40 +48,31 @@ describe("readConsentCeiling", () => {
});
test("a served ceiling carries the response the disclosure needs", () => {
- const info = infoWith({ capability: 4 });
+ const info = infoWith(MCPSetting_Capability.READ_WRITE);
expect(readConsentCeiling(info)).toEqual({ kind: "mode", info });
});
test("disabled is a policy, so it reaches its own screen", () => {
- // Not undisclosed: an admin turned MCP off, which is a decision this page
+ // Not undisclosable: an admin turned MCP off, which is a decision this page
// can name and the one refusing ceiling with a screen of its own.
- const info = infoWith({ capability: 1 });
+ const info = infoWith(MCPSetting_Capability.DISABLED);
expect(readConsentCeiling(info)).toEqual({ kind: "mode", info });
});
- test("an unresolvable stored value is unserved, like any value no mode serves", () => {
- // The capability arrives unspecified when nothing could be resolved from
- // the row. It has no row in modes either, and the remedy is the same as for
- // a value that parsed but nothing serves, so it is one state.
- expect(readConsentCeiling(infoWith({ capability: 0 }))).toEqual({
- kind: "unserved",
- });
+ // The three ways a stored ceiling reaches this page without a name for it.
+ // They differed once, by whether the server's serving table carried a row;
+ // the remedy the page prints now names both repairs, so they are one state.
+ test("a value nothing could resolve is undisclosable", () => {
+ expect(
+ readConsentCeiling(infoWith(MCPSetting_Capability.CAPABILITY_UNSPECIFIED))
+ ).toEqual({ kind: "undisclosable" });
});
- test("a value with no row in the serving table is unserved", () => {
- expect(readConsentCeiling(infoWith({ capability: 2 }))).toEqual({
- kind: "unserved",
- });
+ test("the reserved tier is undisclosable", () => {
+ expect(readConsentCeiling(infoWith(2))).toEqual({ kind: "undisclosable" });
});
- test("a served ceiling this bundle cannot name is outdated, not unserved", () => {
- // The difference decides the instruction on screen: reload, or find an
- // admin. The server serves this one, so there is nothing for an admin to
- // repair.
- expect(
- readConsentCeiling(
- infoWith({ capability: 5, modes: [...SERVED_MODES, 5] })
- )
- ).toEqual({ kind: "outdated" });
+ test("a tier a newer release wrote is undisclosable", () => {
+ expect(readConsentCeiling(infoWith(5))).toEqual({ kind: "undisclosable" });
});
});
diff --git a/frontend/src/components/mcp/mcpPolicy.ts b/frontend/src/components/mcp/mcpPolicy.ts
index 0b4168a1e7..1496d2e72a 100644
--- a/frontend/src/components/mcp/mcpPolicy.ts
+++ b/frontend/src/components/mcp/mcpPolicy.ts
@@ -1,22 +1,16 @@
-import type { Engine } from "@/types/proto-es/v1/common_pb";
import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";
-import type {
- MCPCapabilityMode,
- MCPEngineEnforcement,
- MCPInfo,
- MCPMethod,
-} from "@/types/proto-es/v1/workspace_service_pb";
-import {
- MCPEngineEnforcement_Masking,
- MCPEngineEnforcement_ReadOnlyDepth,
-} from "@/types/proto-es/v1/workspace_service_pb";
+import type { MCPInfo } from "@/types/proto-es/v1/workspace_service_pb";
export type MCPMode =
| MCPSetting_Capability.DISABLED
| MCPSetting_Capability.READ_ONLY
| MCPSetting_Capability.READ_WRITE;
-/** The ceilings an admin picks between, least to most capable. */
+/**
+ * The ceilings an admin picks between, least to most capable. The bundle's copy
+ * of the serving table the gate evaluates (`mcpServingClasses`,
+ * backend/api/v1/mcp_gate.go).
+ */
export const MCP_CAPABILITY_CHOICES: readonly MCPMode[] = [
MCPSetting_Capability.DISABLED,
MCPSetting_Capability.READ_ONLY,
@@ -28,158 +22,28 @@ export const isMCPMode = (
): capability is MCPMode =>
MCP_CAPABILITY_CHOICES.some((choice) => choice === capability);
-/**
- * The methods a mode serves, by the same rule the gate evaluates: a method is
- * served when its class is one of the mode's served classes.
- */
-export const methodsServedBy = (
- mode: MCPCapabilityMode | undefined,
- methods: MCPMethod[]
-): MCPMethod[] => {
- if (!mode) {
- return [];
- }
- const served = new Set(mode.servedClasses);
- return methods.filter((method) => served.has(method.class));
-};
-
-/** The service a method belongs to: `/bytebase.v1.SQLService/Query` -> `SQLService`. */
-export const serviceOfMethod = (method: MCPMethod): string => {
- const parts = method.method.split("/");
- const service = parts.length > 1 ? parts[1] : method.method;
- const short = service.split(".").pop();
- return short || service;
-};
-
-export interface MethodGroup {
- service: string;
- methods: MCPMethod[];
-}
-
-/** Groups served methods by service, both the groups and their rows sorted. */
-export const groupMethodsByService = (methods: MCPMethod[]): MethodGroup[] => {
- const groups = new Map<string, MCPMethod[]>();
- for (const method of methods) {
- const service = serviceOfMethod(method);
- const existing = groups.get(service);
- if (existing) {
- existing.push(method);
- } else {
- groups.set(service, [method]);
- }
- }
- return [...groups.entries()]
- .map(([service, rows]) => ({
- service,
- methods: [...rows].sort((a, b) => a.method.localeCompare(b.method)),
- }))
- .sort((a, b) => a.service.localeCompare(b.service));
-};
-
-export interface EngineGroup<T> {
- value: T;
- engines: Engine[];
-}
-
-const groupEnginesBy = <T>(
- engines: MCPEngineEnforcement[],
- order: readonly T[],
- pick: (engine: MCPEngineEnforcement) => T
-): EngineGroup<T>[] => {
- const groups = new Map<T, Engine[]>();
- for (const enforcement of engines) {
- const value = pick(enforcement);
- const existing = groups.get(value);
- if (existing) {
- existing.push(enforcement.engine);
- } else {
- groups.set(value, [enforcement.engine]);
- }
- }
- // Rank rather than filter. The server answers with the depth or masking mode
- // it computed, which a bundle in an open tab across a backend upgrade may not
- // have been compiled against; filtering the known order would take that
- // engine off the page entirely rather than describe it imprecisely. Both
- // renderers already have a default arm for a value they cannot name.
- const rank = (value: T): number => {
- const at = order.indexOf(value);
- return at === -1 ? order.length : at;
- };
- return [...groups.keys()]
- .sort((a, b) => rank(a) - rank(b))
- .map((value) => ({ value, engines: groups.get(value) ?? [] }));
-};
-
-/**
- * Read-only depth groups, deepest first. Grouping rather than listing every
- * engine is the point: an admin choosing Read-only is asking which engines the
- * ceiling reaches all the way down, and thirty rows do not answer that.
- */
-export const READ_ONLY_DEPTH_ORDER = [
- MCPEngineEnforcement_ReadOnlyDepth.STATEMENT_AND_SESSION,
- MCPEngineEnforcement_ReadOnlyDepth.STATEMENT,
- MCPEngineEnforcement_ReadOnlyDepth.UNSUPPORTED,
- MCPEngineEnforcement_ReadOnlyDepth.READ_ONLY_DEPTH_UNSPECIFIED,
-] as const;
-
-export const groupEnginesByReadOnlyDepth = (
- engines: MCPEngineEnforcement[]
-): EngineGroup<MCPEngineEnforcement_ReadOnlyDepth>[] =>
- groupEnginesBy(engines, READ_ONLY_DEPTH_ORDER, (e) => e.readOnlyDepth);
-
-/**
- * Masking groups. Three states, never two: an engine Bytebase does not mask
- * and an engine whose masking never consults exemptions are different answers
- * to "does ignoring exemptions change anything here".
- */
-export const MASKING_ORDER = [
- MCPEngineEnforcement_Masking.COLUMN,
- MCPEngineEnforcement_Masking.DOCUMENT,
- MCPEngineEnforcement_Masking.NONE,
- MCPEngineEnforcement_Masking.MASKING_UNSPECIFIED,
-] as const;
-
-export const groupEnginesByMasking = (
- engines: MCPEngineEnforcement[]
-): EngineGroup<MCPEngineEnforcement_Masking>[] =>
- groupEnginesBy(engines, MASKING_ORDER, (e) => e.masking);
-
-/** The engines whose per-engine answer carries a note. */
-export const engineNotes = (
- engines: MCPEngineEnforcement[]
-): MCPEngineEnforcement[] => engines.filter((engine) => engine.note !== "");
-
-/** The mode row for one capability, or undefined when this build serves none. */
-export const modeFor = (
- info: MCPInfo | undefined,
- capability: MCPSetting_Capability
-): MCPCapabilityMode | undefined =>
- info?.modes.find((mode) => mode.capability === capability);
-
/**
* What the consent page can truthfully tell someone about to approve a client.
*
- * Only `mode` is a policy it can disclose. The other four are the ways it can
- * fail to hold one, kept apart because the remedy differs: retry, reload, or
- * ask an admin (BOT-106).
+ * Only `mode` is a policy it can disclose. The other two are the ways it can
+ * fail to hold one, kept apart because the remedy differs: retry, or reload and
+ * then find an admin (BOT-106).
*/
export type ConsentCeiling =
/** Carries the response, so the disclosure cannot be rendered without it. */
| { kind: "mode"; info: MCPInfo }
/** GetMCPInfo failed or timed out. The policy is not known to be anything. */
| { kind: "unknown" }
- /** No row in modes serves the stored value, CAPABILITY_UNSPECIFIED included. */
- | { kind: "unserved" }
- /** The server serves it and this bundle has no name for it. */
- | { kind: "outdated" };
+ /** A stored ceiling this build has no wording for, whatever wrote it. */
+ | { kind: "undisclosable" };
/**
* Reads a GetMCPInfo response — or its absence — into that state.
*
- * modes is the serving table the gate evaluates; MCP_CAPABILITY_CHOICES is the
- * set this bundle has copy for. A ceiling a newer release added is in the first
- * and not the second, which is the one case where reloading helps rather than
- * finding an admin.
+ * The check is local and total: a capability this bundle can name is one it has
+ * copy for. That covers a value nothing resolved (CAPABILITY_UNSPECIFIED), the
+ * reserved 2, and a tier a newer release wrote, without asking the server which
+ * of the three it is.
*/
export const readConsentCeiling = (
info: MCPInfo | undefined
@@ -187,14 +51,8 @@ export const readConsentCeiling = (
if (!info) {
return { kind: "unknown" };
}
- // Covers a value nothing could resolve as well as one that resolved to a
- // ceiling no mode serves: both arrive with no row in modes, and both leave an
- // admin the same job.
- if (!modeFor(info, info.capability)) {
- return { kind: "unserved" };
- }
if (!isMCPMode(info.capability)) {
- return { kind: "outdated" };
+ return { kind: "undisclosable" };
}
return { kind: "mode", info };
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index c18199bc28..ed7d1269a2 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1578,7 +1578,6 @@
},
"recovery-code": "Recovery code"
},
- "oauth": {},
"oauth2": {
"consent": {
"description": "{{clientName}} is requesting access to your account",
@@ -1607,29 +1606,22 @@
"workflow": "Open issues, plans and rollouts, and export query results",
"write": "Make the data and schema changes your permissions allow"
},
- "see-contents": "See what this workspace's policy allows",
"title": "This session may",
"undisclosed": {
"line": {
"nothing-approved": "Nothing has been approved and nothing is connected"
},
- "outdated": {
- "description": "This workspace's MCP policy is newer than the page you have open, so what a session may do cannot be shown here.",
- "line": "Reload to get the current policy before you approve anything",
- "retry": "Reload",
- "title": "This page is older than this workspace's MCP policy"
- },
"policy-label": "Workspace policy",
+ "undisclosable": {
+ "description": "This workspace's MCP policy is a value this page has no wording for. Either it is newer than the page you have open, or it is not a policy this Bytebase version serves, in which case every MCP connection is being refused.",
+ "line": "Reload to pick up the current version. If this page comes back, ask a workspace admin to set a supported policy",
+ "title": "This page cannot show what this workspace's MCP policy allows"
+ },
"unknown": {
"description": "Bytebase could not read this workspace's MCP access policy just now.",
"line": "What this session would be allowed to do cannot be shown",
"retry": "Check again",
"title": "The MCP policy could not be checked"
- },
- "unserved": {
- "description": "This workspace stores a policy value this Bytebase version does not serve. Every MCP connection is being refused.",
- "line": "No AI session can connect until an admin picks a supported policy",
- "title": "This workspace's MCP policy is not one this version serves"
}
},
"write-caution": "An AI session with write access makes real changes. Approve only on a machine you control."
@@ -2121,7 +2113,6 @@
"create-project": "Create project",
"new-project": "New Project"
},
- "refresh-remind": {},
"release": {
"and-n-more-files": "and {{count}} more files",
"change-tip": "This change is linked to a release artifact.",
@@ -2620,38 +2611,6 @@
"json-note": "This is the mcpServers shape. Client config formats differ: VS Code, for example, expects servers in its own mcp.json, so use the VS Code tab for that.",
"title": "Connect a client"
},
- "contents": {
- "depth": {
- "description": "How far the read-only ceiling is enforced on each engine.",
- "not-a-proof": "Neither depth is a proof. A statement that classifies as a read can still call a function that turns the session setting back off.",
- "statement": "Every statement is classified before it runs. The driver does not open a read-only database session.",
- "statement-and-session": "Every statement is classified, and the driver opens the database session read-only.",
- "title": "Read-only depth by engine",
- "unspecified": "Not reported by this build.",
- "unsupported": "No read-only classifier, so every statement is refused, including a plain SELECT."
- },
- "masking": {
- "column": "Column masking. Exemptions decide who sees the real value, so ignoring them changes what a session reads.",
- "description-off": "This workspace applies each user's masking exemptions to MCP sessions. Ignoring them would reach only the engines below that consult exemptions.",
- "description-on": "This workspace ignores masking exemptions, so what a session reads depends on how Bytebase masks each engine.",
- "document": "Document masking. Exemptions are never consulted here, so ignoring them changes nothing.",
- "none": "Bytebase does not mask on this engine. Ignoring exemptions changes nothing.",
- "title": "Masking by engine",
- "unspecified": "Not reported by this build."
- },
- "methods": {
- "count": "{{served}} of {{total}} methods MCP can reach. Being listed is not permission: the connecting user still needs their own.",
- "handler": "No declared IAM permission",
- "none": "This mode serves no API method.",
- "write-legend": "The {{count}} highlighted are what this mode adds over Read-only."
- },
- "notes": {
- "redshift": "Outside a datashare database the driver also opens the session read-only. A datashare database cannot run a read-only transaction, so there it is statement classification alone.",
- "title": "Where the answer above is the floor",
- "unavailable": "This engine has a caveat this page cannot show yet. Reload to pick up the current version."
- },
- "title": "{{mode}} — what this mode serves"
- },
"description": "Connect AI assistants to Bytebase using the Model Context Protocol.",
"first-prompt": {
"description": "Once connected, try asking your AI assistant:",
@@ -2672,7 +2631,6 @@
"unavailable": "Data masking is not licensed for this workspace, so nothing is masked whatever this is set to."
},
"mode": {
- "contents": "See what {{mode}} serves",
"disabled": {
"best-for": "Best for: keeping MCP off until you are ready to turn it on.",
"description": "No MCP session can connect to this workspace.",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 1866737541..21e9bbf4ab 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1578,7 +1578,6 @@
},
"recovery-code": "Código de recuperación"
},
- "oauth": {},
"oauth2": {
"consent": {
"description": "{{clientName}} está solicitando acceso a tu cuenta",
@@ -1607,29 +1606,22 @@
"workflow": "Abrir incidencias, planes y despliegues, y exportar resultados de consultas",
"write": "Hacer los cambios de datos y esquema que permitan sus permisos"
},
- "see-contents": "Ver lo que permite la política de este espacio de trabajo",
"title": "Esta sesión puede",
"undisclosed": {
"line": {
"nothing-approved": "No se ha aprobado nada y no hay nada conectado"
},
- "outdated": {
- "description": "La política MCP de este espacio de trabajo es más reciente que la página que tiene abierta, así que aquí no se puede mostrar lo que una sesión puede hacer.",
- "line": "Recargue para obtener la política actual antes de aprobar nada",
- "retry": "Recargar",
- "title": "Esta página es más antigua que la política MCP de este espacio de trabajo"
- },
"policy-label": "Política del espacio de trabajo",
+ "undisclosable": {
+ "description": "La política MCP de este espacio de trabajo es un valor que esta página no sabe describir. O es más reciente que la página que tiene abierta, o no es una política que sirva esta versión de Bytebase, en cuyo caso se rechazan todas las conexiones MCP.",
+ "line": "Vuelva a cargar para obtener la versión actual. Si esta página reaparece, pida a un administrador del espacio de trabajo que establezca una política compatible",
+ "title": "Esta página no puede mostrar lo que permite la política MCP de este espacio de trabajo"
+ },
"unknown": {
"description": "Bytebase no ha podido leer la política de acceso MCP de este espacio de trabajo en este momento.",
"line": "No se puede mostrar lo que esta sesión tendría permitido hacer",
"retry": "Comprobar de nuevo",
"title": "No se pudo comprobar la política MCP"
- },
- "unserved": {
- "description": "Este espacio de trabajo almacena un valor de política que esta versión de Bytebase no sirve. Se está rechazando toda conexión MCP.",
- "line": "Ninguna sesión de IA puede conectarse hasta que un administrador elija una política admitida",
- "title": "La política MCP de este espacio de trabajo no es una que sirva esta versión"
}
},
"write-caution": "Una sesión de IA con acceso de escritura hace cambios reales. Apruébela solo en una máquina que usted controle."
@@ -2121,7 +2113,6 @@
"create-project": "Crear proyecto",
"new-project": "Nuevo Proyecto"
},
- "refresh-remind": {},
"release": {
"and-n-more-files": "y {{count}} archivos más",
"change-tip": "Este cambio está vinculado a un artefacto de versión.",
@@ -2620,38 +2611,6 @@
"json-note": "Este es el formato mcpServers. Los formatos de configuración varían según el cliente: VS Code, por ejemplo, espera servers en su propio mcp.json, así que use la pestaña de VS Code para eso.",
"title": "Conectar un cliente"
},
- "contents": {
- "depth": {
- "description": "Hasta dónde se aplica el techo de solo lectura en cada motor.",
- "not-a-proof": "Ninguna de las dos profundidades es una prueba. Una sentencia clasificada como lectura todavía puede llamar a una función que vuelva a desactivar el ajuste de sesión.",
- "statement": "Cada sentencia se clasifica antes de ejecutarse. El controlador no abre la sesión de base de datos en solo lectura.",
- "statement-and-session": "Cada sentencia se clasifica y el controlador abre la sesión de base de datos en solo lectura.",
- "title": "Profundidad de solo lectura por motor",
- "unspecified": "Esta versión no lo informa.",
- "unsupported": "No hay clasificador de solo lectura, así que se rechaza cada sentencia, incluido un SELECT simple."
- },
- "masking": {
- "column": "Enmascaramiento de columnas. Las exenciones deciden quién ve el valor real, así que ignorarlas cambia lo que lee una sesión.",
- "description-off": "Este espacio de trabajo aplica las exenciones de enmascaramiento de cada usuario a las sesiones MCP. Ignorarlas solo alcanzaría a los motores de abajo que consultan exenciones.",
- "description-on": "Este espacio de trabajo ignora las exenciones de enmascaramiento, así que lo que lee una sesión depende de cómo enmascara Bytebase cada motor.",
- "document": "Enmascaramiento de documentos. Aquí nunca se consultan las exenciones, así que ignorarlas no cambia nada.",
- "none": "Bytebase no enmascara en este motor. Ignorar las exenciones no cambia nada.",
- "title": "Enmascaramiento por motor",
- "unspecified": "Esta versión no lo informa."
- },
- "methods": {
- "count": "{{served}} de {{total}} métodos que MCP puede alcanzar. Estar en la lista no es un permiso: el usuario que se conecta sigue necesitando el suyo.",
- "handler": "Sin permiso de IAM declarado",
- "none": "Este modo no ofrece ningún método de la API.",
- "write-legend": "Los {{count}} resaltados son lo que este modo añade sobre Solo lectura."
- },
- "notes": {
- "redshift": "Fuera de una base de datos datashare, el controlador también abre la sesión en solo lectura. Una base de datos datashare no puede ejecutar una transacción de solo lectura, así que allí solo hay clasificación de sentencias.",
- "title": "Dónde la respuesta de arriba es el mínimo",
- "unavailable": "Este motor tiene una salvedad que esta página aún no puede mostrar. Recargue para obtener la versión actual."
- },
- "title": "{{mode}}: qué ofrece este modo"
- },
"description": "Conecte asistentes de IA a Bytebase usando el Model Context Protocol.",
"first-prompt": {
"description": "Una vez conectado, intente preguntar a su asistente de IA:",
@@ -2672,7 +2631,6 @@
"unavailable": "El enmascaramiento de datos no está licenciado para este espacio de trabajo, así que no se enmascara nada sea cual sea este ajuste."
},
"mode": {
- "contents": "Ver qué ofrece {{mode}}",
"disabled": {
"best-for": "Ideal para: mantener MCP apagado hasta que esté listo para activarlo.",
"description": "Ninguna sesión MCP puede conectarse a este espacio de trabajo.",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 2eb6a2aaac..da5cdd294f 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1578,7 +1578,6 @@
},
"recovery-code": "リカバリーコード"
},
- "oauth": {},
"oauth2": {
"consent": {
"description": "{{clientName}} があなたのアカウントへのアクセスを要求しています",
@@ -1607,29 +1606,22 @@
"workflow": "イシュー・プラン・ロールアウトの作成、およびクエリ結果のエクスポート",
"write": "あなたの権限の範囲でデータとスキーマを変更する"
},
- "see-contents": "このワークスペースのポリシーが許可する範囲を見る",
"title": "このセッションでできること",
"undisclosed": {
"line": {
"nothing-approved": "何も承認されておらず、何も接続されていません"
},
- "outdated": {
- "description": "このワークスペースの MCP ポリシーは、開いているページより新しいため、セッションに何が許可されるかをここでは表示できません。",
- "line": "承認する前に再読み込みして最新のポリシーを取得してください",
- "retry": "再読み込み",
- "title": "このページはこのワークスペースの MCP ポリシーより古い状態です"
- },
"policy-label": "ワークスペースポリシー",
+ "undisclosable": {
+ "description": "このワークスペースの MCP ポリシーは、このページが説明できない値です。開いているページより新しいか、この Bytebase バージョンが提供するポリシーではないかのいずれかです。後者の場合、MCP 接続はすべて拒否されます。",
+ "line": "再読み込みして現在のバージョンを取得してください。それでもこのページが表示される場合は、ワークスペース管理者にサポートされているポリシーの設定を依頼してください",
+ "title": "このページはこのワークスペースの MCP ポリシーが許可する内容を表示できません"
+ },
"unknown": {
"description": "Bytebase は現在、このワークスペースの MCP アクセスポリシーを読み取れませんでした。",
"line": "このセッションに何が許可されるかを表示できません",
"retry": "再確認",
"title": "MCP ポリシーを確認できませんでした"
- },
- "unserved": {
- "description": "このワークスペースには、この Bytebase バージョンが提供しないポリシー値が保存されています。すべての MCP 接続が拒否されています。",
- "line": "管理者がサポートされたポリシーを選ぶまで、どの AI セッションも接続できません",
- "title": "このワークスペースの MCP ポリシーはこのバージョンが提供するものではありません"
}
},
"write-caution": "書き込み権限のある AI セッションは実際に変更を加えます。自分が管理しているマシンでのみ承認してください。"
@@ -2121,7 +2113,6 @@
"create-project": "プロジェクトを作成",
"new-project": "作成するプロジェクト"
},
- "refresh-remind": {},
"release": {
"and-n-more-files": "他 {{count}} 件のファイル",
"change-tip": "この変更はリリースアーティファクトにリンクされています。",
@@ -2620,38 +2611,6 @@
"json-note": "これは mcpServers 形式です。クライアントごとに設定形式が異なります。たとえば VS Code は独自の mcp.json で servers を使うため、その場合は VS Code タブを使ってください。",
"title": "クライアントを接続"
},
- "contents": {
- "depth": {
- "description": "読み取り専用の上限が各エンジンでどこまで適用されるか。",
- "not-a-proof": "どちらの深さも証明ではありません。読み取りと分類されたステートメントが、セッション設定を元に戻す関数を呼ぶことはあり得ます。",
- "statement": "実行前にすべてのステートメントが分類されます。ドライバーはデータベースセッションを読み取り専用では開きません。",
- "statement-and-session": "すべてのステートメントが分類され、ドライバーがデータベースセッションを読み取り専用で開きます。",
- "title": "エンジン別の読み取り専用の深さ",
- "unspecified": "このビルドでは報告されません。",
- "unsupported": "読み取り専用の分類器がないため、単純な SELECT も含めてすべてのステートメントが拒否されます。"
- },
- "masking": {
- "column": "列マスキング。誰が実際の値を見られるかを適用除外が決めるため、無視するとセッションが読める内容が変わります。",
- "description-off": "このワークスペースは MCP セッションにも各ユーザーのマスキング適用除外を適用します。無視した場合に影響するのは、下記のうち適用除外を参照するエンジンだけです。",
- "description-on": "このワークスペースはマスキングの適用除外を無視するため、セッションが何を読めるかは Bytebase が各エンジンをどうマスクするかで決まります。",
- "document": "ドキュメントマスキング。この経路では適用除外を参照しないため、無視しても何も変わりません。",
- "none": "Bytebase はこのエンジンではマスクしません。適用除外を無視しても何も変わりません。",
- "title": "エンジン別のマスキング",
- "unspecified": "このビルドでは報告されません。"
- },
- "methods": {
- "count": "MCP が到達できる {{total}} 件のメソッドのうち {{served}} 件。掲載は権限ではありません。接続ユーザー自身の権限が別途必要です。",
- "handler": "宣言された IAM 権限なし",
- "none": "このモードが提供する API メソッドはありません。",
- "write-legend": "強調されている {{count}} 件が、読み取り専用に対してこのモードが追加する分です。"
- },
- "notes": {
- "redshift": "datashare データベース以外では、ドライバーがセッションも読み取り専用で開きます。datashare データベースは読み取り専用トランザクションを実行できないため、そこではステートメント分類のみになります。",
- "title": "上記の答えが下限にとどまる場合",
- "unavailable": "このエンジンには、このページがまだ表示できない注意事項があります。再読み込みして最新バージョンを取得してください。"
- },
- "title": "{{mode}} — このモードが提供する内容"
- },
"description": "Model Context Protocol を使用して、AI アシスタントを Bytebase に接続します。",
"first-prompt": {
"description": "接続後、AI アシスタントに聞いてみてください:",
@@ -2672,7 +2631,6 @@
"unavailable": "このワークスペースではデータマスキングのライセンスがないため、この設定にかかわらず何もマスクされません。"
},
"mode": {
- "contents": "{{mode}} が提供する内容を見る",
"disabled": {
"best-for": "適する場面:有効にする準備が整うまで MCP をオフにしておきたいとき。",
"description": "このワークスペースにはどの MCP セッションも接続できません。",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 95b4b98529..035879919d 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1578,7 +1578,6 @@
},
"recovery-code": "Mã khôi phục"
},
- "oauth": {},
"oauth2": {
"consent": {
"description": "{{clientName}} đang yêu cầu truy cập vào tài khoản của bạn",
@@ -1607,29 +1606,22 @@
"workflow": "Tạo vấn đề, kế hoạch và triển khai, và xuất kết quả truy vấn",
"write": "Thay đổi dữ liệu và lược đồ trong phạm vi quyền của bạn"
},
- "see-contents": "Xem những gì chính sách của không gian làm việc này cho phép",
"title": "Phiên này có thể",
"undisclosed": {
"line": {
"nothing-approved": "Chưa có gì được phê duyệt và chưa có gì được kết nối"
},
- "outdated": {
- "description": "Chính sách MCP của không gian làm việc này mới hơn trang bạn đang mở, nên không thể hiển thị ở đây những gì một phiên được phép làm.",
- "line": "Hãy tải lại để lấy chính sách hiện tại trước khi phê duyệt bất kỳ điều gì",
- "retry": "Tải lại",
- "title": "Trang này cũ hơn chính sách MCP của không gian làm việc"
- },
"policy-label": "Chính sách không gian làm việc",
+ "undisclosable": {
+ "description": "Chính sách MCP của không gian làm việc này là một giá trị mà trang này không có cách diễn đạt. Nó hoặc mới hơn trang bạn đang mở, hoặc không phải là chính sách mà phiên bản Bytebase này phục vụ, trong trường hợp đó mọi kết nối MCP đều bị từ chối.",
+ "line": "Hãy tải lại để lấy phiên bản hiện tại. Nếu trang này xuất hiện lại, hãy nhờ quản trị viên không gian làm việc đặt một chính sách được hỗ trợ",
+ "title": "Trang này không thể hiển thị những gì chính sách MCP của không gian làm việc này cho phép"
+ },
"unknown": {
"description": "Bytebase hiện chưa đọc được chính sách truy cập MCP của không gian làm việc này.",
"line": "Không thể hiển thị những gì phiên này sẽ được phép làm",
"retry": "Kiểm tra lại",
"title": "Không kiểm tra được chính sách MCP"
- },
- "unserved": {
- "description": "Không gian làm việc này lưu một giá trị chính sách mà phiên bản Bytebase này không phục vụ. Mọi kết nối MCP đang bị từ chối.",
- "line": "Không phiên AI nào kết nối được cho tới khi quản trị viên chọn một chính sách được hỗ trợ",
- "title": "Chính sách MCP của không gian làm việc này không được phiên bản này phục vụ"
}
},
"write-caution": "Phiên AI có quyền ghi sẽ tạo ra thay đổi thật. Chỉ phê duyệt trên máy bạn kiểm soát."
@@ -2121,7 +2113,6 @@
"create-project": "Tạo dự án",
"new-project": "Mới Dự án"
},
- "refresh-remind": {},
"release": {
"and-n-more-files": "và {{count}} tệp khác",
"change-tip": "Thay đổi này được liên kết với một artifact phát hành.",
@@ -2620,38 +2611,6 @@
"json-note": "Đây là định dạng mcpServers. Mỗi client có định dạng cấu hình khác nhau: ví dụ VS Code dùng servers trong mcp.json của nó, nên hãy dùng tab VS Code cho trường hợp đó.",
"title": "Kết nối một client"
},
- "contents": {
- "depth": {
- "description": "Mức trần chỉ đọc được thực thi sâu tới đâu trên mỗi công cụ.",
- "not-a-proof": "Không mức nào trong hai mức là một bằng chứng. Một câu lệnh được phân loại là đọc vẫn có thể gọi một hàm tắt lại thiết lập phiên.",
- "statement": "Mọi câu lệnh đều được phân loại trước khi chạy. Trình điều khiển không mở phiên cơ sở dữ liệu ở chế độ chỉ đọc.",
- "statement-and-session": "Mọi câu lệnh đều được phân loại, và trình điều khiển mở phiên cơ sở dữ liệu ở chế độ chỉ đọc.",
- "title": "Mức độ chỉ đọc theo công cụ",
- "unspecified": "Bản dựng này không báo cáo.",
- "unsupported": "Không có bộ phân loại chỉ đọc, nên mọi câu lệnh đều bị từ chối, kể cả một câu SELECT đơn giản."
- },
- "masking": {
- "column": "Che theo cột. Miễn trừ quyết định ai thấy giá trị thật, nên bỏ qua chúng sẽ thay đổi những gì một phiên đọc được.",
- "description-off": "Không gian làm việc này vẫn áp dụng miễn trừ che dữ liệu của từng người dùng cho phiên MCP. Bỏ qua chúng chỉ ảnh hưởng tới các công cụ bên dưới có tra cứu miễn trừ.",
- "description-on": "Không gian làm việc này bỏ qua miễn trừ che dữ liệu, nên một phiên đọc được gì tuỳ thuộc vào cách Bytebase che trên từng công cụ.",
- "document": "Che theo tài liệu. Đường đi này không bao giờ tra cứu miễn trừ, nên bỏ qua chúng không thay đổi gì.",
- "none": "Bytebase không che trên công cụ này. Bỏ qua miễn trừ không thay đổi gì.",
- "title": "Che dữ liệu theo công cụ",
- "unspecified": "Bản dựng này không báo cáo."
- },
- "methods": {
- "count": "{{served}} trong {{total}} phương thức MCP có thể gọi. Có tên trong danh sách không phải là quyền: người dùng kết nối vẫn cần quyền của chính họ.",
- "handler": "Không khai báo quyền IAM",
- "none": "Chế độ này không phục vụ phương thức API nào.",
- "write-legend": "{{count}} mục được làm nổi bật là phần chế độ này thêm so với Chỉ đọc."
- },
- "notes": {
- "redshift": "Ngoài cơ sở dữ liệu datashare, trình điều khiển còn mở phiên ở chế độ chỉ đọc. Cơ sở dữ liệu datashare không chạy được giao dịch chỉ đọc, nên ở đó chỉ có phân loại câu lệnh.",
- "title": "Nơi câu trả lời ở trên chỉ là mức sàn",
- "unavailable": "Công cụ này có một lưu ý mà trang này chưa hiển thị được. Hãy tải lại để lấy phiên bản hiện tại."
- },
- "title": "{{mode}} — chế độ này phục vụ những gì"
- },
"description": "Kết nối trợ lý AI với Bytebase bằng Model Context Protocol.",
"first-prompt": {
"description": "Sau khi kết nối, hãy thử hỏi trợ lý AI của bạn:",
@@ -2672,7 +2631,6 @@
"unavailable": "Không gian làm việc này chưa có giấy phép che dữ liệu, nên sẽ không có gì bị che dù thiết lập này ra sao."
},
"mode": {
- "contents": "Xem {{mode}} phục vụ những gì",
"disabled": {
"best-for": "Phù hợp khi: giữ MCP tắt cho tới khi bạn sẵn sàng bật.",
"description": "Không phiên MCP nào có thể kết nối tới không gian làm việc này.",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index a8e10f8558..5ebd1dd46f 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1578,7 +1578,6 @@
},
"recovery-code": "恢复码"
},
- "oauth": {},
"oauth2": {
"consent": {
"description": "{{clientName}} 正在请求访问您的账户",
@@ -1607,29 +1606,22 @@
"workflow": "创建工单、计划和发布,以及导出查询结果",
"write": "在你的权限范围内修改数据和模式"
},
- "see-contents": "查看此工作区策略允许的范围",
"title": "此会话可以",
"undisclosed": {
"line": {
"nothing-approved": "尚未批准任何内容,也未建立任何连接"
},
- "outdated": {
- "description": "本工作空间的 MCP 策略比您打开的页面更新,因此这里无法显示会话被允许执行的操作。",
- "line": "请先重新加载获取当前策略,再批准任何内容",
- "retry": "重新加载",
- "title": "此页面比本工作空间的 MCP 策略更旧"
- },
"policy-label": "工作空间策略",
+ "undisclosable": {
+ "description": "本工作空间的 MCP 策略是此页面无法表述的值。它可能比您打开的页面更新,也可能不是此 Bytebase 版本支持的策略,若是后者,所有 MCP 连接都会被拒绝。",
+ "line": "请重新加载以获取当前版本。如果此页面再次出现,请让工作空间管理员设置受支持的策略",
+ "title": "此页面无法显示本工作空间的 MCP 策略允许的内容"
+ },
"unknown": {
"description": "Bytebase 目前无法读取本工作空间的 MCP 访问策略。",
"line": "无法显示本次会话将被允许执行的操作",
"retry": "重新检查",
"title": "无法确认 MCP 策略"
- },
- "unserved": {
- "description": "本工作空间存储了此 Bytebase 版本不支持的策略值。所有 MCP 连接都在被拒绝。",
- "line": "在管理员选择受支持的策略之前,任何 AI 会话都无法连接",
- "title": "本工作空间的 MCP 策略不是此版本所支持的"
}
},
"write-caution": "具有写权限的 AI 会话会造成真实变更。请仅在你可控的机器上批准。"
@@ -2121,7 +2113,6 @@
"create-project": "创建项目",
"new-project": "创建项目"
},
- "refresh-remind": {},
"release": {
"and-n-more-files": "以及另外 {{count}} 个文件",
"change-tip": "该变更关联到了一个发布包。",
@@ -2620,38 +2611,6 @@
"json-note": "这是 mcpServers 格式。各客户端的配置格式并不相同:例如 VS Code 在自己的 mcp.json 中使用 servers,此时请改用 VS Code 标签页。",
"title": "连接客户端"
},
- "contents": {
- "depth": {
- "description": "只读上限在每个引擎上的执行强度。",
- "not-a-proof": "两种强度都不是证明。被判定为读取的语句仍可能调用某个函数,把会话设置改回去。",
- "statement": "每条语句在执行前都会被分类。驱动不会以只读方式打开数据库会话。",
- "statement-and-session": "每条语句都会被分类,并且驱动会以只读方式打开数据库会话。",
- "title": "各引擎的只读强度",
- "unspecified": "当前版本未报告。",
- "unsupported": "没有只读分类器,因此每条语句都会被拒绝,包括普通的 SELECT。"
- },
- "masking": {
- "column": "列级脱敏。豁免决定谁能看到真实值,因此忽略豁免会改变会话读到的内容。",
- "description-off": "本工作空间在 MCP 会话中仍应用每位用户的脱敏豁免。忽略这些豁免只会影响下列会查询豁免的引擎。",
- "description-on": "本工作空间忽略脱敏豁免,因此会话能读到什么,取决于 Bytebase 在各引擎上的脱敏方式。",
- "document": "文档级脱敏。此路径从不查询豁免,因此忽略豁免不产生任何变化。",
- "none": "Bytebase 在该引擎上不做脱敏。忽略豁免不产生任何变化。",
- "title": "各引擎的脱敏方式",
- "unspecified": "当前版本未报告。"
- },
- "methods": {
- "count": "MCP 可访问的 {{total}} 个方法中的 {{served}} 个。列出并不等于授权:连接用户仍需具备自身权限。",
- "handler": "未声明 IAM 权限",
- "none": "该模式不提供任何 API 方法。",
- "write-legend": "其中高亮的 {{count}} 个是该模式相较只读新增的部分。"
- },
- "notes": {
- "redshift": "在非 datashare 数据库中,驱动还会以只读方式打开会话。datashare 数据库无法运行只读事务,因此在那里仅有语句分类。",
- "title": "上述答案只是下限的情况",
- "unavailable": "此引擎有一条本页面尚无法显示的注意事项。请重新加载以获取当前版本。"
- },
- "title": "{{mode}} — 该模式提供的内容"
- },
"description": "使用模型上下文协议将 AI 助手连接到 Bytebase。",
"first-prompt": {
"description": "连接后,尝试向 AI 助手提问:",
@@ -2672,7 +2631,6 @@
"unavailable": "本工作空间未授权数据脱敏功能,因此无论此项如何设置都不会脱敏。"
},
"mode": {
- "contents": "查看 {{mode}} 提供的内容",
"disabled": {
"best-for": "适用于:在准备好开启之前先关闭 MCP。",
"description": "任何 MCP 会话都无法连接到本工作空间。",
diff --git a/frontend/src/routes/auth/MCPConsentCeiling.tsx b/frontend/src/routes/auth/MCPConsentCeiling.tsx
index d3db149fcf..3bffad951e 100644
--- a/frontend/src/routes/auth/MCPConsentCeiling.tsx
+++ b/frontend/src/routes/auth/MCPConsentCeiling.tsx
@@ -1,11 +1,8 @@
import { Check, EyeOff, ScrollText, X } from "lucide-react";
import type { ReactNode } from "react";
-import { useState } from "react";
import { useTranslation } from "react-i18next";
-import { MCPModeContentsSheet } from "@/components/mcp/MCPModeContentsSheet";
import { Alert } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
import { MCPSetting_Capability } from "@/types/proto-es/v1/setting_service_pb";
import type { MCPInfo } from "@/types/proto-es/v1/workspace_service_pb";
@@ -29,7 +26,6 @@ interface Props {
*/
export function MCPConsentCeiling({ info }: Props) {
const { t } = useTranslation();
- const [contentsOpen, setContentsOpen] = useState(false);
const readWrite = info.capability === MCPSetting_Capability.READ_WRITE;
const modeKey = readWrite ? "read-write" : "read-only";
@@ -106,14 +102,6 @@ export function MCPConsentCeiling({ info }: Props) {
</li>
))}
</ul>
- <Button
- appearance="link"
- size="sm"
- className="self-start px-0"
- onClick={() => setContentsOpen(true)}
- >
- {t("oauth2.consent.mcp.see-contents")}
- </Button>
</div>
{readWrite && (
@@ -122,16 +110,6 @@ export function MCPConsentCeiling({ info }: Props) {
description={t("oauth2.consent.mcp.write-caution")}
/>
)}
-
- <MCPModeContentsSheet
- open={contentsOpen}
- capability={info.capability}
- info={info}
- modeLabel={modeLabel}
- // No draft here: this page describes the policy in force.
- ignoreMaskingExemptions={info.ignoreMaskingExemptions}
- onClose={() => setContentsOpen(false)}
- />
</div>
);
}
diff --git a/frontend/src/routes/auth/MCPConsentUndisclosed.tsx b/frontend/src/routes/auth/MCPConsentUndisclosed.tsx
index ea525a404e..caf353656d 100644
--- a/frontend/src/routes/auth/MCPConsentUndisclosed.tsx
+++ b/frontend/src/routes/auth/MCPConsentUndisclosed.tsx
@@ -5,13 +5,13 @@ import { Alert } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
/** Why this page cannot say what approving would grant. */
-export type UndisclosedReason = "unknown" | "unserved" | "outdated";
+export type UndisclosedReason = "unknown" | "undisclosable";
interface Props {
readonly reason: UndisclosedReason;
/** The workspace row, so a SaaS user can switch to one that permits MCP. */
readonly workspaceCard: ReactNode;
- /** Omitted for the two reasons an admin has to fix. See retryFor. */
+ /** Omitted where re-reading returns the same answer. See retryFor. */
readonly onRetry?: () => void;
readonly retrying: boolean;
readonly onDismiss: () => void;
@@ -25,9 +25,9 @@ interface Props {
* decides what one is worth, so with no ceiling to disclose there is no Allow:
* the disclosure is the consent (BOT-106).
*
- * The button has to go rather than be left to fail. Only two of these four
- * states also refuse the POST (backend/api/oauth2/consent_audit.go); a failed
- * read here says nothing about the read the POST makes for itself.
+ * The button has to go rather than be left to fail. Of the two states, only
+ * undisclosable also refuses the POST (backend/api/oauth2/consent_audit.go); a
+ * failed read here says nothing about the read the POST makes for itself.
*/
export function MCPConsentUndisclosed({
reason,
diff --git a/frontend/src/routes/auth/OAuth2ConsentPage.test.tsx b/frontend/src/routes/auth/OAuth2ConsentPage.test.tsx
index f8cb84219d..0e95d71648 100644
--- a/frontend/src/routes/auth/OAuth2ConsentPage.test.tsx
+++ b/frontend/src/routes/auth/OAuth2ConsentPage.test.tsx
@@ -159,15 +159,6 @@ const renderIntoContainer = (element: ReactElement) => {
};
};
-// Every real GetMCPInfo response carries one row per ceiling the gate serves.
-// The page reads that table to tell a policy it can disclose from one the
-// server refuses, so a fixture without it is not a response the server sends.
-const SERVED_MODES = [
- { capability: 1 },
- { capability: 3 },
- { capability: 4 },
-];
-
const flushPromises = () =>
act(async () => {
await Promise.resolve();
@@ -196,9 +187,6 @@ beforeEach(async () => {
capability: 3,
ignoreMaskingExemptions: false,
dataMaskingAvailable: true,
- modes: SERVED_MODES,
- methods: [],
- engines: [],
});
({ OAuth2ConsentPage } = await import("./OAuth2ConsentPage"));
});
@@ -533,7 +521,7 @@ describe("OAuth2ConsentPage", () => {
ok: true,
json: async () => ({ client_name: "Acme" }),
});
- mocks.getMCPInfo.mockResolvedValue({ modes: SERVED_MODES, ...info });
+ mocks.getMCPInfo.mockResolvedValue(info);
const handle = renderIntoContainer(<OAuth2ConsentPage />);
handle.render();
await flushPromises();
@@ -565,8 +553,6 @@ describe("OAuth2ConsentPage", () => {
const { container, unmount } = await renderWithCeiling({
capability: 3,
ignoreMaskingExemptions: false,
- methods: [],
- engines: [],
});
expect(container.textContent).toContain("oauth2.consent.mcp.line.read");
expect(container.textContent).toContain("oauth2.consent.mcp.line.no-write");
@@ -584,8 +570,6 @@ describe("OAuth2ConsentPage", () => {
capability: 4,
ignoreMaskingExemptions: true,
dataMaskingAvailable: true,
- methods: [],
- engines: [],
});
expect(container.textContent).toContain("oauth2.consent.mcp.line.write");
expect(container.textContent).toContain("oauth2.consent.mcp.write-caution");
@@ -602,8 +586,6 @@ describe("OAuth2ConsentPage", () => {
capability: 4,
ignoreMaskingExemptions: true,
dataMaskingAvailable: false,
- methods: [],
- engines: [],
});
// The rest of the card is unchanged, so this is the line and not the card.
expect(container.textContent).toContain("oauth2.consent.mcp.line.write");
@@ -622,8 +604,6 @@ describe("OAuth2ConsentPage", () => {
capability: 1,
ignoreMaskingExemptions: false,
dataMaskingAvailable: true,
- methods: [],
- engines: [],
});
const submitted: HTMLFormElement[] = [];
@@ -654,8 +634,6 @@ describe("OAuth2ConsentPage", () => {
capability: 1,
ignoreMaskingExemptions: false,
dataMaskingAvailable: true,
- methods: [],
- engines: [],
});
expect(container.textContent).toContain("oauth2.consent.workspace-label");
unmount();
@@ -665,8 +643,6 @@ describe("OAuth2ConsentPage", () => {
const { container, unmount } = await renderWithCeiling({
capability: 1,
ignoreMaskingExemptions: false,
- methods: [],
- engines: [],
});
expect(container.textContent).toContain("oauth2.consent.mcp.disabled.title");
expect(container.textContent).toContain(
@@ -680,10 +656,11 @@ describe("OAuth2ConsentPage", () => {
// BOT-106, and the reason this is a blocker rather than a tidy-up. The page
// used to fall through to a generic "access your account" card with Allow
- // live whenever GetMCPInfo failed for ANY reason. The two broken-ceiling
- // cases were cosmetic — the POST refuses those anyway — but a transient
- // failure is not: the POST reads the ceiling for itself, succeeds, and issues
- // a grant against a card that never named the ceiling it was granting.
+ // live whenever GetMCPInfo failed for ANY reason. The POST refuses a stored
+ // value nothing resolves, so that half was cosmetic; it refuses neither a
+ // transient failure nor a tier this bundle is merely too old to name. In both
+ // of those the POST reads the ceiling for itself, succeeds, and issues a grant
+ // against a card that never named the ceiling it was granting.
//
// A timeout arrives here the same way: the client throws, and the page cannot
// tell a deadline from a refusal, which is the whole point of failing closed.
@@ -723,75 +700,46 @@ describe("OAuth2ConsentPage", () => {
unmount();
});
- test("a ceiling no mode serves says so and offers no grant", async () => {
+ // The guarantee, at the page: Allow reaches the screen only under a ceiling
+ // this build can name. Every value it cannot name is one case — the reserved
+ // 2, a tier a newer release wrote, and a row that resolved to nothing all
+ // leave the page with nothing to disclose, whichever of them it is.
+ //
+ // The Allow assertion leads deliberately. Behind a title assertion it never
+ // runs, so a regression would report a copy mismatch rather than a grant
+ // offered without a disclosure.
+ test.each([
+ ["the reserved tier", 2],
+ ["a tier a newer release wrote", 5],
+ ["a value nothing could resolve", 0],
+ ])("%s offers no grant and no retry", async (_name, capability) => {
const { container, unmount } = await renderWithCeiling({
- // The reserved 2, or a ceiling a newer release wrote. It parses, so only
- // its absence from the serving table catches it.
- capability: 2,
+ capability,
ignoreMaskingExemptions: false,
dataMaskingAvailable: true,
- methods: [],
- engines: [],
});
- expect(container.textContent).toContain(
- "oauth2.consent.mcp.undisclosed.unserved.title"
- );
expect(container.textContent).not.toContain("common.allow");
- // The other state only an admin can fix, held to the same rule.
- expect(container.textContent).not.toContain(
- "oauth2.consent.mcp.undisclosed.unserved.retry"
- );
- unmount();
- });
-
- // The server serves this ceiling and this bundle has no word for it: a newer
- // release's value against a page that was already open. Falling through to
- // the read-only wording would understate what was approved, and telling the
- // user to find an admin would send them after a policy that is working.
- test("a ceiling this page cannot name asks for a reload, not a grant", async () => {
- const { container, unmount } = await renderWithCeiling({
- capability: 5,
- ignoreMaskingExemptions: false,
- dataMaskingAvailable: true,
- modes: [...SERVED_MODES, { capability: 5 }],
- methods: [],
- engines: [],
- });
+ expect(container.querySelector('form[method="POST"]')).toBeNull();
expect(container.textContent).toContain(
- "oauth2.consent.mcp.undisclosed.outdated.title"
+ "oauth2.consent.mcp.undisclosed.undisclosable.title"
);
- expect(container.textContent).not.toContain("common.allow");
-
- const reload = vi.fn();
- Object.defineProperty(globalThis, "location", {
- writable: true,
- value: { ...globalThis.location, reload },
- });
- const retry = [...container.querySelectorAll("button")].find((b) =>
- b.textContent?.includes("oauth2.consent.mcp.undisclosed.outdated.retry")
+ // Both repairs are named in the copy instead. Re-reading returns the same
+ // value, and only a fresh bundle could name a newer tier, so neither
+ // remedy is a button this page can press.
+ expect(container.textContent).not.toContain(
+ "oauth2.consent.mcp.undisclosed.undisclosable.retry"
);
- expect(retry).toBeDefined();
- await act(async () => {
- retry?.click();
- });
- await flushPromises();
- // A reload, not a re-read: only a fresh bundle can name this ceiling, so
- // refetching the policy would return the same value with no word for it.
- expect(reload).toHaveBeenCalledTimes(1);
- expect(mocks.getMCPInfo).toHaveBeenCalledTimes(1);
unmount();
});
// Same reasoning as the disabled screen: history leaves the OAuth client
- // waiting on a callback that never comes, and these four states are the ones
- // where the person has nothing else to do here.
+ // waiting on a callback that never comes, and these states are the ones where
+ // the person has nothing else to do here.
test("dismissing an undisclosed policy denies the request", async () => {
const { container, unmount } = await renderWithCeiling({
capability: 0,
ignoreMaskingExemptions: false,
dataMaskingAvailable: true,
- methods: [],
- engines: [],
});
const submitted: HTMLFormElement[] = [];
diff --git a/frontend/src/routes/auth/OAuth2ConsentPage.tsx b/frontend/src/routes/auth/OAuth2ConsentPage.tsx
index 4d87205fe7..81ae2ced30 100644
--- a/frontend/src/routes/auth/OAuth2ConsentPage.tsx
+++ b/frontend/src/routes/auth/OAuth2ConsentPage.tsx
@@ -256,26 +256,21 @@ export function OAuth2ConsentPage() {
form.submit();
};
- // The way out of each state that has one. The two an admin has to repair get
- // nothing: re-reading returns the same broken value, and a button that
- // changes nothing reads as a promise that it might.
+ // The way out of the one state that has one. undisclosable gets nothing:
+ // re-reading returns the same value this page has no word for, and a button
+ // that changes nothing reads as a promise that it might. Its two repairs —
+ // reload, then ask an admin — are named in its own copy instead.
const retryFor = (reason: UndisclosedReason): (() => void) | undefined => {
- switch (reason) {
- case "unknown":
- // Wrapped rather than passed: retryCeiling is async, and handing a
- // Promise-returning function to a `() => void` prop floats the promise
- // (SonarCloud S6544). readCeiling swallows its own failures, so there
- // is no rejection to route anywhere.
- return () => {
- void retryCeiling();
- };
- case "outdated":
- // Only a fresh bundle can name this ceiling. Re-reading the policy
- // would return the same value this page has no word for.
- return () => globalThis.location.reload();
- default:
- return undefined;
+ if (reason !== "unknown") {
+ return undefined;
}
+ // Wrapped rather than passed: retryCeiling is async, and handing a
+ // Promise-returning function to a `() => void` prop floats the promise
+ // (SonarCloud S6544). readCeiling swallows its own failures, so there is no
+ // rejection to route anywhere.
+ return () => {
+ void retryCeiling();
+ };
};
// Five branches share this slot and only the last offers a grant.
@@ -298,7 +293,7 @@ export function OAuth2ConsentPage() {
);
}
// Allow renders only below this line, and only where the page holds a
- // ceiling the server serves and this bundle can name (BOT-106).
+ // ceiling this bundle can name (BOT-106).
const ceiling = readConsentCeiling(mcpInfo);
if (ceiling.kind !== "mode") {
return (
diff --git a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx
index 7e12d37bc9..d9ac3cea8c 100644
--- a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx
+++ b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.test.tsx
@@ -15,11 +15,9 @@ import {
const mocks = vi.hoisted(() => ({
useUnsavedChangesGuard: vi.fn(),
getSetting: vi.fn(),
- getMCPInfo: vi.fn(),
setSettingByName: vi.fn(),
upsertSetting: vi.fn(),
hasFeature: vi.fn(() => true),
- sheetProps: [] as Record<string, unknown>[],
settingsByName: { value: {} as Record<string, Setting> },
mcpSetting: {
value: undefined as
@@ -37,7 +35,6 @@ vi.mock("@/hooks/useUnsavedChangesGuard", () => ({
vi.mock("@/api", () => ({
settingServiceClientConnect: { getSetting: mocks.getSetting },
- workspaceServiceClientConnect: { getMCPInfo: mocks.getMCPInfo },
}));
vi.mock("@/components/PermissionGuard", () => ({
@@ -48,15 +45,6 @@ vi.mock("@/components/PermissionGuard", () => ({
}) => children({ disabled: false }),
}));
-// Stubbed to record its props: the drawer is rendered unconditionally, so this
-// captures what the section hands it on every render without opening it.
-vi.mock("@/components/mcp/MCPModeContentsSheet", () => ({
- MCPModeContentsSheet: (props: Record<string, unknown>) => {
- mocks.sheetProps.push(props);
- return null;
- },
-}));
-
vi.mock("@/stores", () => ({ pushNotification: vi.fn() }));
vi.mock("@/stores/app", () => {
@@ -138,7 +126,6 @@ const clickText = (container: HTMLElement, text: string) => {
beforeEach(async () => {
vi.clearAllMocks();
- mocks.sheetProps.length = 0;
mocks.settingsByName.value = {};
mocks.mcpSetting.value = {
capability: 3, // READ_ONLY
@@ -147,14 +134,6 @@ beforeEach(async () => {
mocks.upsertSetting.mockResolvedValue(undefined);
mocks.hasFeature.mockReturnValue(true);
mocks.getSetting.mockResolvedValue({ name: "settings/MCP" });
- mocks.getMCPInfo.mockResolvedValue({
- capability: 3,
- ignoreMaskingExemptions: false,
- dataMaskingAvailable: true,
- modes: [],
- methods: [],
- engines: [],
- });
({ MCPAccessPolicySection } = await import("./MCPAccessPolicySection"));
});
@@ -301,34 +280,6 @@ describe("MCPAccessPolicySection", () => {
unmount();
});
- // Codex, #21236: the drawer opens from a mode card the admin is choosing, so
- // it previews the candidate policy. Reading the persisted value described the
- // masking behavior they were about to replace.
- test("the drawer previews the draft masking value, not the stored one", async () => {
- const { container, render, unmount } = renderIntoContainer(
- <MCPAccessPolicySection />
- );
- render();
- await flush();
-
- clickText(container, "settings.mcp.policy.edit");
- await flush();
- expect(
- mocks.sheetProps.at(-1)?.ignoreMaskingExemptions
- ).toBe(false);
-
- toggleMasking(container);
- await flush();
-
- // Self-checking: if the click failed to flip the draft, the guard assertion
- // fails rather than the prop assertion passing for the wrong reason.
- expect(mocks.useUnsavedChangesGuard).toHaveBeenLastCalledWith(true);
- expect(mocks.sheetProps.at(-1)?.ignoreMaskingExemptions).toBe(true);
- expect(mocks.mcpSetting.value?.ignoreMaskingExemptions).toBe(false);
-
- unmount();
- });
-
// Codex, #21236. Two halves of one race, both pinned here.
test("waits for its own read before offering the cached policy for editing", async () => {
// Second visit: the store already holds a value from visit one.
@@ -354,58 +305,12 @@ describe("MCPAccessPolicySection", () => {
unmount();
});
- test("a mode-contents read that lands after a save does not revert the page", async () => {
- // The setting read is gated, so the save path cannot start until it
- // answers. GetMCPInfo is not gated and genuinely fires twice — once on
- // mount, once after the save — so this is the interleaving that survives.
- const slowInfo = deferred<Record<string, unknown>>();
- mocks.getMCPInfo.mockReturnValueOnce(slowInfo.promise);
- const freshInfo = {
- capability: 1,
- ignoreMaskingExemptions: true,
- dataMaskingAvailable: true,
- modes: [],
- methods: [],
- engines: [],
- };
- mocks.getMCPInfo.mockResolvedValue(freshInfo);
-
- const { container, render, unmount } = renderIntoContainer(
- <MCPAccessPolicySection />
- );
- render();
- await flush();
-
- clickText(container, "settings.mcp.policy.edit");
- await flush();
- clickText(container, "settings.mcp.policy.mode.disabled.title");
- await flush();
- clickText(container, "settings.mcp.policy.save");
- await flush();
-
- // Now the mount's read finally answers, with what it captured beforehand.
- act(() =>
- slowInfo.resolve({
- capability: 4,
- ignoreMaskingExemptions: false,
- dataMaskingAvailable: false,
- modes: [],
- methods: [],
- engines: [],
- })
- );
- await flush();
-
- expect(mocks.sheetProps.at(-1)?.info).toBe(freshInfo);
- unmount();
- });
-
- // Codex, #21236: this warning used to be gated on GetMCPInfo, which can still
- // fail through an outage. Hiding it there lets an admin arm a toggle that
- // does nothing while believing they tightened masking.
- test("says masking is unlicensed even when the mode data fails", async () => {
+ // Codex, #21236: this warning was once gated on a GetMCPInfo response, which
+ // can fail through an outage. Hiding it there lets an admin arm a toggle that
+ // does nothing while believing they tightened masking, so it reads the
+ // licence the store already holds.
+ test("says masking is unlicensed", async () => {
mocks.hasFeature.mockReturnValue(false);
- mocks.getMCPInfo.mockRejectedValue(new Error("the ceiling cannot be read"));
const { container, render, unmount } = renderIntoContainer(
<MCPAccessPolicySection />
@@ -421,76 +326,6 @@ describe("MCPAccessPolicySection", () => {
unmount();
});
- // Codex, #21236: the drawer's info is a required prop, so a pending or failed
- // GetMCPInfo cannot render as a mode that serves nothing — "0 of 0" over the
- // workspace whose ceiling the drawer exists to explain. Since BOT-106 that
- // failure is an outage rather than a broken ceiling; the test below covers
- // the ceiling case, which now answers.
- test("no mode-contents drawer while the mode data is missing", async () => {
- mocks.getMCPInfo.mockRejectedValue(new Error("the ceiling cannot be read"));
-
- const { container, render, unmount } = renderIntoContainer(
- <MCPAccessPolicySection />
- );
- render();
- await flush();
-
- // The policy itself still reads, so the page is up and editable.
- expect(container.textContent).toContain("settings.mcp.policy.in-force");
- expect(mocks.sheetProps).toHaveLength(0);
-
- unmount();
- });
-
- // BOT-106, the settings half. GetMCPInfo used to refuse whole under an
- // unreadable ceiling, so the mode cards lost their "See what Read-only
- // serves" links on the one page whose job is repairing that row — the admin
- // who most needs to compare the modes was the only one who could not. None of
- // the mode contents ever depended on the stored row, and the server now
- // answers them under a broken ceiling, which is the response mocked here.
- test("the mode-contents drawer is available while repairing a broken ceiling", async () => {
- // Capability 0 with no row for it in modes is the broken state: nothing
- // this build serves resolves from the stored row.
- mocks.mcpSetting.value = {
- capability: 0,
- ignoreMaskingExemptions: false,
- };
- mocks.getMCPInfo.mockResolvedValue({
- capability: 0,
- ignoreMaskingExemptions: false,
- dataMaskingAvailable: true,
- modes: [{ capability: 1 }, { capability: 3 }, { capability: 4 }],
- methods: [],
- engines: [],
- });
-
- const { container, render, unmount } = renderIntoContainer(
- <MCPAccessPolicySection />
- );
- render();
- await flush();
-
- // The repair banner, so this is the state under test and not a healthy row.
- expect(container.textContent).toContain(
- "settings.mcp.policy.unreadable.title"
- );
-
- clickText(container, "settings.mcp.policy.edit");
- await flush();
-
- const contents = [...container.querySelectorAll("button")].filter((b) =>
- b.textContent?.includes("settings.mcp.policy.mode.contents")
- );
- // One per ceiling that serves something; DISABLED has no contents to show.
- expect(contents).toHaveLength(2);
-
- act(() => contents[0].click());
- await flush();
- expect(mocks.sheetProps.at(-1)?.open).toBe(true);
-
- unmount();
- });
-
// Codex, #21236: setSaving gated only the footer buttons. The request has
// already captured pick and ignoreMasking, so a card clicked after Save went
// out changed the visible draft and nothing else — then the success path
diff --git a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.tsx b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.tsx
index 0ce00129f2..2d46046697 100644
--- a/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.tsx
+++ b/frontend/src/routes/workspace/mcp/MCPAccessPolicySection.tsx
@@ -2,14 +2,10 @@ import { create } from "@bufbuild/protobuf";
import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import { Code, ConnectError, createContextValues } from "@connectrpc/connect";
import { Rows3 } from "lucide-react";
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
-import {
- settingServiceClientConnect,
- workspaceServiceClientConnect,
-} from "@/api";
+import { settingServiceClientConnect } from "@/api";
import { silentContextKey } from "@/api/context-key";
-import { MCPModeContentsSheet } from "@/components/mcp/MCPModeContentsSheet";
import type { MCPMode } from "@/components/mcp/mcpPolicy";
import { isMCPMode, MCP_CAPABILITY_CHOICES } from "@/components/mcp/mcpPolicy";
import { PermissionGuard } from "@/components/PermissionGuard";
@@ -33,7 +29,6 @@ import {
SettingValueSchema,
} from "@/types/proto-es/v1/setting_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import type { MCPInfo } from "@/types/proto-es/v1/workspace_service_pb";
// One row per ceiling an admin can pick: the locale-key stem, the glyph tone,
// and the chip variant. The tone and the variant always agree, and carry from
@@ -66,9 +61,8 @@ export function MCPAccessPolicySection() {
const { t } = useTranslation();
const settingsByName = useAppStore((s) => s.settingsByName);
- // Read from the licence, not from GetMCPInfo. That request can still fail —
- // it answers under a broken ceiling now, but not through an outage — and
- // hiding this line lets an admin arm a toggle that does nothing while
+ // Read from the licence the store already holds, not from a request that can
+ // fail: hiding this line lets an admin arm a toggle that does nothing while
// believing they tightened masking.
const dataMaskingAvailable = useAppStore((s) =>
s.hasFeature(PlanFeature.FEATURE_DATA_MASKING)
@@ -83,51 +77,18 @@ export function MCPAccessPolicySection() {
return undefined;
}, [settingsByName]);
- const [info, setInfo] = useState<MCPInfo | undefined>(undefined);
const [editing, setEditing] = useState(false);
const [saving, setSaving] = useState(false);
const [pick, setPick] = useState<MCPMode | undefined>(undefined);
const [ignoreMasking, setIgnoreMasking] = useState(false);
- const [contentsFor, setContentsFor] = useState<MCPMode | undefined>(
- undefined
- );
- // GetMCPInfo resolves what a mode contains from the live descriptors, so it
- // is re-read after a save rather than patched: the ceiling in force is part
- // of the same answer.
- //
- // Silent: this read fails only on an outage now, and the card below already
- // says the page could not be read in words an admin can act on. The
- // interceptor's toast would put the same fact on screen twice, once as a
- // status code.
- // Both reads carry a generation, and the effect retires them on unmount. A
+ // The read carries a generation, and the effect retires it on unmount. A
// response has no way of knowing it was overtaken, and the store it writes is
// shared: a read left flying by a visit the admin navigated away from would
// otherwise land later and put that visit's row back, reverting a save made
- // since. getMCPInfo is also re-issued after every save, so its two responses
- // can land out of order on one mount.
- const infoGeneration = useRef(0);
+ // since.
const settingGeneration = useRef(0);
- const loadInfo = useCallback(() => {
- const generation = ++infoGeneration.current;
- workspaceServiceClientConnect
- .getMCPInfo(
- {},
- { contextValues: createContextValues().set(silentContextKey, true) }
- )
- .then((next) => {
- if (generation === infoGeneration.current) {
- setInfo(next);
- }
- })
- .catch(() => {
- if (generation === infoGeneration.current) {
- setInfo(undefined);
- }
- });
- }, []);
-
// Read the setting past the store's cache. The server reads this row uncached
// for a reason — a hand edit or a newer replica changes it out of band — and
// getOrFetchSettingByName returns a cached snapshot without revalidating, so
@@ -195,14 +156,12 @@ export function MCPAccessPolicySection() {
}
settle(true);
});
- loadInfo();
- // Retire both reads when this instance goes away. The generations are this
- // mount's; the setting store they write is the application's.
+ // Retire the read when this instance goes away. The generation is this
+ // mount's; the setting store it writes is the application's.
return () => {
settingGeneration.current++;
- infoGeneration.current++;
};
- }, [loadInfo]);
+ }, []);
const storedCapability = mcpSetting?.capability;
const storedMode =
@@ -262,7 +221,6 @@ export function MCPAccessPolicySection() {
updateMask: create(FieldMaskSchema, { paths }),
});
setEditing(false);
- loadInfo();
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -273,15 +231,6 @@ export function MCPAccessPolicySection() {
}
};
- // The mode the drawer is showing, frozen while it closes. The Sheet unmounts
- // after its close animation, so reading contentsFor directly would swap the
- // contents for another mode's for those ~200ms.
- const openContentsRef = useRef<MCPMode>(MCPSetting_Capability.READ_ONLY);
- if (contentsFor !== undefined) {
- openContentsRef.current = contentsFor;
- }
- const openContents = openContentsRef.current;
-
// Three states share this slot and only the last renders a policy. Early
// returns rather than a ternary chain, so each state is named where it is
// decided and the card reads as the ordinary case it is.
@@ -382,8 +331,8 @@ export function MCPAccessPolicySection() {
key={capability}
value={String(capability)}
// The item wraps the whole card in a label, so without
- // this the radio's name absorbs the description, the
- // contents link and the "Best for" line.
+ // this the radio's name absorbs the description and the
+ // "Best for" line.
aria-label={t(`settings.mcp.policy.mode.${mode.key}.title`)}
className={cn(
"relative h-full flex-col items-stretch rounded-sm border p-4",
@@ -403,24 +352,6 @@ export function MCPAccessPolicySection() {
<p className="textinfolabel">
{t(`settings.mcp.policy.mode.${mode.key}.description`)}
</p>
- {info && capability !== MCPSetting_Capability.DISABLED && (
- <Button
- appearance="link"
- size="sm"
- className="self-start px-0"
- onClick={(e) => {
- // This sits inside the card's own label, so a click
- // here would otherwise pick the mode too.
- e.preventDefault();
- e.stopPropagation();
- setContentsFor(capability);
- }}
- >
- {t("settings.mcp.policy.mode.contents", {
- mode: modeLabel(capability),
- })}
- </Button>
- )}
{/* Pinned to the bottom so the three "Best for" lines sit
on one row, however long each description runs. */}
<p className="textinfolabel mt-auto pt-2">
@@ -515,25 +446,6 @@ export function MCPAccessPolicySection() {
</div>
{policyBody()}
-
- {/* No info, no drawer. The trigger is already gated on it, and rendering
- without it would describe a mode that serves nothing rather than
- admitting the contents are unknown. */}
- {info && (
- <MCPModeContentsSheet
- open={contentsFor !== undefined}
- capability={openContents}
- info={info}
- modeLabel={modeLabel(openContents)}
- // While editing, the drawer previews the policy about to be saved,
- // not the one stored — the admin opens it from a card they are
- // choosing.
- ignoreMaskingExemptions={
- editing ? ignoreMasking : storedIgnoreMasking
- }
- onClose={() => setContentsFor(undefined)}
- />
- )}
</div>
);
}
diff --git a/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts b/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
index 52b2f381aa..c5b2867f8d 100644
--- a/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
@@ -2,11 +2,9 @@
// @generated from file v1/workspace_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
+import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
import type { MCPSetting_Capability } from "./setting_service_pb";
-import type { AuthMethod, MCPMethodClass } from "./annotation_pb";
-import type { Engine } from "./common_pb";
import type { FieldMask } from "@bufbuild/protobuf/wkt";
import type { GetIamPolicyRequestSchema, IamPolicySchema, SetIamPolicyRequestSchema } from "./iam_policy_pb";
import type { LoginResponseSchema } from "./auth_service_pb";
@@ -29,13 +27,12 @@ export declare type GetMCPInfoRequest = Message<"bytebase.v1.GetMCPInfoRequest">
export declare const GetMCPInfoRequestSchema: GenMessage<GetMCPInfoRequest>;
/**
- * MCPInfo is what MCP does in this workspace: the ceiling in force, what each
- * ceiling serves, and the per-engine facts a read-only session depends on.
+ * MCPInfo is what MCP does in this workspace: the ceiling in force, and
+ * whether masking narrows what a session reads under it.
*
- * Everything here is resolved when the request is served, never from a stored
- * copy: the method list comes off the compiled API descriptors and the engine
- * answers off the code that enforces them, so a build whose rules changed
- * cannot describe the rules of the build before it.
+ * This is the only API a served MCP session or the consent page can read the
+ * ceiling from. SettingService/GetSetting is served by no ceiling, and its
+ * answer is cached besides.
*
* @generated from message bytebase.v1.MCPInfo
*/
@@ -50,50 +47,21 @@ export declare type MCPInfo = Message<"bytebase.v1.MCPInfo"> & {
workspace: string;
/**
- * The ceiling in force for this workspace. A value no row in modes serves,
- * CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
- * the stored row and every MCP connection is refused.
+ * The ceiling in force for this workspace. Any value outside the enum this
+ * build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+ * resolved from the stored row and every MCP connection is refused. A stored
+ * name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+ * release wrote arrives verbatim.
*
* @generated from field: bytebase.v1.MCPSetting.Capability capability = 2;
*/
capability: MCPSetting_Capability;
- /**
- * What each ceiling serves, including the one in force, so an admin can
- * compare the choices rather than only read the current answer.
- *
- * @generated from field: repeated bytebase.v1.MCPCapabilityMode modes = 3;
- */
- modes: MCPCapabilityMode[];
-
- /**
- * Every API method some ceiling serves. A mode serves a method when the
- * method's class is one of that mode's served_classes, which is the ceiling
- * rule the gate evaluates. Methods no ceiling serves are absent.
- *
- * Being listed is necessary, not sufficient. The caller still needs the
- * permission, and two further rules narrow what a served method does: a
- * handful of methods are refused on the shape of the request (an issue that
- * would grant a permission, a rollout that skips approval), and under
- * READ_ONLY every statement SQLService/Query runs must classify as a read.
- *
- * @generated from field: repeated bytebase.v1.MCPMethod methods = 4;
- */
- methods: MCPMethod[];
-
- /**
- * What a read-only session and the masking toggle actually reach, per engine.
- * Both are engine-conditional in ways the ceiling alone does not show.
- *
- * @generated from field: repeated bytebase.v1.MCPEngineEnforcement engines = 5;
- */
- engines: MCPEngineEnforcement[];
-
/**
* Whether this workspace stops applying the caller's own unmasking
- * provisioning to MCP requests. It decides which branch of each engine's
- * masking state a caller is in, and no other API tells an MCP session:
- * SettingService/GetSetting is served by no ceiling.
+ * provisioning to MCP requests. It narrows what a session reads only where
+ * Bytebase masks by column and consults exemptions; elsewhere it suppresses
+ * nothing.
*
* @generated from field: bool ignore_masking_exemptions = 6;
*/
@@ -101,9 +69,9 @@ export declare type MCPInfo = Message<"bytebase.v1.MCPInfo"> & {
/**
* Whether data masking is licensed for this workspace. When false nothing is
- * masked whatever an engine supports, so the masking states below describe a
- * mechanism that does not run. Licensing can also be set per instance, so a
- * true here is the workspace answer, not a promise about every instance.
+ * masked whatever an engine supports, so the toggle above suppresses nothing.
+ * Licensing can also be set per instance, so a true here is the workspace
+ * answer, not a promise about every instance.
*
* @generated from field: bool data_masking_available = 7;
*/
@@ -116,212 +84,6 @@ export declare type MCPInfo = Message<"bytebase.v1.MCPInfo"> & {
*/
export declare const MCPInfoSchema: GenMessage<MCPInfo>;
-/**
- * MCPCapabilityMode is one ceiling and the method classes it serves.
- *
- * @generated from message bytebase.v1.MCPCapabilityMode
- */
-export declare type MCPCapabilityMode = Message<"bytebase.v1.MCPCapabilityMode"> & {
- /**
- * @generated from field: bytebase.v1.MCPSetting.Capability capability = 1;
- */
- capability: MCPSetting_Capability;
-
- /**
- * Empty means the ceiling serves nothing, which is what DISABLED is.
- *
- * @generated from field: repeated bytebase.v1.MCPMethodClass served_classes = 2;
- */
- servedClasses: MCPMethodClass[];
-};
-
-/**
- * Describes the message bytebase.v1.MCPCapabilityMode.
- * Use `create(MCPCapabilityModeSchema)` to create a new message.
- */
-export declare const MCPCapabilityModeSchema: GenMessage<MCPCapabilityMode>;
-
-/**
- * MCPMethod is one API method an MCP session can reach, and what decides it.
- *
- * @generated from message bytebase.v1.MCPMethod
- */
-export declare type MCPMethod = Message<"bytebase.v1.MCPMethod"> & {
- /**
- * The method as an audit entry names it, so a denial can be found by it.
- * Example: /bytebase.v1.SQLService/Query
- *
- * @generated from field: string method = 1;
- */
- method: string;
-
- /**
- * The same method as call_api takes it.
- * Example: bytebase.v1.SQLService.Query
- *
- * @generated from field: string operation_id = 4;
- */
- operationId: string;
-
- /**
- * @generated from field: bytebase.v1.MCPMethodClass class = 2;
- */
- class: MCPMethodClass;
-
- /**
- * The IAM permission the method declares. The ceiling never grants: a session
- * may call a served method only where the person it acts for could.
- *
- * Empty means the method declares no permission, which is NOT the same as
- * needing none — a method that authorizes inside its handler declares nothing
- * here. auth_method says which case an empty value is.
- *
- * @generated from field: string permission = 3;
- */
- permission: string;
-
- /**
- * How the method authorizes. IAM means the permission above is the primary
- * rule, though not always the only one — an update carrying allow_missing
- * additionally requires the matching create permission. CUSTOM means the
- * handler decides and the permission field is silent.
- *
- * @generated from field: bytebase.v1.AuthMethod auth_method = 5;
- */
- authMethod: AuthMethod;
-};
-
-/**
- * Describes the message bytebase.v1.MCPMethod.
- * Use `create(MCPMethodSchema)` to create a new message.
- */
-export declare const MCPMethodSchema: GenMessage<MCPMethod>;
-
-/**
- * MCPEngineEnforcement is what the read-only ceiling and the masking toggle
- * reach on one database engine.
- *
- * @generated from message bytebase.v1.MCPEngineEnforcement
- */
-export declare type MCPEngineEnforcement = Message<"bytebase.v1.MCPEngineEnforcement"> & {
- /**
- * @generated from field: bytebase.v1.Engine engine = 1;
- */
- engine: Engine;
-
- /**
- * @generated from field: bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth read_only_depth = 2;
- */
- readOnlyDepth: MCPEngineEnforcement_ReadOnlyDepth;
-
- /**
- * @generated from field: bytebase.v1.MCPEngineEnforcement.Masking masking = 3;
- */
- masking: MCPEngineEnforcement_Masking;
-
- /**
- * Where the answers above are the floor rather than the whole story. Empty
- * for most engines.
- *
- * @generated from field: string note = 4;
- */
- note: string;
-};
-
-/**
- * Describes the message bytebase.v1.MCPEngineEnforcement.
- * Use `create(MCPEngineEnforcementSchema)` to create a new message.
- */
-export declare const MCPEngineEnforcementSchema: GenMessage<MCPEngineEnforcement>;
-
-/**
- * How much of a read-only ceiling this engine can be held to.
- *
- * @generated from enum bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth
- */
-export enum MCPEngineEnforcement_ReadOnlyDepth {
- /**
- * @generated from enum value: READ_ONLY_DEPTH_UNSPECIFIED = 0;
- */
- READ_ONLY_DEPTH_UNSPECIFIED = 0,
-
- /**
- * Bytebase has no read-only classifier for this engine, so a read-only
- * session is refused every statement on it, including a plain SELECT.
- *
- * @generated from enum value: UNSUPPORTED = 1;
- */
- UNSUPPORTED = 1,
-
- /**
- * Every statement is classified before it runs and a request holding one
- * that is not a read is refused whole. Nothing below that: the driver does
- * not open a read-only database session, except where the note says
- * otherwise.
- *
- * @generated from enum value: STATEMENT = 2;
- */
- STATEMENT = 2,
-
- /**
- * Statement classification, and the driver opens the database session
- * read-only as well, so the engine refuses most writes the classifier
- * missed. Not a proof: a statement that classifies as a read can still call
- * a function that switches the session setting back off.
- *
- * @generated from enum value: STATEMENT_AND_SESSION = 3;
- */
- STATEMENT_AND_SESSION = 3,
-}
-
-/**
- * Describes the enum bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth.
- */
-export declare const MCPEngineEnforcement_ReadOnlyDepthSchema: GenEnum<MCPEngineEnforcement_ReadOnlyDepth>;
-
-/**
- * How Bytebase masks results on this engine, which is what decides whether
- * ignoring masking exemptions changes anything here.
- *
- * @generated from enum bytebase.v1.MCPEngineEnforcement.Masking
- */
-export enum MCPEngineEnforcement_Masking {
- /**
- * @generated from enum value: MASKING_UNSPECIFIED = 0;
- */
- MASKING_UNSPECIFIED = 0,
-
- /**
- * Bytebase does not mask on this engine. Nothing narrows what a session
- * reads, and ignoring masking exemptions does nothing.
- *
- * @generated from enum value: NONE = 1;
- */
- NONE = 1,
-
- /**
- * Column masking. A masking policy substitutes values in query results,
- * and the exemptions granted to the caller are what let them see the real
- * value — which is what ignoring exemptions suppresses.
- *
- * @generated from enum value: COLUMN = 2;
- */
- COLUMN = 2,
-
- /**
- * Document masking. Results are masked, but exemptions are never consulted
- * on this path, so ignoring them changes nothing here either.
- *
- * @generated from enum value: DOCUMENT = 3;
- */
- DOCUMENT = 3,
-}
-
-/**
- * Describes the enum bytebase.v1.MCPEngineEnforcement.Masking.
- */
-export declare const MCPEngineEnforcement_MaskingSchema: GenEnum<MCPEngineEnforcement_Masking>;
-
/**
* @generated from message bytebase.v1.RotateDirectorySyncTokenRequest
*/
@@ -581,9 +343,8 @@ export declare const WorkspaceService: GenService<{
},
/**
* Gets what MCP (Model Context Protocol) does in this workspace: the
- * capability ceiling in force, what each ceiling serves, and the per-engine
- * facts a read-only session depends on. The workspace is resolved from the
- * authenticated session.
+ * capability ceiling in force, and whether masking narrows what a session
+ * reads under it. The workspace is resolved from the authenticated session.
*
* Served to MCP sessions. An agent asking what it may do here is the point:
* the response says nothing a session's own denials do not already say, one
diff --git a/frontend/src/types/proto-es/v1/workspace_service_pb.js b/frontend/src/types/proto-es/v1/workspace_service_pb.js
index 006792ecdc..1673a640cd 100644
--- a/frontend/src/types/proto-es/v1/workspace_service_pb.js
+++ b/frontend/src/types/proto-es/v1/workspace_service_pb.js
@@ -2,7 +2,7 @@
// @generated from file v1/workspace_service.proto (package bytebase.v1, syntax proto3)
/* eslint-disable */
-import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
+import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
@@ -10,7 +10,6 @@ import { file_google_api_resource } from "../google/api/resource_pb";
import { file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt";
import { file_v1_annotation } from "./annotation_pb";
import { file_v1_auth_service } from "./auth_service_pb";
-import { file_v1_common } from "./common_pb";
import { file_v1_iam_policy } from "./iam_policy_pb";
import { file_v1_setting_service } from "./setting_service_pb";
@@ -18,7 +17,7 @@ import { file_v1_setting_service } from "./setting_service_pb";
* Describes the file v1/workspace_service.proto.
*/
export const file_v1_workspace_service = /*@__PURE__*/
- fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiEwoRR2V0TUNQSW5mb1JlcXVlc3QixgIKB01DUEluZm8SFgoJd29ya3NwYWNlGAEgASgJQgPgQQMSOwoKY2FwYWJpbGl0eRgCIAEoDjIiLmJ5dGViYXNlLnYxLk1DUFNldHRpbmcuQ2FwYWJpbGl0eUID4EEDEjIKBW1vZGVzGAMgAygLMh4uYnl0ZWJhc2UudjEuTUNQQ2FwYWJpbGl0eU1vZGVCA+BBAxIsCgdtZXRob2RzGAQgAygLMhYuYnl0ZWJhc2UudjEuTUNQTWV0aG9kQgPgQQMSNwoHZW5naW5lcxgFIAMoCzIhLmJ5dGViYXNlLnYxLk1DUEVuZ2luZUVuZm9yY2VtZW50QgPgQQMSJgoZaWdub3JlX21hc2tpbmdfZXhlbXB0aW9ucxgGIAEoCEID4EEDEiMKFmRhdGFfbWFza2luZ19hdmFpbGFibGUYByABKAhCA+BBAyKAAQoRTUNQQ2FwYWJpbGl0eU1vZGUSNgoKY2FwYWJpbGl0eRgBIAEoDjIiLmJ5dGViYXNlLnYxLk1DUFNldHRpbmcuQ2FwYWJpbGl0eRIzCg5zZXJ2ZWRfY2xhc3NlcxgCIAMoDjIbLmJ5dGViYXNlLnYxLk1DUE1ldGhvZENsYXNzIp8BCglNQ1BNZXRob2QSDgoGbWV0aG9kGAEgASgJEhQKDG9wZXJhdGlvbl9pZBgEIAEoCRIqCgVjbGFzcxgCIAEoDjIbLmJ5dGViYXNlLnYxLk1DUE1ldGhvZENsYXNzEhIKCnBlcm1pc3Npb24YAyABKAkSLAoLYXV0aF9tZXRob2QYBSABKA4yFy5ieXRlYmFzZS52MS5BdXRoTWV0aG9kIoQDChRNQ1BFbmdpbmVFbmZvcmNlbWVudBIjCgZlbmdpbmUYASABKA4yEy5ieXRlYmFzZS52MS5FbmdpbmUSSAoPcmVhZF9vbmx5X2RlcHRoGAIgASgOMi8uYnl0ZWJhc2UudjEuTUNQRW5naW5lRW5mb3JjZW1lbnQuUmVhZE9ubHlEZXB0aBI6CgdtYXNraW5nGAMgASgOMikuYnl0ZWJhc2UudjEuTUNQRW5naW5lRW5mb3JjZW1lbnQuTWFza2luZxIMCgRub3RlGAQgASgJImsKDVJlYWRPbmx5RGVwdGgSHwobUkVBRF9PTkxZX0RFUFRIX1VOU1BFQ0lGSUVEEAASDwoLVU5TVVBQT1JURUQQARINCglTVEFURU1FTlQQAhIZChVTVEFURU1FTlRfQU5EX1NFU1NJT04QAyJGCgdNYXNraW5nEhcKE01BU0tJTkdfVU5TUEVDSUZJRUQQABIICgROT05FEAESCgoGQ09MVU1OEAISDAoIRE9DVU1FTlQQAyJPCh9Sb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW5SZXF1ZXN0EiwKBG5hbWUYASABKAlCHuBBAvpBGAoWYnl0ZWJhc2UuY29tL1dvcmtzcGFjZSI6CiBSb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW5SZXNwb25zZRIWCgV0b2tlbhgBIAEoCUIH4EED0OowASIXChVMaXN0V29ya3NwYWNlc1JlcXVlc3QiRAoWTGlzdFdvcmtzcGFjZXNSZXNwb25zZRIqCgp3b3Jrc3BhY2VzGAEgAygLMhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlIiMKE0dldFdvcmtzcGFjZVJlcXVlc3QSDAoEbmFtZRgBIAEoCSI2CglXb3Jrc3BhY2USDAoEbmFtZRgBIAEoCRINCgV0aXRsZRgCIAEoCRIMCgRsb2dvGAMgASgJIisKFkRlbGV0ZVdvcmtzcGFjZVJlcXVlc3QSEQoEbmFtZRgBIAEoCUID4EECInkKFlVwZGF0ZVdvcmtzcGFjZVJlcXVlc3QSLgoJd29ya3NwYWNlGAEgASgLMhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlQgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrIioKFUxlYXZlV29ya3NwYWNlUmVxdWVzdBIRCgRuYW1lGAEgASgJQgPgQQIygAsKEFdvcmtzcGFjZVNlcnZpY2UScQoMR2V0V29ya3NwYWNlEiAuYnl0ZWJhc2UudjEuR2V0V29ya3NwYWNlUmVxdWVzdBoWLmJ5dGViYXNlLnYxLldvcmtzcGFjZSIngOowAaDqMAGC0+STAhkSFy92MS97bmFtZT13b3Jrc3BhY2VzLyp9EnkKDkxpc3RXb3Jrc3BhY2VzEiIuYnl0ZWJhc2UudjEuTGlzdFdvcmtzcGFjZXNSZXF1ZXN0GiMuYnl0ZWJhc2UudjEuTGlzdFdvcmtzcGFjZXNSZXNwb25zZSIekOowAqDqMAGC0+STAhASDi92MS93b3Jrc3BhY2VzEqQBCg9VcGRhdGVXb3Jrc3BhY2USIy5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc3BhY2VSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlIlSK6jAUYmIud29ya3NwYWNlcy51cGRhdGWQ6jABmOowAaDqMASo6jAJgtPkkwImOgEqMiEvdjEve3dvcmtzcGFjZS5uYW1lPXdvcmtzcGFjZXMvKn0SpAEKDEdldElhbVBvbGljeRIgLmJ5dGViYXNlLnYxLkdldElhbVBvbGljeVJlcXVlc3QaFi5ieXRlYmFzZS52MS5JYW1Qb2xpY3kiWorqMBpiYi53b3Jrc3BhY2VzLmdldElhbVBvbGljeZDqMAGg6jAEqOowCYLT5JMCKhIoL3YxL3tyZXNvdXJjZT13b3Jrc3BhY2VzLyp9OmdldElhbVBvbGljeRKbAQoPRGVsZXRlV29ya3NwYWNlEiMuYnl0ZWJhc2UudjEuRGVsZXRlV29ya3NwYWNlUmVxdWVzdBoaLmJ5dGViYXNlLnYxLkxvZ2luUmVzcG9uc2UiR4rqMBRiYi53b3Jrc3BhY2VzLmRlbGV0ZZDqMAGY6jABoOowA6jqMAWC0+STAhkqFy92MS97bmFtZT13b3Jrc3BhY2VzLyp9EooBCg5MZWF2ZVdvcmtzcGFjZRIiLmJ5dGViYXNlLnYxLkxlYXZlV29ya3NwYWNlUmVxdWVzdBoaLmJ5dGViYXNlLnYxLkxvZ2luUmVzcG9uc2UiOJDqMAKY6jABoOowA6jqMAWC0+STAiI6ASoiHS92MS97bmFtZT13b3Jrc3BhY2VzLyp9OmxlYXZlEqsBCgxTZXRJYW1Qb2xpY3kSIC5ieXRlYmFzZS52MS5TZXRJYW1Qb2xpY3lSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuSWFtUG9saWN5ImGK6jAaYmIud29ya3NwYWNlcy5zZXRJYW1Qb2xpY3mQ6jABmOowAaDqMASo6jAJgtPkkwItOgEqIigvdjEve3Jlc291cmNlPXdvcmtzcGFjZXMvKn06c2V0SWFtUG9saWN5El8KCkdldE1DUEluZm8SHi5ieXRlYmFzZS52MS5HZXRNQ1BJbmZvUmVxdWVzdBoULmJ5dGViYXNlLnYxLk1DUEluZm8iG9pBAKDqMAGC0+STAg4SDC92MS9tY3AvaW5mbxL1AQoYUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuEiwuYnl0ZWJhc2UudjEuUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVxdWVzdBotLmJ5dGViYXNlLnYxLlJvdGF0ZURpcmVjdG9yeVN5bmNUb2tlblJlc3BvbnNlInzaQQRuYW1liuowJmJiLndvcmtzcGFjZXMucm90YXRlRGlyZWN0b3J5U3luY1Rva2VukOowAZjqMAGg6jADqOowBoLT5JMCNToBKiIwL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn06cm90YXRlRGlyZWN0b3J5U3luY1Rva2VuQqsBCg9jb20uYnl0ZWJhc2UudjFCFVdvcmtzcGFjZVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_common, file_v1_iam_policy, file_v1_setting_service]);
+ fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiEwoRR2V0TUNQSW5mb1JlcXVlc3Qi1gEKB01DUEluZm8SFgoJd29ya3NwYWNlGAEgASgJQgPgQQMSOwoKY2FwYWJpbGl0eRgCIAEoDjIiLmJ5dGViYXNlLnYxLk1DUFNldHRpbmcuQ2FwYWJpbGl0eUID4EEDEiYKGWlnbm9yZV9tYXNraW5nX2V4ZW1wdGlvbnMYBiABKAhCA+BBAxIjChZkYXRhX21hc2tpbmdfYXZhaWxhYmxlGAcgASgIQgPgQQNKBAgDEARKBAgEEAVKBAgFEAZSBW1vZGVzUgdtZXRob2RzUgdlbmdpbmVzIk8KH1JvdGF0ZURpcmVjdG9yeVN5bmNUb2tlblJlcXVlc3QSLAoEbmFtZRgBIAEoCUIe4EEC+kEYChZieXRlYmFzZS5jb20vV29ya3NwYWNlIjoKIFJvdGF0ZURpcmVjdG9yeVN5bmNUb2tlblJlc3BvbnNlEhYKBXRva2VuGAEgASgJQgfgQQPQ6jABIhcKFUxpc3RXb3Jrc3BhY2VzUmVxdWVzdCJEChZMaXN0V29ya3NwYWNlc1Jlc3BvbnNlEioKCndvcmtzcGFjZXMYASADKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc3BhY2UiIwoTR2V0V29ya3NwYWNlUmVxdWVzdBIMCgRuYW1lGAEgASgJIjYKCVdvcmtzcGFjZRIMCgRuYW1lGAEgASgJEg0KBXRpdGxlGAIgASgJEgwKBGxvZ28YAyABKAkiKwoWRGVsZXRlV29ya3NwYWNlUmVxdWVzdBIRCgRuYW1lGAEgASgJQgPgQQIieQoWVXBkYXRlV29ya3NwYWNlUmVxdWVzdBIuCgl3b3Jrc3BhY2UYASABKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc3BhY2VCA+BBAhIvCgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2siKgoVTGVhdmVXb3Jrc3BhY2VSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAjKACwoQV29ya3NwYWNlU2VydmljZRJxCgxHZXRXb3Jrc3BhY2USIC5ieXRlYmFzZS52MS5HZXRXb3Jrc3BhY2VSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlIieA6jABoOowAYLT5JMCGRIXL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn0SeQoOTGlzdFdvcmtzcGFjZXMSIi5ieXRlYmFzZS52MS5MaXN0V29ya3NwYWNlc1JlcXVlc3QaIy5ieXRlYmFzZS52MS5MaXN0V29ya3NwYWNlc1Jlc3BvbnNlIh6Q6jACoOowAYLT5JMCEBIOL3YxL3dvcmtzcGFjZXMSpAEKD1VwZGF0ZVdvcmtzcGFjZRIjLmJ5dGViYXNlLnYxLlVwZGF0ZVdvcmtzcGFjZVJlcXVlc3QaFi5ieXRlYmFzZS52MS5Xb3Jrc3BhY2UiVIrqMBRiYi53b3Jrc3BhY2VzLnVwZGF0ZZDqMAGY6jABoOowBKjqMAmC0+STAiY6ASoyIS92MS97d29ya3NwYWNlLm5hbWU9d29ya3NwYWNlcy8qfRKkAQoMR2V0SWFtUG9saWN5EiAuYnl0ZWJhc2UudjEuR2V0SWFtUG9saWN5UmVxdWVzdBoWLmJ5dGViYXNlLnYxLklhbVBvbGljeSJaiuowGmJiLndvcmtzcGFjZXMuZ2V0SWFtUG9saWN5kOowAaDqMASo6jAJgtPkkwIqEigvdjEve3Jlc291cmNlPXdvcmtzcGFjZXMvKn06Z2V0SWFtUG9saWN5EpsBCg9EZWxldGVXb3Jrc3BhY2USIy5ieXRlYmFzZS52MS5EZWxldGVXb3Jrc3BhY2VSZXF1ZXN0GhouYnl0ZWJhc2UudjEuTG9naW5SZXNwb25zZSJHiuowFGJiLndvcmtzcGFjZXMuZGVsZXRlkOowAZjqMAGg6jADqOowBYLT5JMCGSoXL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn0SigEKDkxlYXZlV29ya3NwYWNlEiIuYnl0ZWJhc2UudjEuTGVhdmVXb3Jrc3BhY2VSZXF1ZXN0GhouYnl0ZWJhc2UudjEuTG9naW5SZXNwb25zZSI4kOowApjqMAGg6jADqOowBYLT5JMCIjoBKiIdL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn06bGVhdmUSqwEKDFNldElhbVBvbGljeRIgLmJ5dGViYXNlLnYxLlNldElhbVBvbGljeVJlcXVlc3QaFi5ieXRlYmFzZS52MS5JYW1Qb2xpY3kiYYrqMBpiYi53b3Jrc3BhY2VzLnNldElhbVBvbGljeZDqMAGY6jABoOowBKjqMAmC0+STAi06ASoiKC92MS97cmVzb3VyY2U9d29ya3NwYWNlcy8qfTpzZXRJYW1Qb2xpY3kSXwoKR2V0TUNQSW5mbxIeLmJ5dGViYXNlLnYxLkdldE1DUEluZm9SZXF1ZXN0GhQuYnl0ZWJhc2UudjEuTUNQSW5mbyIb2kEAoOowAYLT5JMCDhIML3YxL21jcC9pbmZvEvUBChhSb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW4SLC5ieXRlYmFzZS52MS5Sb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW5SZXF1ZXN0Gi0uYnl0ZWJhc2UudjEuUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVzcG9uc2UifNpBBG5hbWWK6jAmYmIud29ya3NwYWNlcy5yb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW6Q6jABmOowAaDqMAOo6jAGgtPkkwI1OgEqIjAvdjEve25hbWU9d29ya3NwYWNlcy8qfTpyb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW5CqwEKD2NvbS5ieXRlYmFzZS52MUIVV29ya3NwYWNlU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_iam_policy, file_v1_setting_service]);
/**
* Describes the message bytebase.v1.GetMCPInfoRequest.
@@ -34,118 +33,68 @@ export const GetMCPInfoRequestSchema = /*@__PURE__*/
export const MCPInfoSchema = /*@__PURE__*/
messageDesc(file_v1_workspace_service, 1);
-/**
- * Describes the message bytebase.v1.MCPCapabilityMode.
- * Use `create(MCPCapabilityModeSchema)` to create a new message.
- */
-export const MCPCapabilityModeSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 2);
-
-/**
- * Describes the message bytebase.v1.MCPMethod.
- * Use `create(MCPMethodSchema)` to create a new message.
- */
-export const MCPMethodSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 3);
-
-/**
- * Describes the message bytebase.v1.MCPEngineEnforcement.
- * Use `create(MCPEngineEnforcementSchema)` to create a new message.
- */
-export const MCPEngineEnforcementSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 4);
-
-/**
- * Describes the enum bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth.
- */
-export const MCPEngineEnforcement_ReadOnlyDepthSchema = /*@__PURE__*/
- enumDesc(file_v1_workspace_service, 4, 0);
-
-/**
- * How much of a read-only ceiling this engine can be held to.
- *
- * @generated from enum bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth
- */
-export const MCPEngineEnforcement_ReadOnlyDepth = /*@__PURE__*/
- tsEnum(MCPEngineEnforcement_ReadOnlyDepthSchema);
-
-/**
- * Describes the enum bytebase.v1.MCPEngineEnforcement.Masking.
- */
-export const MCPEngineEnforcement_MaskingSchema = /*@__PURE__*/
- enumDesc(file_v1_workspace_service, 4, 1);
-
-/**
- * How Bytebase masks results on this engine, which is what decides whether
- * ignoring masking exemptions changes anything here.
- *
- * @generated from enum bytebase.v1.MCPEngineEnforcement.Masking
- */
-export const MCPEngineEnforcement_Masking = /*@__PURE__*/
- tsEnum(MCPEngineEnforcement_MaskingSchema);
-
/**
* Describes the message bytebase.v1.RotateDirectorySyncTokenRequest.
* Use `create(RotateDirectorySyncTokenRequestSchema)` to create a new message.
*/
export const RotateDirectorySyncTokenRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 5);
+ messageDesc(file_v1_workspace_service, 2);
/**
* Describes the message bytebase.v1.RotateDirectorySyncTokenResponse.
* Use `create(RotateDirectorySyncTokenResponseSchema)` to create a new message.
*/
export const RotateDirectorySyncTokenResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 6);
+ messageDesc(file_v1_workspace_service, 3);
/**
* Describes the message bytebase.v1.ListWorkspacesRequest.
* Use `create(ListWorkspacesRequestSchema)` to create a new message.
*/
export const ListWorkspacesRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 7);
+ messageDesc(file_v1_workspace_service, 4);
/**
* Describes the message bytebase.v1.ListWorkspacesResponse.
* Use `create(ListWorkspacesResponseSchema)` to create a new message.
*/
export const ListWorkspacesResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 8);
+ messageDesc(file_v1_workspace_service, 5);
/**
* Describes the message bytebase.v1.GetWorkspaceRequest.
* Use `create(GetWorkspaceRequestSchema)` to create a new message.
*/
export const GetWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 9);
+ messageDesc(file_v1_workspace_service, 6);
/**
* Describes the message bytebase.v1.Workspace.
* Use `create(WorkspaceSchema)` to create a new message.
*/
export const WorkspaceSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 10);
+ messageDesc(file_v1_workspace_service, 7);
/**
* Describes the message bytebase.v1.DeleteWorkspaceRequest.
* Use `create(DeleteWorkspaceRequestSchema)` to create a new message.
*/
export const DeleteWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 11);
+ messageDesc(file_v1_workspace_service, 8);
/**
* Describes the message bytebase.v1.UpdateWorkspaceRequest.
* Use `create(UpdateWorkspaceRequestSchema)` to create a new message.
*/
export const UpdateWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 12);
+ messageDesc(file_v1_workspace_service, 9);
/**
* Describes the message bytebase.v1.LeaveWorkspaceRequest.
* Use `create(LeaveWorkspaceRequestSchema)` to create a new message.
*/
export const LeaveWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 13);
+ messageDesc(file_v1_workspace_service, 10);
/**
* WorkspaceService manages workspace-level operations and profile.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 35dcf1b879..65c2e169fa 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -5440,9 +5440,8 @@ paths:
- WorkspaceService
summary: |-
Gets what MCP (Model Context Protocol) does in this workspace: the
- capability ceiling in force, what each ceiling serves, and the per-engine
- facts a read-only session depends on. The workspace is resolved from the
- authenticated session.
+ capability ceiling in force, and whether masking narrows what a session
+ reads under it. The workspace is resolved from the authenticated session.
description: |-
Served to MCP sessions. An agent asking what it may do here is the point:
the response says nothing a session's own denials do not already say, one
@@ -26771,21 +26770,6 @@ components:
title: LogoutRequest
additionalProperties: false
description: Request to logout current user session.
- bytebase.v1.MCPCapabilityMode:
- type: object
- properties:
- capability:
- title: capability
- $ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'
- servedClasses:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPMethodClass'
- title: served_classes
- description: Empty means the ceiling serves nothing, which is what DISABLED is.
- title: MCPCapabilityMode
- additionalProperties: false
- description: MCPCapabilityMode is one ceiling and the method classes it serves.
bytebase.v1.MCPDelegation:
type: object
properties:
@@ -26858,49 +26842,6 @@ components:
that contradicts its class. Neither is expressible now, and the one check
left — the reason belongs to the class it is used on — is a table the gate
already keeps for the wording.
- bytebase.v1.MCPEngineEnforcement:
- type: object
- properties:
- engine:
- title: engine
- $ref: '#/components/schemas/bytebase.v1.Engine'
- readOnlyDepth:
- title: read_only_depth
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth'
- masking:
- title: masking
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement.Masking'
- note:
- type: string
- title: note
- description: |-
- Where the answers above are the floor rather than the whole story. Empty
- for most engines.
- title: MCPEngineEnforcement
- additionalProperties: false
- description: |-
- MCPEngineEnforcement is what the read-only ceiling and the masking toggle
- reach on one database engine.
- bytebase.v1.MCPEngineEnforcement.Masking:
- type: string
- title: Masking
- enum:
- - MASKING_UNSPECIFIED
- - NONE
- - COLUMN
- - DOCUMENT
- description: |-
- How Bytebase masks results on this engine, which is what decides whether
- ignoring masking exemptions changes anything here.
- bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth:
- type: string
- title: ReadOnlyDepth
- enum:
- - READ_ONLY_DEPTH_UNSPECIFIED
- - UNSUPPORTED
- - STATEMENT
- - STATEMENT_AND_SESSION
- description: How much of a read-only ceiling this engine can be held to.
bytebase.v1.MCPInfo:
type: object
properties:
@@ -26915,112 +26856,40 @@ components:
capability:
title: capability
description: |-
- The ceiling in force for this workspace. A value no row in modes serves,
- CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
- the stored row and every MCP connection is refused.
+ The ceiling in force for this workspace. Any value outside the enum this
+ build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+ resolved from the stored row and every MCP connection is refused. A stored
+ name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+ release wrote arrives verbatim.
readOnly: true
$ref: '#/components/schemas/bytebase.v1.MCPSetting.Capability'
- modes:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPCapabilityMode'
- title: modes
- description: |-
- What each ceiling serves, including the one in force, so an admin can
- compare the choices rather than only read the current answer.
- readOnly: true
- methods:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPMethod'
- title: methods
- description: |-
- Every API method some ceiling serves. A mode serves a method when the
- method's class is one of that mode's served_classes, which is the ceiling
- rule the gate evaluates. Methods no ceiling serves are absent.
-
- Being listed is necessary, not sufficient. The caller still needs the
- permission, and two further rules narrow what a served method does: a
- handful of methods are refused on the shape of the request (an issue that
- would grant a permission, a rollout that skips approval), and under
- READ_ONLY every statement SQLService/Query runs must classify as a read.
- readOnly: true
- engines:
- type: array
- items:
- $ref: '#/components/schemas/bytebase.v1.MCPEngineEnforcement'
- title: engines
- description: |-
- What a read-only session and the masking toggle actually reach, per engine.
- Both are engine-conditional in ways the ceiling alone does not show.
- readOnly: true
ignoreMaskingExemptions:
type: boolean
title: ignore_masking_exemptions
description: |-
Whether this workspace stops applying the caller's own unmasking
- provisioning to MCP requests. It decides which branch of each engine's
- masking state a caller is in, and no other API tells an MCP session:
- SettingService/GetSetting is served by no ceiling.
+ provisioning to MCP requests. It narrows what a session reads only where
+ Bytebase masks by column and consults exemptions; elsewhere it suppresses
+ nothing.
readOnly: true
dataMaskingAvailable:
type: boolean
title: data_masking_available
description: |-
Whether data masking is licensed for this workspace. When false nothing is
- masked whatever an engine supports, so the masking states below describe a
- mechanism that does not run. Licensing can also be set per instance, so a
- true here is the workspace answer, not a promise about every instance.
+ masked whatever an engine supports, so the toggle above suppresses nothing.
+ Licensing can also be set per instance, so a true here is the workspace
+ answer, not a promise about every instance.
readOnly: true
title: MCPInfo
additionalProperties: false
description: |-
- MCPInfo is what MCP does in this workspace: the ceiling in force, what each
- ceiling serves, and the per-engine facts a read-only session depends on.
-
- Everything here is resolved when the request is served, never from a stored
- copy: the method list comes off the compiled API descriptors and the engine
- answers off the code that enforces them, so a build whose rules changed
- cannot describe the rules of the build before it.
- bytebase.v1.MCPMethod:
- type: object
- properties:
- method:
- type: string
- title: method
- description: |-
- The method as an audit entry names it, so a denial can be found by it.
- Example: /bytebase.v1.SQLService/Query
- operationId:
- type: string
- title: operation_id
- description: |-
- The same method as call_api takes it.
- Example: bytebase.v1.SQLService.Query
- class:
- title: class
- $ref: '#/components/schemas/bytebase.v1.MCPMethodClass'
- permission:
- type: string
- title: permission
- description: |-
- The IAM permission the method declares. The ceiling never grants: a session
- may call a served method only where the person it acts for could.
+ MCPInfo is what MCP does in this workspace: the ceiling in force, and
+ whether masking narrows what a session reads under it.
- Empty means the method declares no permission, which is NOT the same as
- needing none — a method that authorizes inside its handler declares nothing
- here. auth_method says which case an empty value is.
- authMethod:
- title: auth_method
- description: |-
- How the method authorizes. IAM means the permission above is the primary
- rule, though not always the only one — an update carrying allow_missing
- additionally requires the matching create permission. CUSTOM means the
- handler decides and the permission field is silent.
- $ref: '#/components/schemas/bytebase.v1.AuthMethod'
- title: MCPMethod
- additionalProperties: false
- description: MCPMethod is one API method an MCP session can reach, and what decides it.
+ This is the only API a served MCP session or the consent page can read the
+ ceiling from. SettingService/GetSetting is served by no ceiling, and its
+ answer is cached besides.
bytebase.v1.MCPMethodClass:
type: string
title: MCPMethodClass
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index ae9abc10e1..563340b842 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -799,18 +799,12 @@
- [LeaveWorkspaceRequest](#bytebase-v1-LeaveWorkspaceRequest)
- [ListWorkspacesRequest](#bytebase-v1-ListWorkspacesRequest)
- [ListWorkspacesResponse](#bytebase-v1-ListWorkspacesResponse)
- - [MCPCapabilityMode](#bytebase-v1-MCPCapabilityMode)
- - [MCPEngineEnforcement](#bytebase-v1-MCPEngineEnforcement)
- [MCPInfo](#bytebase-v1-MCPInfo)
- - [MCPMethod](#bytebase-v1-MCPMethod)
- [RotateDirectorySyncTokenRequest](#bytebase-v1-RotateDirectorySyncTokenRequest)
- [RotateDirectorySyncTokenResponse](#bytebase-v1-RotateDirectorySyncTokenResponse)
- [UpdateWorkspaceRequest](#bytebase-v1-UpdateWorkspaceRequest)
- [Workspace](#bytebase-v1-Workspace)
- - [MCPEngineEnforcement.Masking](#bytebase-v1-MCPEngineEnforcement-Masking)
- - [MCPEngineEnforcement.ReadOnlyDepth](#bytebase-v1-MCPEngineEnforcement-ReadOnlyDepth)
-
- [WorkspaceService](#bytebase-v1-WorkspaceService)
- [Scalar Value Types](#scalar-value-types)
@@ -12927,85 +12921,23 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati
-<a name="bytebase-v1-MCPCapabilityMode"></a>
-
-### MCPCapabilityMode
-MCPCapabilityMode is one ceiling and the method classes it serves.
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| capability | [MCPSetting.Capability](#bytebase-v1-MCPSetting-Capability) | | |
-| served_classes | [MCPMethodClass](#bytebase-v1-MCPMethodClass) | repeated | Empty means the ceiling serves nothing, which is what DISABLED is. |
-
-
-
-
-
-
-<a name="bytebase-v1-MCPEngineEnforcement"></a>
-
-### MCPEngineEnforcement
-MCPEngineEnforcement is what the read-only ceiling and the masking toggle
-reach on one database engine.
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| engine | [Engine](#bytebase-v1-Engine) | | |
-| read_only_depth | [MCPEngineEnforcement.ReadOnlyDepth](#bytebase-v1-MCPEngineEnforcement-ReadOnlyDepth) | | |
-| masking | [MCPEngineEnforcement.Masking](#bytebase-v1-MCPEngineEnforcement-Masking) | | |
-| note | [string](#string) | | Where the answers above are the floor rather than the whole story. Empty for most engines. |
-
-
-
-
-
-
<a name="bytebase-v1-MCPInfo"></a>
### MCPInfo
-MCPInfo is what MCP does in this workspace: the ceiling in force, what each
-ceiling serves, and the per-engine facts a read-only session depends on.
+MCPInfo is what MCP does in this workspace: the ceiling in force, and
+whether masking narrows what a session reads under it.
-Everything here is resolved when the request is served, never from a stored
-copy: the method list comes off the compiled API descriptors and the engine
-answers off the code that enforces them, so a build whose rules changed
-cannot describe the rules of the build before it.
+This is the only API a served MCP session or the consent page can read the
+ceiling from. SettingService/GetSetting is served by no ceiling, and its
+answer is cached besides.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| workspace | [string](#string) | | The workspace this describes. Format: workspaces/{workspace}. Not this message&#39;s own resource name — MCPInfo is not a named resource and there is nothing to get it by. |
-| capability | [MCPSetting.Capability](#bytebase-v1-MCPSetting-Capability) | | The ceiling in force for this workspace. A value no row in modes serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from the stored row and every MCP connection is refused. |
-| modes | [MCPCapabilityMode](#bytebase-v1-MCPCapabilityMode) | repeated | What each ceiling serves, including the one in force, so an admin can compare the choices rather than only read the current answer. |
-| methods | [MCPMethod](#bytebase-v1-MCPMethod) | repeated | Every API method some ceiling serves. A mode serves a method when the method&#39;s class is one of that mode&#39;s served_classes, which is the ceiling rule the gate evaluates. Methods no ceiling serves are absent.
-
-Being listed is necessary, not sufficient. The caller still needs the permission, and two further rules narrow what a served method does: a handful of methods are refused on the shape of the request (an issue that would grant a permission, a rollout that skips approval), and under READ_ONLY every statement SQLService/Query runs must classify as a read. |
-| engines | [MCPEngineEnforcement](#bytebase-v1-MCPEngineEnforcement) | repeated | What a read-only session and the masking toggle actually reach, per engine. Both are engine-conditional in ways the ceiling alone does not show. |
-| ignore_masking_exemptions | [bool](#bool) | | Whether this workspace stops applying the caller&#39;s own unmasking provisioning to MCP requests. It decides which branch of each engine&#39;s masking state a caller is in, and no other API tells an MCP session: SettingService/GetSetting is served by no ceiling. |
-| data_masking_available | [bool](#bool) | | Whether data masking is licensed for this workspace. When false nothing is masked whatever an engine supports, so the masking states below describe a mechanism that does not run. Licensing can also be set per instance, so a true here is the workspace answer, not a promise about every instance. |
-
-
-
-
-
-
-<a name="bytebase-v1-MCPMethod"></a>
-
-### MCPMethod
-MCPMethod is one API method an MCP session can reach, and what decides it.
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| method | [string](#string) | | The method as an audit entry names it, so a denial can be found by it. Example: /bytebase.v1.SQLService/Query |
-| operation_id | [string](#string) | | The same method as call_api takes it. Example: bytebase.v1.SQLService.Query |
-| class | [MCPMethodClass](#bytebase-v1-MCPMethodClass) | | |
-| permission | [string](#string) | | The IAM permission the method declares. The ceiling never grants: a session may call a served method only where the person it acts for could.
-
-Empty means the method declares no permission, which is NOT the same as needing none — a method that authorizes inside its handler declares nothing here. auth_method says which case an empty value is. |
-| auth_method | [AuthMethod](#bytebase-v1-AuthMethod) | | How the method authorizes. IAM means the permission above is the primary rule, though not always the only one — an update carrying allow_missing additionally requires the matching create permission. CUSTOM means the handler decides and the permission field is silent. |
+| capability | [MCPSetting.Capability](#bytebase-v1-MCPSetting-Capability) | | The ceiling in force for this workspace. Any value outside the enum this build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from the stored row and every MCP connection is refused. A stored name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer release wrote arrives verbatim. |
+| ignore_masking_exemptions | [bool](#bool) | | Whether this workspace stops applying the caller&#39;s own unmasking provisioning to MCP requests. It narrows what a session reads only where Bytebase masks by column and consults exemptions; elsewhere it suppresses nothing. |
+| data_masking_available | [bool](#bool) | | Whether data masking is licensed for this workspace. When false nothing is masked whatever an engine supports, so the toggle above suppresses nothing. Licensing can also be set per instance, so a true here is the workspace answer, not a promise about every instance. |
@@ -13076,35 +13008,6 @@ Empty means the method declares no permission, which is NOT the same as needing
-
-<a name="bytebase-v1-MCPEngineEnforcement-Masking"></a>
-
-### MCPEngineEnforcement.Masking
-How Bytebase masks results on this engine, which is what decides whether
-ignoring masking exemptions changes anything here.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| MASKING_UNSPECIFIED | 0 | |
-| NONE | 1 | Bytebase does not mask on this engine. Nothing narrows what a session reads, and ignoring masking exemptions does nothing. |
-| COLUMN | 2 | Column masking. A masking policy substitutes values in query results, and the exemptions granted to the caller are what let them see the real value — which is what ignoring exemptions suppresses. |
-| DOCUMENT | 3 | Document masking. Results are masked, but exemptions are never consulted on this path, so ignoring them changes nothing here either. |
-
-
-
-<a name="bytebase-v1-MCPEngineEnforcement-ReadOnlyDepth"></a>
-
-### MCPEngineEnforcement.ReadOnlyDepth
-How much of a read-only ceiling this engine can be held to.
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| READ_ONLY_DEPTH_UNSPECIFIED | 0 | |
-| UNSUPPORTED | 1 | Bytebase has no read-only classifier for this engine, so a read-only session is refused every statement on it, including a plain SELECT. |
-| STATEMENT | 2 | Every statement is classified before it runs and a request holding one that is not a read is refused whole. Nothing below that: the driver does not open a read-only database session, except where the note says otherwise. |
-| STATEMENT_AND_SESSION | 3 | Statement classification, and the driver opens the database session read-only as well, so the engine refuses most writes the classifier missed. Not a proof: a statement that classifies as a read can still call a function that switches the session setting back off. |
-
-
@@ -13124,7 +13027,7 @@ WorkspaceService manages workspace-level operations and profile.
| DeleteWorkspace | [DeleteWorkspaceRequest](#bytebase-v1-DeleteWorkspaceRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Deletes a workspace. SaaS only. Cancels any active subscription and soft-deletes the workspace so all associated data becomes inaccessible. Requires workspace admin permission. |
| LeaveWorkspace | [LeaveWorkspaceRequest](#bytebase-v1-LeaveWorkspaceRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Removes the calling user from a workspace and switches to the next available workspace. Available to any workspace member. Fails if the caller is the last workspace admin. |
| SetIamPolicy | [SetIamPolicyRequest](#bytebase-v1-SetIamPolicyRequest) | [IamPolicy](#bytebase-v1-IamPolicy) | Sets IAM policy for the workspace. Permissions required: bb.workspaces.setIamPolicy |
-| GetMCPInfo | [GetMCPInfoRequest](#bytebase-v1-GetMCPInfoRequest) | [MCPInfo](#bytebase-v1-MCPInfo) | Gets what MCP (Model Context Protocol) does in this workspace: the capability ceiling in force, what each ceiling serves, and the per-engine facts a read-only session depends on. The workspace is resolved from the authenticated session.
+| GetMCPInfo | [GetMCPInfoRequest](#bytebase-v1-GetMCPInfoRequest) | [MCPInfo](#bytebase-v1-MCPInfo) | Gets what MCP (Model Context Protocol) does in this workspace: the capability ceiling in force, and whether masking narrows what a session reads under it. The workspace is resolved from the authenticated session.
Served to MCP sessions. An agent asking what it may do here is the point: the response says nothing a session&#39;s own denials do not already say, one refusal at a time, and knowing it up front is what stops the agent planning work the ceiling was never going to serve.
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 5adb3fcda4..4175c61588 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -3223,22 +3223,10 @@
<a href="#bytebase.v1.ListWorkspacesResponse"><span class="badge">M</span>ListWorkspacesResponse</a>
</li>
- <li>
- <a href="#bytebase.v1.MCPCapabilityMode"><span class="badge">M</span>MCPCapabilityMode</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.MCPEngineEnforcement"><span class="badge">M</span>MCPEngineEnforcement</a>
- </li>
-
<li>
<a href="#bytebase.v1.MCPInfo"><span class="badge">M</span>MCPInfo</a>
</li>
- <li>
- <a href="#bytebase.v1.MCPMethod"><span class="badge">M</span>MCPMethod</a>
- </li>
-
<li>
<a href="#bytebase.v1.RotateDirectorySyncTokenRequest"><span class="badge">M</span>RotateDirectorySyncTokenRequest</a>
</li>
@@ -3256,14 +3244,6 @@
</li>
- <li>
- <a href="#bytebase.v1.MCPEngineEnforcement.Masking"><span class="badge">E</span>MCPEngineEnforcement.Masking</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth"><span class="badge">E</span>MCPEngineEnforcement.ReadOnlyDepth</a>
- </li>
-
<li>
@@ -36731,85 +36711,8 @@ Use &#34;workspaces/-&#34; to get the current/default workspace. </p></td>
- <h3 id="bytebase.v1.MCPCapabilityMode">MCPCapabilityMode</h3>
- <p>MCPCapabilityMode is one ceiling and the method classes it serves.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>capability</td>
- <td><a href="#bytebase.v1.MCPSetting.Capability">MCPSetting.Capability</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>served_classes</td>
- <td><a href="#bytebase.v1.MCPMethodClass">MCPMethodClass</a></td>
- <td>repeated</td>
- <td><p>Empty means the ceiling serves nothing, which is what DISABLED is. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.MCPEngineEnforcement">MCPEngineEnforcement</h3>
- <p>MCPEngineEnforcement is what the read-only ceiling and the masking toggle</p><p>reach on one database engine.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>engine</td>
- <td><a href="#bytebase.v1.Engine">Engine</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>read_only_depth</td>
- <td><a href="#bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth">MCPEngineEnforcement.ReadOnlyDepth</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>masking</td>
- <td><a href="#bytebase.v1.MCPEngineEnforcement.Masking">MCPEngineEnforcement.Masking</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>note</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Where the answers above are the floor rather than the whole story. Empty
-for most engines. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
<h3 id="bytebase.v1.MCPInfo">MCPInfo</h3>
- <p>MCPInfo is what MCP does in this workspace: the ceiling in force, what each</p><p>ceiling serves, and the per-engine facts a read-only session depends on.</p><p>Everything here is resolved when the request is served, never from a stored</p><p>copy: the method list comes off the compiled API descriptors and the engine</p><p>answers off the code that enforces them, so a build whose rules changed</p><p>cannot describe the rules of the build before it.</p>
+ <p>MCPInfo is what MCP does in this workspace: the ceiling in force, and</p><p>whether masking narrows what a session reads under it.</p><p>This is the only API a served MCP session or the consent page can read the</p><p>ceiling from. SettingService/GetSetting is served by no ceiling, and its</p><p>answer is cached besides.</p>
<table class="field-table">
@@ -36831,40 +36734,11 @@ nothing to get it by. </p></td>
<td>capability</td>
<td><a href="#bytebase.v1.MCPSetting.Capability">MCPSetting.Capability</a></td>
<td></td>
- <td><p>The ceiling in force for this workspace. A value no row in modes serves,
-CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
-the stored row and every MCP connection is refused. </p></td>
- </tr>
-
- <tr>
- <td>modes</td>
- <td><a href="#bytebase.v1.MCPCapabilityMode">MCPCapabilityMode</a></td>
- <td>repeated</td>
- <td><p>What each ceiling serves, including the one in force, so an admin can
-compare the choices rather than only read the current answer. </p></td>
- </tr>
-
- <tr>
- <td>methods</td>
- <td><a href="#bytebase.v1.MCPMethod">MCPMethod</a></td>
- <td>repeated</td>
- <td><p>Every API method some ceiling serves. A mode serves a method when the
-method&#39;s class is one of that mode&#39;s served_classes, which is the ceiling
-rule the gate evaluates. Methods no ceiling serves are absent.
-
-Being listed is necessary, not sufficient. The caller still needs the
-permission, and two further rules narrow what a served method does: a
-handful of methods are refused on the shape of the request (an issue that
-would grant a permission, a rollout that skips approval), and under
-READ_ONLY every statement SQLService/Query runs must classify as a read. </p></td>
- </tr>
-
- <tr>
- <td>engines</td>
- <td><a href="#bytebase.v1.MCPEngineEnforcement">MCPEngineEnforcement</a></td>
- <td>repeated</td>
- <td><p>What a read-only session and the masking toggle actually reach, per engine.
-Both are engine-conditional in ways the ceiling alone does not show. </p></td>
+ <td><p>The ceiling in force for this workspace. Any value outside the enum this
+build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+resolved from the stored row and every MCP connection is refused. A stored
+name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+release wrote arrives verbatim. </p></td>
</tr>
<tr>
@@ -36872,9 +36746,9 @@ Both are engine-conditional in ways the ceiling alone does not show. </p></td>
<td><a href="#bool">bool</a></td>
<td></td>
<td><p>Whether this workspace stops applying the caller&#39;s own unmasking
-provisioning to MCP requests. It decides which branch of each engine&#39;s
-masking state a caller is in, and no other API tells an MCP session:
-SettingService/GetSetting is served by no ceiling. </p></td>
+provisioning to MCP requests. It narrows what a session reads only where
+Bytebase masks by column and consults exemptions; elsewhere it suppresses
+nothing. </p></td>
</tr>
<tr>
@@ -36882,71 +36756,9 @@ SettingService/GetSetting is served by no ceiling. </p></td>
<td><a href="#bool">bool</a></td>
<td></td>
<td><p>Whether data masking is licensed for this workspace. When false nothing is
-masked whatever an engine supports, so the masking states below describe a
-mechanism that does not run. Licensing can also be set per instance, so a
-true here is the workspace answer, not a promise about every instance. </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.MCPMethod">MCPMethod</h3>
- <p>MCPMethod is one API method an MCP session can reach, and what decides it.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>method</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The method as an audit entry names it, so a denial can be found by it.
-Example: /bytebase.v1.SQLService/Query </p></td>
- </tr>
-
- <tr>
- <td>operation_id</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The same method as call_api takes it.
-Example: bytebase.v1.SQLService.Query </p></td>
- </tr>
-
- <tr>
- <td>class</td>
- <td><a href="#bytebase.v1.MCPMethodClass">MCPMethodClass</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>permission</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The IAM permission the method declares. The ceiling never grants: a session
-may call a served method only where the person it acts for could.
-
-Empty means the method declares no permission, which is NOT the same as
-needing none — a method that authorizes inside its handler declares nothing
-here. auth_method says which case an empty value is. </p></td>
- </tr>
-
- <tr>
- <td>auth_method</td>
- <td><a href="#bytebase.v1.AuthMethod">AuthMethod</a></td>
- <td></td>
- <td><p>How the method authorizes. IAM means the permission above is the primary
-rule, though not always the only one — an update carrying allow_missing
-additionally requires the matching create permission. CUSTOM means the
-handler decides and the permission field is silent. </p></td>
+masked whatever an engine supports, so the toggle above suppresses nothing.
+Licensing can also be set per instance, so a true here is the workspace
+answer, not a promise about every instance. </p></td>
</tr>
</tbody>
@@ -37076,87 +36888,6 @@ Format: workspaces/{workspace} </p></td>
- <h3 id="bytebase.v1.MCPEngineEnforcement.Masking">MCPEngineEnforcement.Masking</h3>
- <p>How Bytebase masks results on this engine, which is what decides whether</p><p>ignoring masking exemptions changes anything here.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>MASKING_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>NONE</td>
- <td>1</td>
- <td><p>Bytebase does not mask on this engine. Nothing narrows what a session
-reads, and ignoring masking exemptions does nothing.</p></td>
- </tr>
-
- <tr>
- <td>COLUMN</td>
- <td>2</td>
- <td><p>Column masking. A masking policy substitutes values in query results,
-and the exemptions granted to the caller are what let them see the real
-value — which is what ignoring exemptions suppresses.</p></td>
- </tr>
-
- <tr>
- <td>DOCUMENT</td>
- <td>3</td>
- <td><p>Document masking. Results are masked, but exemptions are never consulted
-on this path, so ignoring them changes nothing here either.</p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.v1.MCPEngineEnforcement.ReadOnlyDepth">MCPEngineEnforcement.ReadOnlyDepth</h3>
- <p>How much of a read-only ceiling this engine can be held to.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>READ_ONLY_DEPTH_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>UNSUPPORTED</td>
- <td>1</td>
- <td><p>Bytebase has no read-only classifier for this engine, so a read-only
-session is refused every statement on it, including a plain SELECT.</p></td>
- </tr>
-
- <tr>
- <td>STATEMENT</td>
- <td>2</td>
- <td><p>Every statement is classified before it runs and a request holding one
-that is not a read is refused whole. Nothing below that: the driver does
-not open a read-only database session, except where the note says
-otherwise.</p></td>
- </tr>
-
- <tr>
- <td>STATEMENT_AND_SESSION</td>
- <td>3</td>
- <td><p>Statement classification, and the driver opens the database session
-read-only as well, so the engine refuses most writes the classifier
-missed. Not a proof: a statement that classifies as a read can still call
-a function that switches the session setting back off.</p></td>
- </tr>
-
- </tbody>
- </table>
-
@@ -37233,9 +36964,8 @@ Permissions required: bb.workspaces.setIamPolicy</p></td>
<td><a href="#bytebase.v1.GetMCPInfoRequest">GetMCPInfoRequest</a></td>
<td><a href="#bytebase.v1.MCPInfo">MCPInfo</a></td>
<td><p>Gets what MCP (Model Context Protocol) does in this workspace: the
-capability ceiling in force, what each ceiling serves, and the per-engine
-facts a read-only session depends on. The workspace is resolved from the
-authenticated session.
+capability ceiling in force, and whether masking narrows what a session
+reads under it. The workspace is resolved from the authenticated session.
Served to MCP sessions. An agent asking what it may do here is the point:
the response says nothing a session&#39;s own denials do not already say, one
diff --git a/proto/v1/v1/workspace_service.proto b/proto/v1/v1/workspace_service.proto
index eab858d2e1..cf9478adda 100644
--- a/proto/v1/v1/workspace_service.proto
+++ b/proto/v1/v1/workspace_service.proto
@@ -9,7 +9,6 @@ import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";
import "v1/annotation.proto";
import "v1/auth_service.proto";
-import "v1/common.proto";
import "v1/iam_policy.proto";
import "v1/setting_service.proto";
@@ -99,9 +98,8 @@ service WorkspaceService {
}
// Gets what MCP (Model Context Protocol) does in this workspace: the
- // capability ceiling in force, what each ceiling serves, and the per-engine
- // facts a read-only session depends on. The workspace is resolved from the
- // authenticated session.
+ // capability ceiling in force, and whether masking narrows what a session
+ // reads under it. The workspace is resolved from the authenticated session.
//
// Served to MCP sessions. An agent asking what it may do here is the point:
// the response says nothing a session's own denials do not already say, one
@@ -136,145 +134,43 @@ service WorkspaceService {
message GetMCPInfoRequest {}
-// MCPInfo is what MCP does in this workspace: the ceiling in force, what each
-// ceiling serves, and the per-engine facts a read-only session depends on.
+// MCPInfo is what MCP does in this workspace: the ceiling in force, and
+// whether masking narrows what a session reads under it.
//
-// Everything here is resolved when the request is served, never from a stored
-// copy: the method list comes off the compiled API descriptors and the engine
-// answers off the code that enforces them, so a build whose rules changed
-// cannot describe the rules of the build before it.
+// This is the only API a served MCP session or the consent page can read the
+// ceiling from. SettingService/GetSetting is served by no ceiling, and its
+// answer is cached besides.
message MCPInfo {
// The workspace this describes. Format: workspaces/{workspace}. Not this
// message's own resource name — MCPInfo is not a named resource and there is
// nothing to get it by.
string workspace = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
- // The ceiling in force for this workspace. A value no row in modes serves,
- // CAPABILITY_UNSPECIFIED included, means no ceiling could be resolved from
- // the stored row and every MCP connection is refused.
+ // The ceiling in force for this workspace. Any value outside the enum this
+ // build serves, CAPABILITY_UNSPECIFIED included, means no ceiling could be
+ // resolved from the stored row and every MCP connection is refused. A stored
+ // name nothing resolves arrives as CAPABILITY_UNSPECIFIED; a number a newer
+ // release wrote arrives verbatim.
MCPSetting.Capability capability = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
- // What each ceiling serves, including the one in force, so an admin can
- // compare the choices rather than only read the current answer.
- repeated MCPCapabilityMode modes = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Every API method some ceiling serves. A mode serves a method when the
- // method's class is one of that mode's served_classes, which is the ceiling
- // rule the gate evaluates. Methods no ceiling serves are absent.
- //
- // Being listed is necessary, not sufficient. The caller still needs the
- // permission, and two further rules narrow what a served method does: a
- // handful of methods are refused on the shape of the request (an issue that
- // would grant a permission, a rollout that skips approval), and under
- // READ_ONLY every statement SQLService/Query runs must classify as a read.
- repeated MCPMethod methods = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // What a read-only session and the masking toggle actually reach, per engine.
- // Both are engine-conditional in ways the ceiling alone does not show.
- repeated MCPEngineEnforcement engines = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
+ // Was the mode-contents half of this message: the serving table, the served
+ // method list, and the per-engine enforcement facts. Shipped in 3.22.0.
+ reserved 3, 4, 5;
+ reserved "modes", "methods", "engines";
// Whether this workspace stops applying the caller's own unmasking
- // provisioning to MCP requests. It decides which branch of each engine's
- // masking state a caller is in, and no other API tells an MCP session:
- // SettingService/GetSetting is served by no ceiling.
+ // provisioning to MCP requests. It narrows what a session reads only where
+ // Bytebase masks by column and consults exemptions; elsewhere it suppresses
+ // nothing.
bool ignore_masking_exemptions = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
// Whether data masking is licensed for this workspace. When false nothing is
- // masked whatever an engine supports, so the masking states below describe a
- // mechanism that does not run. Licensing can also be set per instance, so a
- // true here is the workspace answer, not a promise about every instance.
+ // masked whatever an engine supports, so the toggle above suppresses nothing.
+ // Licensing can also be set per instance, so a true here is the workspace
+ // answer, not a promise about every instance.
bool data_masking_available = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}
-// MCPCapabilityMode is one ceiling and the method classes it serves.
-message MCPCapabilityMode {
- MCPSetting.Capability capability = 1;
-
- // Empty means the ceiling serves nothing, which is what DISABLED is.
- repeated MCPMethodClass served_classes = 2;
-}
-
-// MCPMethod is one API method an MCP session can reach, and what decides it.
-message MCPMethod {
- // The method as an audit entry names it, so a denial can be found by it.
- // Example: /bytebase.v1.SQLService/Query
- string method = 1;
-
- // The same method as call_api takes it.
- // Example: bytebase.v1.SQLService.Query
- string operation_id = 4;
-
- MCPMethodClass class = 2;
-
- // The IAM permission the method declares. The ceiling never grants: a session
- // may call a served method only where the person it acts for could.
- //
- // Empty means the method declares no permission, which is NOT the same as
- // needing none — a method that authorizes inside its handler declares nothing
- // here. auth_method says which case an empty value is.
- string permission = 3;
-
- // How the method authorizes. IAM means the permission above is the primary
- // rule, though not always the only one — an update carrying allow_missing
- // additionally requires the matching create permission. CUSTOM means the
- // handler decides and the permission field is silent.
- AuthMethod auth_method = 5;
-}
-
-// MCPEngineEnforcement is what the read-only ceiling and the masking toggle
-// reach on one database engine.
-message MCPEngineEnforcement {
- // How much of a read-only ceiling this engine can be held to.
- enum ReadOnlyDepth {
- READ_ONLY_DEPTH_UNSPECIFIED = 0;
-
- // Bytebase has no read-only classifier for this engine, so a read-only
- // session is refused every statement on it, including a plain SELECT.
- UNSUPPORTED = 1;
-
- // Every statement is classified before it runs and a request holding one
- // that is not a read is refused whole. Nothing below that: the driver does
- // not open a read-only database session, except where the note says
- // otherwise.
- STATEMENT = 2;
-
- // Statement classification, and the driver opens the database session
- // read-only as well, so the engine refuses most writes the classifier
- // missed. Not a proof: a statement that classifies as a read can still call
- // a function that switches the session setting back off.
- STATEMENT_AND_SESSION = 3;
- }
-
- // How Bytebase masks results on this engine, which is what decides whether
- // ignoring masking exemptions changes anything here.
- enum Masking {
- MASKING_UNSPECIFIED = 0;
-
- // Bytebase does not mask on this engine. Nothing narrows what a session
- // reads, and ignoring masking exemptions does nothing.
- NONE = 1;
-
- // Column masking. A masking policy substitutes values in query results,
- // and the exemptions granted to the caller are what let them see the real
- // value — which is what ignoring exemptions suppresses.
- COLUMN = 2;
-
- // Document masking. Results are masked, but exemptions are never consulted
- // on this path, so ignoring them changes nothing here either.
- DOCUMENT = 3;
- }
-
- Engine engine = 1;
-
- ReadOnlyDepth read_only_depth = 2;
-
- Masking masking = 3;
-
- // Where the answers above are the floor rather than the whole story. Empty
- // for most engines.
- string note = 4;
-}
-
message RotateDirectorySyncTokenRequest {
// The workspace whose directory sync token is rotated.
// Format: workspaces/{workspace}