# Claude Code

> Add Githome's MCP server to Claude Code with one command, sign in from /mcp, and let Claude push branches and open pull requests on Githome.

Source: https://git.pkgforge.dev/docs/connect/claude-code

Claude Code connects to Githome through its MCP server at `https://git.pkgforge.dev/mcp`. Together with the `githome` CLI, Claude can then push a branch, open a pull request and merge it, without leaving the terminal. Githome ships no Claude Code plugin: the MCP server is the whole connection.

## 1. Install the CLI

The CLI gives Claude git access and the pull request commands. It needs Node.js 26 or later, and installs a private copy of the Node.js 26 LTS when the machine has none:

```sh
curl -fsSL https://git.pkgforge.dev/install | bash
githome setup
```

On Windows, in PowerShell: `powershell -c "irm https://git.pkgforge.dev/install.ps1 | iex"`, then `githome setup`. It opens your browser to sign in (on a machine without one it shows a code to enter instead), runs `githome auth setup-git` so git pushes and pulls with the same sign-in, and signs in `gh` when you have it. You can also ask Claude Code to run both lines: it gives you the link or code, and you click **Authorize**. See [Install and sign in to the CLI](https://git.pkgforge.dev/docs/accounts/cli-sign-in).

## 2. Add the MCP server

```sh
claude mcp add --scope user --transport http githome https://git.pkgforge.dev/mcp
```

With `--scope user` the server is available in every project on your machine. Leave the flag out to keep it to the current project.

To share it with everyone working on a repository, commit it in the repository's `.mcp.json`; each person signs in with their own account:

```json
{ "mcpServers": { "githome": { "type": "http", "url": "https://git.pkgforge.dev/mcp" } } }
```

## 3. Sign in

1. In Claude Code, run `/mcp`, select **githome** and choose **Authenticate**.
2. Your browser opens Githome's consent page. Choose whom Claude Code acts as and its access, then choose **Connect**.
3. Back in the terminal, `/mcp` shows the server as connected.

![Githome's consent page for Claude Code: "Connect Claude Code to Githome", an app published by claude.ai that sends you back to an app on this computer, with Act as set to the agent ada-bot and Write access selected, and the Connect and Cancel buttons.](https://git.pkgforge.dev/docs/images/consent-claude-code.webp)

On a machine without a browser, run `claude mcp login githome --no-browser`, open the printed link on any device, and paste the address you land on back into the terminal.

> [!TIP]
> Act as one of your [agents](https://git.pkgforge.dev/docs/agents/overview). Claude Code's commits, comments and pull requests then show as the agent's, and they wait for a person's approval before they land.

## Check that it works

```sh
claude mcp list
```

`githome` shows **Connected** (before you sign in it shows **Needs authentication**). Then try it:

```sh
claude -p "Who am I on Githome?"
```

The `whoami` tool answers with the account you picked on the consent page.

## Pull requests from the terminal

With the CLI installed, Claude Code works through the usual loop on its own:

```sh
git push -u origin my-branch
githome pr create --title "Fix the login redirect" --intent "Sign-in should return people to the page they came from"
githome pr merge --auto --squash
```

The pull request commands use the current branch's pull request when you leave out the number. `githome pr checks --watch` waits for a branch's checks and `githome run logs <job-id>` reads the log of a failed job, on a deployment where CI runs; the forge CI of git.pkgforge.dev is dormant, so no workflow runs there now.

To let Claude use `gh` as it would on GitHub, and to see the branch's pull request in Claude Code's footer and the desktop app, sign gh in to Githome once. `githome setup` in step 1 did this if gh was installed then; otherwise run:

```sh
githome auth setup-gh
```

See [GitHub CLI](https://git.pkgforge.dev/docs/agents/github-cli) for what works with `gh`.

## Headless: CI and cloud sessions

Where nobody can approve a browser sign-in, give Claude Code an [agent's token](https://git.pkgforge.dev/docs/agents/overview) in `GITHOME_TOKEN` and add a server that sends it:

```sh
claude mcp add --scope user --transport http githome https://git.pkgforge.dev/mcp \
  --header 'Authorization: Bearer ${GITHOME_TOKEN}'
```

Keep the single quotes: Claude Code reads `${GITHOME_TOKEN}` from the environment each time it connects, so the token is never written to its settings. A token and the browser sign-in can't share one server entry: with the header set, Claude Code doesn't fall back to OAuth. The CLI and `githome auth setup-git` read `GITHOME_TOKEN` too. For Claude Code on the web, set up the environment from the repository's [Agent setup](https://git.pkgforge.dev/docs/connect/cloud-agents). More in [Headless use](https://git.pkgforge.dev/docs/connect/how-sign-in-works#headless-use).

## Troubleshooting

| Problem | What to do |
| --- | --- |
| `claude mcp list` doesn't show `githome` | Run the `claude mcp add` command of step 2 again. A server added without `--scope user` belongs to the project you ran it in. |
| `/mcp` shows the server as needing authentication | Choose **Authenticate**, or run `claude mcp login githome`. |
| The browser says "Can't connect this app" | Remove the server with `claude mcp remove githome` and add it again, then sign in. |
| A tool says it needs the write scope | You connected with **Read**. Disconnect Claude Code under **Settings → Access tokens → Connected apps** and sign in again with **Write**. |
| `git push` to `main` fails with "agents may not push to protected or default branches" | Claude Code acts as an agent: push a branch and open a pull request. |
| `/mcp` shows the server but every call answers `401` | The server entry has an `Authorization` header with an old or empty `GITHOME_TOKEN`. Set the variable to a current token, or remove the header to use the browser sign-in. |
