-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Get Fold running in minutes. Choose your path: Docker (recommended) or local development.
- Docker and Docker Compose installed
- At least one LLM API key (Gemini free tier is recommended)
- 2GB+ free disk space
- Rust 1.75+ (install)
- SQLite 3 (usually pre-installed)
- Docker (for Qdrant only)
- At least one LLM API key
git clone https://github.com/Generation-One/fold.git
cd fold# Copy the example
cp .env.example .env
# Edit .env with your settings
nano .env # or use your favorite editorMinimally, you need:
# Required
ADMIN_BOOTSTRAP_TOKEN=your-secret-admin-token-change-this
# LLM Provider (pick at least one)
GOOGLE_API_KEY=your-gemini-api-key # Free tier available
# OPENROUTER_API_KEY=your-openrouter-key
# OPENAI_API_KEY=your-openai-key
# Optional: Auth Provider (skip for local dev)
# AUTH_PROVIDER_GOOGLE_TYPE=oidc
# AUTH_PROVIDER_GOOGLE_DISPLAY_NAME=Google
# ... etc (see Configuration section)Getting API keys:
- Gemini (free): https://aistudio.google.com/app/apikey
- OpenRouter (has free models): https://openrouter.ai/
- OpenAI: https://platform.openai.com/api-keys
docker-compose up -d
docker-compose logs -f fold # View logs
curl http://localhost:8765/health # Check healthServices start on:
- Fold:
http://localhost:8765 - Qdrant:
http://localhost:6333(REST),http://localhost:6334(gRPC)
# Bootstrap the first admin
curl -X POST http://localhost:8765/auth/bootstrap \
-H "Content-Type: application/json" \
-d '{
"token": "your-secret-admin-token-from-.env",
"provider": "google", # or whichever you configured
"subject": "admin@example.com" # Email or ID from your provider
}'
# Response: { "user_id": "user_123", "role": "admin", ... }# Create an API token for API/MCP access
curl -X POST http://localhost:8765/me/tokens \
-H "Authorization: Bearer $SESSION_COOKIE" \
-H "Content-Type: application/json" \
-d '{
"name": "my-api-token",
"projects": [] # Empty = access all your projects
}'
# Response includes: { "token": "fold_abc123...", ... }Save this token—you'll need it for API calls and MCP setup.
For development or if you want to avoid Docker.
git clone https://github.com/Generation-One/fold.git
cd fold/srv # Navigate to the Rust servercp .env.example .env
nano .envSet at minimum:
ADMIN_BOOTSTRAP_TOKEN=your-secret-token
GOOGLE_API_KEY=your-gemini-key
DATABASE_PATH=./data/fold.db
QDRANT_URL=http://localhost:6334# In one terminal, start just Qdrant
docker run -p 6334:6334 qdrant/qdrant# In another terminal
cargo run
# Or with auto-reload (requires `cargo install cargo-watch`)
cargo watch -x runServer runs at http://localhost:8765.
Same as Docker setup (Step 4-5 above).
A React-based web interface is available at fold-ui.
git clone https://github.com/Generation-One/fold-ui.git
cd fold-ui
# With Docker Compose
docker-compose up -d
# Or local development
npm install && npm run devOpens at http://localhost:5174
Get a GitHub personal access token: https://github.com/settings/tokens
# Create a project first
curl -X POST http://localhost:8765/projects \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Project",
"slug": "my-project",
"description": "My awesome project"
}'
# Response includes: { "id": "proj_abc123" }curl -X POST http://localhost:8765/projects/proj_abc123/repositories \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider": "github",
"owner": "your-username",
"repo": "your-repo-name",
"branch": "main",
"access_token": "ghp_your_github_token",
"history": {
"enabled": true,
"mode": "days",
"value": 7 # Index last 7 days
}
}'Fold will:
- Clone and index all files from that branch
- Generate semantic summaries for existing commits
- Register a webhook to auto-index future pushes
# Try a semantic search
curl -X POST http://localhost:8765/projects/proj_abc123/search \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "How do we handle authentication?",
"limit": 5
}'You should get back related code files, commits, and any decisions/sessions about authentication.
Once Fold is running with your repos indexed, connect it to Claude Code for AI-assisted development.
You already created one above. If not:
curl -X POST http://localhost:8765/me/tokens \
-H "Authorization: Bearer $SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "claude-code", "projects": []}'Option A: Via CLI (recommended)
claude mcp add -t http -s user fold http://localhost:8765/mcp \
--header "Authorization: Bearer fold_YOUR_TOKEN_HERE"Option B: Manual Config
Edit ~/.claude/settings.json:
{
"mcpServers": {
"fold": {
"url": "http://localhost:8765/mcp",
"headers": {
"Authorization": "Bearer fold_YOUR_TOKEN_HERE"
}
}
}
}Then restart Claude Code.
Now you can ask Claude questions about your codebase:
Claude: Search for authentication patterns
→ Uses Fold MCP tools
→ Finds related code + decisions + sessions
→ Understands your architecture
Claude: Implement a user export feature
→ Searches Fold for existing export patterns
→ Gets your architectural decisions
→ Writes code matching your style
Check that everything is working:
# Health check
curl http://localhost:8765/health
# Response: { "status": "healthy" }
# Check Qdrant connection
curl http://localhost:6333/health
# Response: { "status": "ok" }
# List projects (requires auth)
curl http://localhost:8765/projects \
-H "Authorization: Bearer YOUR_API_TOKEN"If 8765 is taken:
# Docker: Edit docker-compose.yml
# Change "8765:8765" to "9000:8765"
# Local: Edit .env
PORT=9000# Make sure Qdrant is running
docker ps | grep qdrant
# If not, start it
docker run -p 6334:6334 qdrant/qdrant# Check if database file exists
ls -la data/fold.db
# If corrupted, backup and delete
mv data/fold.db data/fold.db.bak
# Fold will create a new database on next run
# Apply migrations manually
# (Usually happens automatically)# Verify your token works
curl http://localhost:8765/auth/me \
-H "Authorization: Bearer fold_YOUR_TOKEN"
# If 401, token is invalid or expired
# Create a new one using the bootstrap admin- Configuration — Configure auth providers, LLM fallback, git webhooks
- Core-Concepts — Understand memories, vectors, and the graph
- API-Reference — Full REST API documentation
- MCP-Tools-Reference — Use Fold with Claude Code and other AI agents