An MCP (Model Context Protocol) server that provides tools for interacting with Codeberg/Forgejo via the Codeberg CLI.
- Python 100%
- Add Development section with test instructions - Add Troubleshooting section for common issues - Add License section linking to zlib license - Add default config path for OpenCode - Fix license in pyproject.toml from MIT to zlib - Update prerequisite link to Codeberg CLI repo |
||
|---|---|---|
| codeberg_mcp | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
Codeberg MCP Server
An MCP (Model Context Protocol) server that provides tools for interacting with Codeberg/Forgejo via the Codeberg CLI.
Prerequisites
- Python 3.10+
- Codeberg CLI installed and authenticated
- MCP-compatible client (e.g., Claude Desktop, OpenCode)
Installation
pip install -e .
Or install dependencies directly:
pip install mcp
Usage
Running the server
# As a module
python -m codeberg_mcp.server
# Or using the entry point (after pip install -e .)
codeberg-mcp
Configuring with Claude Desktop
Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"codeberg": {
"command": "python",
"args": ["-m", "codeberg_mcp.server"],
"cwd": "/path/to/codeberg-mcp"
}
}
}
Configuring with OpenCode
Add to your OpenCode config (~/.config/opencode/config.json):
{
"mcp": {
"codeberg": {
"command": "python",
"args": ["-m", "codeberg_mcp.server"],
"cwd": "/path/to/codeberg-mcp"
}
}
}
Available Tools
User
user_info- Get authenticated user information
Repository
repo_list- List user's repositoriesrepo_info- Get repository informationrepo_clone- Clone a repositoryrepo_fork- Fork a repository
Issues
issue_list- List issues in current repositoryissue_view- View issue details (interactive)issue_create- Create a new issueissue_comment- Add comment to an issue
Pull Requests
pull_list- List pull requestspull_view- View pull request details (interactive)pull_create- Create a pull request
Labels
label_list- List repository labelslabel_create- Create a new label
Releases
release_list- List releasesrelease_create- Create a release
Milestones
milestone_list- List milestones
Notifications
notification_list- List notifications
Development
# Install with test dependencies
pip install -e ".[test]"
# Run tests
pytest
Troubleshooting
"berg CLI not found"
Install Codeberg CLI and ensure it's in your PATH.
Interactive commands return unexpected results
Commands like issue_view and pull_view use interactive selection. When run through MCP, they automatically select the first available item. To view a specific issue or PR, use issue_list or pull_list first to find the ID, then use other tools as needed.
Notes
- Most commands operate on the current repository (determined by git remote in the working directory)
- The
repo_infotool can optionally take anowner/repoargument to query any repository