Available Examples
Direct Context
API-based indexing and search
FileSystem Context
Local directory search
File Search Server
REST API for code search
Prompt Enhancer Server
Context-aware prompt enhancement
GitHub Action Indexer
CI/CD repository indexing
Getting the Examples
All example code is available in the Auggie repository. To access the examples:Prerequisites
Before running the examples:- Node.js 18+ - Required to run the examples
-
Auggie CLI - Required for FileSystem Context examples
-
Authentication - Required for all examples
This creates a session file at
~/.augment/session.jsonwith your API token. Alternatively, you can set environment variables:
Setup
Install dependencies:Simple Examples
Get started quickly with these basic examples that demonstrate core SDK functionality.Direct Context
Demonstrates indexing files from any source and performing semantic searches with AI-powered question answering. Quick Start:FileSystem Context
Shows how to search a local directory using automatic file discovery via the MCP protocol. Prerequisites:- Auggie CLI must be installed and in your PATH
- Authentication via
auggie loginorAUGMENT_API_TOKENenvironment variable - A
.gitignoreor.augmentignorefile in the workspace directory to excludenode_modules/and other large directories
node_modules/), make sure you have a .gitignore or .augmentignore file that excludes them.
Quick Start:
Developer Tools
Build production-ready applications with these server examples.File Search Server
A REST API server that provides semantic file search with AI-powered summarization. Prerequisites: Auggie CLI must be installed and in your PATH. Quick Start:Prompt Enhancer Server
An HTTP server that automatically enriches user prompts with relevant codebase context. Prerequisites: Auggie CLI must be installed and in your PATH. Quick Start:CI/CD Integration
Integrate the SDK into your continuous integration workflows.GitHub Action Indexer
Automatically index your GitHub repositories with zero-question setup and incremental updates. Perfect for CI/CD workflows and keeping your codebase searchable. Key Features:- π Incremental indexing - Only processes changed files for efficiency
- πΎ Smart caching - Persists index state between runs
- π 30-second setup - From zero to running GitHub Action
- Installs a GitHub Action workflow in your repository
- Indexes your codebase automatically on every push
- Updates incrementally using GitHubβs Compare API
- Caches index state for fast subsequent runs
- Handles large repositories with optimized performance settings
- Keeping your codebase searchable and up-to-date
- CI/CD workflows that need codebase understanding
- Teams wanting automatic repository indexing
- Projects with frequent commits (incremental updates are fast)
File Search Server
Location:file-search-server/
Description: REST API for semantic file search with AI-powered summarization and code explanation.
Quick Start:
- REST API endpoints for semantic search
- AI-powered code summarization
- Real-time file indexing
- HTTP server with JSON responses
POST /search- Semantic search with optional AI summarizationGET /health- Health check endpoint
- Auggie CLI installed and in PATH
- Authentication via
auggie loginor environment variables
Prompt Enhancer Server
Location:prompt-enhancer-server/
Description: HTTP server that enhances vague prompts using AI with codebase context.
Quick Start:
- Enhances vague prompts with codebase context
- HTTP API for prompt enhancement
- AI-powered prompt improvement
- Real-time codebase analysis
POST /enhance- Enhance a prompt with codebase contextGET /health- Health check endpoint
- Improving user queries for better search results
- Building intelligent code assistance tools
- Creating context-aware development workflows
Running Examples Directly with tsx
You can also run examples directly without installing dependencies:npm install first.
Troubleshooting
MCP Timeout in FileSystem Context
Problem: The FileSystem Context example times out during indexing. Cause: The workspace directory contains too many files (e.g.,node_modules/ with 45,000+ files).
Solution: Create a .gitignore or .augmentignore file in the workspace directory to exclude large directories:
.gitignore and .augmentignore patterns and will skip excluded files during indexing.
Authentication Errors
Problem:Error: API key is required for searchAndAsk()
Cause: The SDK cannot find your authentication credentials.
Solution: Run auggie login to authenticate, or set the AUGMENT_API_TOKEN and AUGMENT_API_URL environment variables.