1
0
Fork
You've already forked codeberg-mcp
0
MCP server for Codeberg
  • Rust 100%
2026年06月12日 21:33:13 -07:00
src Init 2026年06月12日 21:23:11 -07:00
tests Fix: decode.rs test 2026年06月12日 21:33:13 -07:00
.gitignore Init 2026年06月12日 21:23:11 -07:00
Cargo.lock Init 2026年06月12日 21:23:11 -07:00
Cargo.toml Init 2026年06月12日 21:23:11 -07:00
README.md Init 2026年06月12日 21:23:11 -07:00

codeberg-mcp

An MCP server that wraps the Codeberg/Forgejo REST API (v1). Works with any MCP-compatible AI client over stdio.

Tools

Tool Requires token Description
list_my_repos yes Repos visible to the authenticated user. Filter by affiliation (owner, collaborator, admin).
list_issues no Issues on a repo. Filter by state (open/closed/all) and label names.
get_issue no Single issue by number. Set include_comments: false to skip the comment thread.
search_my_issues yes Search issues/PRs across all accessible repos by keyword and state.
create_issue yes Create an issue with title, optional body, and optional assignees.
add_comment yes Append a markdown comment to an issue.
list_pulls no Pull requests on a repo. Filter by state; paginate with page/limit.
get_pull no Single PR by number, including head/base branch refs.
list_labels no All labels on a repo, with integer IDs and hex colors.
create_label yes Create a label. color is 6 hex digits without # (e.g. "ee0701").
set_issue_labels yes Replace the full label set on an issue or PR. Pass label names; empty list clears all.
add_issue_labels yes Add labels to an issue without removing existing ones.
remove_issue_label yes Remove a single label from an issue by name.
close_issue yes Close an open issue.
reopen_issue yes Reopen a closed issue.
edit_issue yes Update an issue's title and/or body.
merge_pull yes Merge a PR. Strategy: merge, rebase, rebase-merge, or squash. Optionally delete the head branch after merge.

Label operations (set_issue_labels, add_issue_labels, remove_issue_label) resolve names to integer IDs internally — you never need to know label IDs.

Configuration

Variable Required Default Description
CODEBERG_TOKEN For writes API token. Without it, only public read tools work.
CODEBERG_BASE_URL No https://codeberg.org/api/v1 Override to point at a self-hosted Forgejo instance.

Without CODEBERG_TOKEN, the server starts but logs a warning and any tool that requires auth returns INVALID_PARAMS.

Build

cargo build --release
# binary: ./target/release/codeberg-mcp

Requires Rust edition 2024 (rustup stable ≥ 1.85).

MCP client setup

The server communicates over stdio. Add it to your MCP client config:

{
 "mcpServers": {
 "codeberg": {
 "command": "/path/to/codeberg-mcp",
 "env": {
 "CODEBERG_TOKEN": "your_token_here"
 }
 }
 }
}

For a self-hosted Forgejo instance, add "CODEBERG_BASE_URL": "https://your-forgejo.example.com/api/v1" to env.

Logging

Logs go to stderr at INFO level by default. Override with RUST_LOG:

RUST_LOG=codeberg_mcp=debug,rmcp=info codeberg-mcp

stdout is reserved for JSON-RPC frames — nothing is ever printed there.

Tests

# Unit tests (no network required)
cargo test
# Live integration tests (requires CODEBERG_TOKEN)
CODEBERG_TOKEN=... cargo test -- --ignored

License

MIT