How fabianschurig/bitbucket-cli works
bitbucket-cli exposes Bitbucket Cloud operations through three user-facing products: a terminal CLI, an MCP server for agents, and a Terraform provider. The CLI and MCP workflows dispatch operations to Bitbucket; Terraform maps operations to infrastructure resources and data sources. Shared runtime layers handle request dispatch and authentication. The README documents broad generated endpoint coverage; only selected runtime paths were sampled, so uncertain internal links are omitted.
Main entry points: auth.go HTTP client · main.go MCP entry · provider.go Provider runtime · commands CLI operations
Components 22
User interfaces
- CLI entry
cmd/bb-cli/main.go - CLI operations
internal/commands
Shared API runtime
- Repo context
internal/gitcontext/gitcontext.go - Request dispatch
internal/handlers/dispatch.go - Context inference
internal/handlers/infer.go - HTTP client
internal/client/auth.go - Retry policy
internal/client/retry.go
MCP server
- MCP entry
cmd/bb-mcp/main.go - MCP configuration
internal/config/config.go - Tool registration
internal/mcptools/registry.go - Generated tools
internal/mcptools - Tool handler
internal/mcptools/handler.go - Agent prompts
internal/prompts/prompts.go
Terraform provider
- Provider entry
cmd/bb-tf/main.go - Provider runtime
internal/tfprovider/provider.go - Resources
internal/tfprovider/resource.go - Data sources
internal/tfprovider/datasource.go - Generated operations
internal/tfprovider
Other components
- Engineer
- AI agent
- Terraform user
- Bitbucket Cloud
Connections 23
- Engineer → CLI entry: runs
- CLI entry → CLI operations: registers
- CLI operations → Repo context: infers defaults
- CLI operations → Request dispatch: dispatches request
- Repo context → CLI operations: returns defaults
- Request dispatch → Context inference: infers parameters
- Request dispatch → HTTP client: executes request
- HTTP client → Retry policy: uses retries
- HTTP client → Bitbucket Cloud: sends API request
- AI agent → MCP entry: calls tools
- MCP entry → MCP configuration: loads settings
- MCP entry → Tool registration: registers tools
- Tool registration → Generated tools: registers groups
- MCP entry → Agent prompts: registers prompts
- Generated tools → Tool handler: handles tool calls
- Tool handler → Request dispatch: dispatches request
- Terraform user → Provider entry: uses provider
- Provider entry → Provider runtime: starts provider
- Provider runtime → Resources: provides resources
- Provider runtime → Data sources: provides data sources
- Provider runtime → Generated operations: uses definitions
- Resources → HTTP client: calls API runtime
- Data sources → HTTP client: calls API runtime