connect_repo
The CodePanel MCP tool that connects a GitHub repository and installs the webhook that starts a review on each new pull request.
On this page›
connect_repo connects a GitHub repository to CodePanel and installs the webhook that starts a review on each new pull request. It takes one input, repo, needs the repos:write scope, and needs admin rights on the repository. A repository that is not connected is never reviewed, so this comes before everything else in the setup.
When to call it
- Once per repository, after
list_connectable_reposshowscanInstallWebhook: truefor it. - To bring a disconnected repository back. Connecting again reuses your own earlier row for that repository, with its settings, rather than adding a second one.
- Only when the person asked. Connecting installs a webhook on their GitHub repository.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
repo |
string | yes | Repository as owner/name |
It writes: the server marks it readOnlyHint: false, so a client that asks before writes asks here.
repo must look like owner/name. Anything else is refused before any GitHub call. GitHub, not your call, supplies the repository id and default branch, so a made-up id cannot be claimed. A repository another CodePanel account already has live, with a working hook, blocks the connect.
The errors your agent can hit:
CodePanel: Repository not found, or your GitHub account cannot access it.
CodePanel: GitHub token not found. Sign out and sign in again.
The first means GitHub does not show the repository to the signed-in account, or the account is not an admin of it. The second means CodePanel holds no usable GitHub sign-in, which a person fixes in the browser.
What it returns
| Field | Meaning |
|---|---|
repoId |
CodePanel's id for the connected repository |
fullName |
The name as GitHub spells it |
webhookInstalled |
true. If the hook cannot be installed, the call errors and a repository that was not live before is left inactive |
nextSteps |
A list of strings. Empty once the default branch has both .codepanel/rules.md and a CodePanel section in AGENTS.md or CLAUDE.md. Otherwise one entry says how to add the missing ones in a single pull request, and to ask the owner first if they did not ask for setup |
A file GitHub could not read counts as missing. nextSteps is advice for your agent: it is not done for you, and opening that pull request is a separate task for the person to approve. A new connection starts with autoReview on and maxAutoRounds at 3. Reconnecting a repository you disconnected keeps the settings it had. Check them with list_repos, and change them with update_repo_settings.
Examples
A local test backend has no GitHub access, so there is no success result to show. This is what a caller sees when CodePanel holds no GitHub sign-in for the account:
{ "repo": "codepanel-dev/mobile-app" }
CodePanel: GitHub token not found. Sign out and sign in again.
Connecting a repository that is already connected (codepanel-dev/web-app) reaches the same check first and fails the same way here, so this backend cannot show the already-connected case. A successful call returns the four fields in the table above.
The same step without MCP
| Surface | Form |
|---|---|
| CLI | codepanel repos connect <owner/name> (CLI) |
| HTTP API | POST /repos/connect with {"repo":"owner/name"} |
What the server tells your agent
The description your agent reads when it lists the tools:
Connect a GitHub repository and install CodePanel's webhook so new pull requests are reviewed. When the repository has no .codepanel/rules.md or no CodePanel section in AGENTS.md or CLAUDE.md, nextSteps says how to add them in one pull request.
Related
list_connectable_repos: find the name and check admin first.disconnect_repo: stop reviewing it again.update_repo_settings: the next step, round limits and the gate.- Repository setup: the pull request
nextStepspoints to. - MCP server: the full setup sequence.