Skip to content

Instantly share code, notes, and snippets.

@rafaeltuelho
Created February 12, 2026 00:08
Show Gist options
  • Select an option

  • Save rafaeltuelho/bdec6b7d71b78b2498ed77945a1053c3 to your computer and use it in GitHub Desktop.

Select an option

Save rafaeltuelho/bdec6b7d71b78b2498ed77945a1053c3 to your computer and use it in GitHub Desktop.
Custom Auggie command to index and setup Context Connectors MCP
description argument-hint
Index GitHub repos with Augment Context Connectors and generate MCP server config
org/repo1#main, org/repo2#develop, org/repo3#v1.0

You are setting up Augment Context Connectors to index multiple GitHub repositories and configure an MCP server for cross-repo semantic search.

Step 1: Gather User Input

If $ARGUMENTS is empty or not provided, ask the user for:

  1. A comma-separated list of repos in the format org_name/repo_name#ref_name (e.g., myorg/service-auth#main, myorg/service-payments#develop)
  2. A GitHub Personal Access Token (PAT) with repo scope

If $ARGUMENTS is provided, use it as the repo list and ask only for the GitHub PAT.

Step 2: Parse the Repo List

Parse each entry from the comma-separated list into a tuple: (org_name, repo_name, ref_name).

For example, given: myorg/service-auth#main, myorg/service-payments#develop

Parse into:

  • org_name=myorg, repo_name=service-auth, ref_name=main
  • org_name=myorg, repo_name=service-payments, ref_name=develop

Derive the index name for each repo by joining org and repo with underscore: org_name_repo_name (e.g., myorg_service-auth).

Step 3: Index Each Repository

For each parsed repo, run the following command:

export GITHUB_TOKEN='<github-pat>' && npx @augmentcode/context-connectors index github \
  --owner <org_name> \
  --repo <repo_name> \
  --ref <ref_name> \
  --index <org_name>_<repo_name> \
  --store filesystem

Run these commands sequentially (one at a time), and report success/failure for each repo before moving to the next.

Step 4: Extract Augment Token

Run this command and capture its output:

auggie token print

The output will contain a line like:

SESSION={"accessToken":"...","tenantURL":"https://...","scopes":["read","write"]}

Parse the JSON from the SESSION= line to extract:

  • accessToken — the Augment API token
  • tenantURL — the Augment API URL

Step 5: Display MCP Configuration

Using all the collected values, display the following MCP server configuration snippet for the user to add to their ~/.augment/settings.json file:

{
  "mcpServers": {
    "Augment Context Connectors": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@augmentcode/context-connectors",
        "mcp",
        "stdio",
        "--index <index_name_1> <index_name_2> <index_name_n>"
      ],
      "env": {
        "AUGMENT_API_TOKEN": "<accessToken>",
        "AUGMENT_API_URL": "<tenantURL>",
        "GITHUB_TOKEN": "<github-pat>"
      }
    }
  }
}

NOTES:

  • the --index argument receives a list of index names separated by space (NOT commas). It is a one single param followed by the indexes names.
  • <index_name_1> <index_name_2> <index_name_n> corresponds to the list of indexed repos (using the org_name_repo_name pattern)
  • <accessToken> and <tenantURL> come from Step 4
  • <github-pat> is the GitHub PAT provided in Step 1

Step 6: Summary

After displaying the config, provide a summary:

  1. List all repos that were successfully indexed
  2. List any repos that failed to index (if any)
  3. Remind the user to:
    • Copy the JSON snippet into ~/.augment/settings.json (merge with existing config if needed)
    • Restart Auggie CLI or their IDE to pick up the new MCP server
    • The context-connectors MCP server will now allow semantic search across all indexed repos without naming them explicitly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment