---
title: Search GitHub code with Genie Code
description: Enable Genie Code to search public and private GitHub repositories using the native Databricks GitHub connector or a custom GitHub MCP server.
canonical_url: https://docs.databricks.com/gcp/en/genie-code/github-mcp
---

# Search GitHub code with Genie Code

Genie Code can search GitHub repositories when you connect it through the [native Databricks GitHub connector](https://docs.databricks.com/gcp/en/genie-code/github-mcp.md#native-connector) or a [custom GitHub MCP server](https://docs.databricks.com/gcp/en/genie-code/github-mcp.md#custom-mcp). Use the native connector for most cases. Private repository access requires a GitHub organization administrator to install the Databricks GitHub connector app.

## <a id="native-connector" />Use the native connector (recommended)

To connect Genie One or Genie Code to GitHub, use the Databricks third-party connector. See [Use Databricks-provided MCP connectors for third-party sources](https://docs.databricks.com/gcp/en/genie-code/mcp.md#connectors) and [Connect Genie One to external applications with MCP](https://docs.databricks.com/gcp/en/genie-one/external-sources.md). For private repositories, administrators need to [enable access](https://docs.databricks.com/gcp/en/agents/mcp-tools/connected-app-setup.md#github-private-access).

* The native connector uses the default Databricks system connection. To use a [custom GitHub MCP server](https://docs.databricks.com/gcp/en/genie-code/github-mcp.md#custom-mcp) instead, add it manually. See [Add MCP servers to Genie Code manually](https://docs.databricks.com/gcp/en/genie-code/mcp.md#add-mcp).
* To improve responses, add personal context for each repository to help GitHub search tools understand your codebase.

### <a id="private-access" />Enable private repository access

By default, the native connector can access only public repositories. To enable access to private repositories, a GitHub organization administrator must complete additional setup. See [Enable GitHub write access and private repository access](https://docs.databricks.com/gcp/en/agents/mcp-tools/connected-app-setup.md#github-private-access).

## <a id="custom-mcp" />Register a custom GitHub MCP server (not recommended)

Skip this section if your Databricks workspace already has a GitHub Unity Catalog MCP Service available for you to use. If you only need access to public repositories and your own account's information, use managed OAuth and skip to [Register a Unity Catalog connection as an MCP Service](https://docs.databricks.com/gcp/en/genie-code/github-mcp.md#connection-mcp).

Follow the steps below to register a custom GitHub MCP server as an MCP Service for your specific data and security needs. First, choose how your MCP Service authenticates:

* **Managed OAuth**: Databricks manages the GitHub OAuth app and credentials. Skip the GitHub app and client-secret steps below, then choose the managed provider when you create the connection.
* **Custom OAuth**: Create your own GitHub app and provide its credentials when you create the connection.

### Create a GitHub app (custom OAuth only)

1. Create a GitHub app. For enterprise codebases, a GitHub organization administrator must complete this step.
   * Go to **Profile > Settings > Developer settings > GitHub Apps** and click **New GitHub App**.
   * Fill in the requested fields. The **Callback URL** should be `https://<your-databricks-workspace-url>/login/oauth/http.html`. This is how GitHub authenticates with your Databricks workspace.
     * The homepage URL does not affect the MCP server and can be set to any value you prefer.
     * Clear the **Active** checkbox to make the webhook URL an optional field.
   * Grant your GitHub app the necessary permissions to access your repository and organization.
   * Click **Create GitHub App**.

2. In the newly created app, under **Client secrets**, click **Generate a new client secret**. Copy this value.

### <a id="connection-mcp" />Register a Unity Catalog connection as an MCP Service

1. Create or reuse a Unity Catalog HTTP connection for GitHub. You must have `CREATE CONNECTION` privileges on the schema to create one. If you reuse an existing connection, you must have `USE CONNECTION` on it. Continue to register that connection as an MCP Service in the next step. For a new connection, use one of the following authentication options:
   * **Managed OAuth**: Select the **OAuth User to Machine Per User** auth type and the **GitHub** OAuth provider. Databricks supplies the GitHub host, base path, and OAuth credentials.
   * **Custom OAuth**: Select the **OAuth User to Machine Per User** auth type and the **Manual configuration** OAuth provider. Enter the following values:
     * Host: `https://api.githubcopilot.com`
     * OAuth scope: The scopes of your app. For example, `mcp:access read:user user:email repo read:org`
     * Client secret and client ID: generated in the GitHub app steps above
     * Authorization endpoint: `https://github.com/login/oauth/authorize`
     * Token endpoint: `https://github.com/login/oauth/access_token`
     * Base path: `/mcp`
   * Click **Create connection**.

2. Register an MCP Service that uses the HTTP connection. For the required permissions, see [External MCP servers](https://docs.databricks.com/gcp/en/ai-gateway/register-mcp-service.md).
   * In your Databricks workspace, go to **Catalog**, select a schema, and click **Create** > **MCP Service**.
   * Enter the catalog, schema, and name for the MCP Service.
   * Select the HTTP connection you created or reused, select the tools to expose, and click **Create**.

3. If you chose per-user OAuth, [sign in to the MCP Service](https://docs.databricks.com/gcp/en/ai-gateway/mcp-service-reference.md#provider-sign-in) to authorize your GitHub account.

4. Grant users or groups `EXECUTE` on the MCP Service, plus `USE CATALOG` and `USE SCHEMA` on its parent catalog and schema. Do not grant end users `USE CONNECTION`. See [Share an MCP](https://docs.databricks.com/gcp/en/ai-gateway/govern-mcp-service.md#control-callers).

Your GitHub MCP Service is ready to use. [Add it to Genie Code](https://docs.databricks.com/gcp/en/genie-code/mcp.md#add-mcp).
