MetorialDocs

Connect GitHub to your AI agents with per-user sign-in

Publish GitHub in a Metorial portal so each employee signs in with their own GitHub account, with your own OAuth app, narrowed scopes and read-only tools.

To connect GitHub, an admin shares the GitHub integration in a portal, and each employee signs in with their own GitHub account. The agent then reads and writes issues, pull requests and files as that person, with that person's repository access. You can run the sign-in through your own GitHub OAuth app and block write tools so the connection is read-only.

What you'll learn

  • How an admin publishes GitHub and how an employee connects
  • Which sign-in methods and scopes the integration offers
  • How to use your own OAuth app and make the connection read-only

Before you start

Sign-in methods

MethodTypeUse it when
GitHub.comOAuthPeople sign in at github.com. This is the default.
EnterpriseOAuthYou run GitHub Enterprise Server. Setup asks for your GitHub Enterprise URL.
Personal Access Token (GitHub.com)TokenYou want a classic or fine-grained token instead of OAuth.
Personal Access Token (Enterprise)TokenThe same, for GitHub Enterprise Server.

Admin: publish GitHub in a portal

In the dashboard

Open Shared Resources

Open Workforce, choose the portal, and select Shared Resources under Access.

Share a new integration

Select Share a Resource, then New Integration, and choose GitHub. Under Auth Method, keep GitHub.com. For how members connect, choose Each person connects, so every employee uses their own GitHub account.

Choose who gets it

Add the access groups that should see GitHub. When a person asks for access from the portal, the request appears under Access Requests.

With the CLI

The CLI cannot create the per-user GitHub integration. Once it exists, you can check which groups have it:

metorial-admin portals access list <portal-id> --type provider_template --search github

Employee: connect your GitHub account

In the portal

Open GitHub in the catalog

Sign in to your portal and open GitHub. The status reads Available.

Authenticate

Under Quick setup, select Authenticate. A GitHub tab opens. Sign in and approve the permissions listed.

Confirm

Back in the portal, the status changes to Configured, and the Setups tab shows your connection. If the status later reads Needs reconnect, select Reconnect and sign in again.

With the CLI

metorial catalog search github
metorial setup <catalog-item-id>

To connect with a token instead of OAuth, find the method's ID with metorial catalog get <catalog-item-id> and pass it as --auth-method <auth-method-id>. See Connect an app from the terminal.

Scopes

The OAuth methods use GitHub's classic OAuth scopes. The integration can request these:

repo, repo:status, public_repo, read:org, write:org, admin:org, admin:repo_hook, admin:org_hook, user, user:email, gist, notifications, workflow, read:packages, write:packages, delete:packages, project, read:project, delete_repo, security_events, read:audit_log

You narrow the list when you create your own auth credentials. The Scopes picker groups them into Read-Only Scopes, Write/Custom Scopes and Dangerous Scopes, and you can allow or reject each group or pick single scopes.

GitHub's repo scope covers both reading and writing private repositories. There is no read-only version of it for OAuth apps. To get read-only access to private repositories, either block the write tools (below) or have people connect with a fine-grained personal access token that only has read permissions.

Use your own GitHub OAuth app

With your own OAuth app, the consent screen shows your company's name, and your GitHub organization owns the app and its approvals.

Start the credentials in Metorial

In the dashboard, select Settings, then Organization Settings. Under Integrations and MCP, select Provider Auth, then Create Auth Credentials. Choose GitHub and copy the Redirect URI.

Create the OAuth app in GitHub

In GitHub, click your profile picture, then Settings, then Developer settings, then OAuth apps, and click New OAuth App. Enter an Application name and a Homepage URL. Paste the redirect URI from Metorial into Authorization callback URL. Click Register application. GitHub also lets you register the app under an organization you administer. GitHub's steps are in Creating an OAuth app.

Finish in Metorial

Copy the client ID from the app's page in GitHub and create a client secret there. Back in Metorial, enter a Name, the Client ID and the Client Secret, review Scopes, and select Create. Then pick these credentials for the GitHub integration.

Make the connection read-only

Open the integration's Tool Filters and set the write and destructive tool groups to Reject. Read tools such as get_issue, list_pull_requests and search stay available, and tools such as merge_pull_request and manage_file_content are no longer offered to any agent. Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.

Check it worked

metorial list github
metorial tools <integration-id>
metorial call <integration-id> get_user

get_user with no input returns the profile of the GitHub account you connected. If you blocked write tools, they are missing from the tools list.

Next steps