Skip to main content

Enterprise code search on Databricks Assistant via the Github MCP server

Expand the Assistant's enterprise code search capabilities by connecting to the Github MCP server.

note

MCP servers are only supported in Databricks Assistant agent mode.

Create a Github MCP server

To add a Github MCP server to the Assistant:

Skip this step if your Databricks workspace already has a Github Unity Catalog connection available for you to use.

To add a Github MCP server to the Assistant:

  1. From your Github account, create a Github app. Note: For enterprise codebases, this functionality may be limited to admins only. Reach out to your admin to complete this step for you.
    • Navigate 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.
    • Grant your Github app the necessary permissions to access your repository and organization.
    • Click Create GitHub App.
  2. In your newly created app, under Client secrets, click Generate a new client secret. Copy this value.
  3. Create a new Unity Catalog connection for Github. You must have CREATE CONNECTION privileges.
    • If your workspace already has one installed, you can use the existing one as long as you have USE CONNECTION privileges on it.
    • Fill in these fields:
      • Connection type: HTTP
      • Auth type: OAuth User to Machine
      • 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 from Step 1
      • Authorization endpoint: https://github.com/login/oauth/authorize
      • Token endpoint: https://github.com/login/oauth/access_token
      • Base path: /mcp
      • Is mcp connection: checked
    • Click Create connection
  4. In the top right corner, click Login to login to your connection. This opens a new window prompting you to authorize the Github App to your Databricks account. Click connect on the Github account you wish to connect to.

Your Github MCP is now ready to use. Follow the steps in Add MCP servers to the Assistant.

After you've connected the Github MCP server to the Assistant, you can expand the Assistant's enterprise code search capabilities with tools and custom instructions. For example, you can tell the Assistant to search in specific repositories. Follow these steps:

  1. In your Assistant settings, click Kebab menu icon. next to the Github MCP server. Manually enable the get_file_contents and search_code tools.
  2. In your Assistant instructions file, add the list of relevant repositories you want the Assistant to search through when answering questions. For example:
Enterprise Code Search: This is the list of relevant Github repositories:
- repo: my_repository, owner: bob999
- repo: hello_world_repository, owner: janedoe123