Decentralized Git + blockchain bounties + DAO governance via the Model Context Protocol.
57 tools, 3 prompts, 4 resource templates.
3-layer design: MCP client -> handler (internal/handler/) -> registration (cmd/server/main.go).
Key packages:
cmd/server/— entry point, server initializationinternal/handler/register.go— tool/prompt/resource registrationinternal/handler/— tool handler implementations (params structs + handler methods onToolHandler). Includes tag_handlers.go, commit_handlers.go, release_handlers.go, label_handlers.go for tags/commits/releases/labelsinternal/gitopia/— gRPC client for Gitopia chain queries and tx signinginternal/signing/— wallet management, transaction signing, fee grantsinternal/config/— configuration loading (file + env var overlay)internal/git/— local git operationsinternal/workspace/— sandboxed workspace path resolution
go build ./cmd/server # compile server binary
go test ./... # run all tests
go vet ./... # static analysis
go test -cover ./internal/handler/... # handler coverage| Variable | Purpose | Default |
|---|---|---|
GITOPIA_MNEMONIC |
BIP-39 mnemonic for signing | auto-generated if not set |
GITOPIA_GRPC_ENDPOINTS |
Comma-separated gRPC endpoints | gitopia-grpc.polkachu.com:11390 |
DRY_RUN |
true/1 to preview without broadcasting |
false |
TRUST_LEVEL |
readonly, localwrite, chainwrite |
chainwrite |
TOOLSETS |
Comma-separated toolsets (core, workflow, or all) |
all |
TRANSPORT |
stdio or http |
stdio |
PORT |
HTTP listen port (when TRANSPORT=http) | 8080 |
GITOPIA_WALLET_BACKEND |
mnemonic, keyring, file, or auto |
auto |
APPROVAL_MODE |
true/1 to require confirmation before chain-write broadcast |
false |
APPROVAL_TTL |
Duration before pending transactions expire | 5m |
MCP_CONFIG_FILE |
Path to JSON config file | ~/.mcp/gitopia/config.json |
MCP_LOG_LEVEL |
Log level (debug, info, warn, error) | info |
MCP_WORKSPACE_PATH |
Workspace root for cloned repos | ~/.mcp/gitopia/workspace |
GIT_USER_NAME |
Default git user name | Gitopia MCP Server |
GIT_USER_EMAIL |
Default git user email | mcp@gitopia.com |
- Message allowlist in
gitopia_wallet.go: only/gitopia.gitopia.gitopia.*and/cosmos.group.v1.*message types are signed - Trust tiers gate tool access (readonly < localwrite < chainwrite)
- Rate limiting on chain-write operations (default 10/min, 100/hr)
- Workspace path traversal is blocked by
workspace.Manager.ResolvePath
Handler pattern (chain-write tools):
0. Trust enforcement (withTrust wrapper checks h.TrustLvl at registration)
- Rate-limit check (
h.ChainLimiter.Allow()) - Dry-run check (
h.DryRunMode->DryRunResult()) - Get wallet (
gitopia.WalletFromHeaders()) - Validate params
- Build SDK message
- Sign & broadcast via
signOrHold()(holds for approval ifAPPROVAL_MODEis enabled) - Audit log (
AuditLog()) - Return result
Handler signature: func (h *ToolHandler) Name(ctx, req, params) (*CallToolResult, any, error)
Tool errors use toolError(msg) (sets IsError: true), not Go errors.