feat(mcp): let MCP sessions turn just-in-time access on or off, and revoke access grants by vsai12 · Pull Request #21626 · bytebase/bytebase · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions backend/api/auth/mcp_confirmation.go
10 changes: 7 additions & 3 deletions backend/api/mcp/openapi_index_refused_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ func TestRefusedEndpointsAreNotAdvertised(t *testing.T) {
})

t.Run("a service keeps only the methods a ceiling serves", func(t *testing.T) {
// ProjectService is the mixed case. Its reads are served; its writes
// administer the workspace and TestWebhook posts to a third party, so
// those stay refused and stay unadvertised.
// ProjectService is the mixed case. Its reads are served. UpdateProject
// is WRITE, served only through set_just_in_time_access; it stays
// advertised, like ApproveIssue, so an agent that calls it meets the
// gate's denial naming that tool. Its other writes administer the
// workspace and TestWebhook posts to a third party, so those stay
// refused and unadvertised.
var served []string
for _, ep := range idx.GetServiceEndpoints("ProjectService") {
served = append(served, ep.OperationID)
Expand All @@ -66,6 +69,7 @@ func TestRefusedEndpointsAreNotAdvertised(t *testing.T) {
"bytebase.v1.ProjectService.BatchGetProjects",
"bytebase.v1.ProjectService.SearchProjects",
"bytebase.v1.ProjectService.GetIamPolicy",
"bytebase.v1.ProjectService.UpdateProject",
}, served)
require.Contains(t, idx.Services(), "ProjectService")
})
Expand Down
1 change: 1 addition & 0 deletions backend/api/mcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (s *Server) registerTools() {
s.registerSchemaTool()
s.registerChangeTool()
s.registerDecideIssueTool()
s.registerSetJustInTimeAccessTool()
s.registerReauthorizeTool()
}

Expand Down
198 changes: 198 additions & 0 deletions backend/api/mcp/tool_confirm.go
Loading
Loading