{"id":40201391,"url":"https://github.com/commoncrawl/cc-vec","last_synced_at":"2026-01-19T20:31:59.670Z","repository":{"id":314938126,"uuid":"1057378939","full_name":"commoncrawl/cc-vec","owner":"commoncrawl","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-13T00:05:33.000Z","size":155,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T03:18:51.672Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commoncrawl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-15T16:39:21.000Z","updated_at":"2026-01-13T00:05:03.000Z","dependencies_parsed_at":"2025-10-16T13:08:03.612Z","dependency_job_id":"4ecf86fd-ef42-422c-958a-4b8fc677489c","html_url":"https://github.com/commoncrawl/cc-vec","commit_stats":null,"previous_names":["raghotham/cc-vec","commoncrawl/cc-vec"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/commoncrawl/cc-vec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commoncrawl%2Fcc-vec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commoncrawl%2Fcc-vec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commoncrawl%2Fcc-vec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commoncrawl%2Fcc-vec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commoncrawl","download_url":"https://codeload.github.com/commoncrawl/cc-vec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commoncrawl%2Fcc-vec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28583839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T19:46:29.903Z","status":"ssl_error","status_checked_at":"2026-01-19T19:45:54.560Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-19T20:31:59.591Z","updated_at":"2026-01-19T20:31:59.651Z","avatar_url":"https://github.com/commoncrawl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCVec - Common Crawl to Vector Stores\n\nSearch, analyze, and index Common Crawl data into vector stores for RAG applications. Three surfaces available:\n* CLI\n* Python library\n* MCP server\n\n## Quick Start\n\n**Environment variables:**\n\n- **`ATHENA_OUTPUT_BUCKET`** - Required S3 bucket for Athena query results (needed for reliable queries to Common Crawl metadata)\n- **`AWS_ACCESS_KEY_ID`** - Required for Athena/S3 access (needed to run Athena queries)\n- **`AWS_SECRET_ACCESS_KEY`** - Required for Athena/S3 access (needed to run Athena queries)\n- **`AWS_SESSION_TOKEN`** - Optional for Athena/S3 access (needed to run Athena queries). This is required for temporary credentials\n- **`OPENAI_API_KEY`** - Required for vector operations (index, query, list)\n- `OPENAI_BASE_URL` - Optional custom OpenAI endpoint (e.g., `http://localhost:8321/v1` for Llama Stack)\n- `OPENAI_EMBEDDING_MODEL` - Embedding model to use (e.g., `text-embedding-3-small`, `ollama/nomic-embed-text:latest`)\n- `OPENAI_EMBEDDING_DIMENSIONS` - Embedding dimensions (optional, model-specific)\n- `AWS_DEFAULT_REGION` - AWS region (defaults to us-west-2)\n- `LOG_LEVEL` - Logging level (defaults to INFO)\n\n**Note:** Uses SQL wildcards (`%`) not glob patterns (`*`) for URL matching.\n\n## 1. ⌨️ Command Line\n\n```bash\n# Search Common Crawl index\nuv run cc-vec search --url-patterns \"%.github.io\" --limit 10\n\n# Get statistics\nuv run cc-vec stats --url-patterns \"%.edu\"\n\n# Fetch and process content (returns clean text)\nuv run cc-vec fetch --url-patterns \"%.example.com\" --limit 5\n\n# Advanced filtering - multiple filters can be combined\nuv run cc-vec fetch --url-patterns \"%.github.io\" --status-codes \"200,201\" --mime-types \"text/html\" --limit 10\n\n# Filter by hostname instead of pattern\nuv run cc-vec search --url-host-names \"github.io,github.com\" --limit 10\n\n# Filter by TLD for better performance (uses indexed column)\nuv run cc-vec search --url-host-tlds \"edu,gov\" --limit 20\n\n# Filter by registered domain (uses indexed column)\nuv run cc-vec search --url-host-registered-domains \"github.com,example.com\" --limit 15\n\n# Filter by URL path (for specific site sections)\nuv run cc-vec search --url-host-names \"github.io\" --url-paths \"/blog/%,/docs/%\" --limit 10\n\n# Query across multiple Common Crawl datasets\nuv run cc-vec search --url-patterns \"%.edu\" --crawl-ids \"CC-MAIN-2024-33,CC-MAIN-2024-30\" --limit 20\n\n# List available Common Crawl datasets\nuv run cc-vec list-crawls\n\n# List all available filter columns (no API keys needed)\nuv run cc-vec list-filter-columns\nuv run cc-vec list-filter-columns --output json\n\n# Vector operations (require OPENAI_API_KEY)\n# Create vector store with processed content (OpenAI handles chunking with token limits)\nuv run cc-vec index --url-patterns \"%.github.io\" --vector-store-name \"ml-research\" --limit 50 --chunk-size 800 --overlap 400\n\n# Vector store name is optional - will auto-generate if not provided\nuv run cc-vec index --url-patterns \"%.github.io\" --limit 50\n\n# List cc-vec vector stores (default - only shows stores created by cc-vec)\nuv run cc-vec list --output json\n\n# List ALL vector stores (including non-cc-vec stores)\nuv run cc-vec list --all\n\n# Query vector store by ID for RAG\nuv run cc-vec query \"What is machine learning?\" --vector-store-id \"vs-123abc\" --limit 5\n\n# Query vector store by name\nuv run cc-vec query \"Explain deep learning\" --vector-store-name \"ml-research\" --limit 3\n\n```\n\n## 1.5. Local Llama Stack Setup (Optional)\n\nRun cc-vec with local models using Ollama + Llama Stack. This provides a fully local version.\n\n**Step 1: Install and Start Ollama**\n\n```bash\n# Install Ollama (macOS/Linux)\ncurl -fsSL https://ollama.com/install.sh | sh\n\n# Start Ollama server\nollama serve \u0026\n\n# Pull required models\nollama pull llama3.2:3b                        # Inference model\nollama pull nomic-embed-text                    # Embedding model (768 dimensions)\n```\n\n**Step 2: Start ChromaDB (Optional - for persistent vector storage)**\n\nThe starter distribution uses in-memory FAISS by default. For persistent storage, run ChromaDB:\n\n```bash\n# Install and run ChromaDB\nuv run --with chromadb chroma run --host localhost --port 8000 --path ./chroma_data\n```\n\n**Step 3: Start Llama Stack**\n\n```bash\n# With explicit Ollama URL (and faiss in-memory vectory store)\nuv run --with 'llama-stack\u003e=0.4.0' llama stack run starter --port 8321 \\\n  --env OLLAMA_URL=http://localhost:11434\n\n# With ChromaDB for persistent vector storage (if running ChromaDB from Step 2)\nuv run --with 'llama-stack\u003e=0.4.0' llama stack run starter --port 8321 \\\n  --env OLLAMA_URL=http://localhost:11434 \\\n  --env CHROMADB_URL=http://localhost:8000\n```\n\nThis starts the Llama Stack server at `http://localhost:8321`.\n\n**Step 4: Use with cc-vec**\n\n```bash\n# Set environment variables\nexport OPENAI_BASE_URL=http://localhost:8321/v1\nexport OPENAI_API_KEY=none # Llama Stack doesn't require a real key\nexport OPENAI_EMBEDDING_MODEL=ollama/nomic-embed-text:latest\nexport OPENAI_EMBEDDING_DIMENSIONS=768\n\n# Set your Athena credentials\nexport ATHENA_OUTPUT_BUCKET=s3://your-bucket/\nexport AWS_ACCESS_KEY_ID=your-key\nexport AWS_SECRET_ACCESS_KEY=your-secret\n\n# Use cc-vec with local models\nuv run cc-vec index --url-patterns \"%.edu\" --limit 10\n```\n\n**Documentation:**\n- [Llama Stack Docs](https://llamastack.github.io/)\n- [Llama Stack GitHub](https://github.com/meta-llama/llama-stack)\n- [Ollama Models](https://ollama.com/library)\n- [ChromaDB Docs](https://docs.trychroma.com/)\n\n## 2. 📦 Python Library\n\n```python\nimport os\nfrom cc_vec import (\n    search,\n    stats,\n    fetch,\n    index,\n    list_vector_stores,\n    query_vector_store,\n    list_crawls,\n    FilterConfig,\n    VectorStoreConfig,\n)\n\n# For alternative endpoints, set environment variables before importing\n# Example: Using Ollama\n# os.environ[\"OPENAI_BASE_URL\"] = \"http://localhost:11434/v1\"\n# os.environ[\"OPENAI_API_KEY\"] = \"ollama\"\n# os.environ[\"OPENAI_EMBEDDING_MODEL\"] = \"ollama/nomic-embed-text:latest\"\n# os.environ[\"OPENAI_EMBEDDING_DIMENSIONS\"] = \"768\"\n\n# Example: Using Llama Stack\n# os.environ[\"OPENAI_BASE_URL\"] = \"http://localhost:8321/v1\"\n# os.environ[\"OPENAI_API_KEY\"] = \"your-llama-stack-key\"\n\n# Basic search and stats (no OpenAI key needed)\nfilter_config = FilterConfig(url_patterns=[\"%.github.io\"])\n\nstats_response = stats(filter_config)\nprint(f\"Estimated records: {stats_response.estimated_records:,}\")\nprint(f\"Estimated size: {stats_response.estimated_size_mb:.2f} MB\")\nprint(f\"Athena cost: ${stats_response.estimated_cost_usd:.4f}\")\n\nresults = search(filter_config, limit=10)\nprint(f\"Found {len(results)} URLs\")\nfor result in results[:3]:\n    print(f\"  {result.url} (Status: {result.status})\")\n\n# Advanced filtering - multiple criteria\nfilter_config = FilterConfig(\n    url_patterns=[\"%.github.io\", \"%.github.com\"],\n    url_host_names=[\"github.io\"],\n    url_host_tlds=[\"io\", \"com\"],  # Filter by TLD (uses indexed column)\n    url_host_registered_domains=[\"github.com\"],  # Filter by domain (uses indexed column)\n    url_paths=[\"/blog/%\", \"/docs/%\"],  # Filter by URL path\n    crawl_ids=[\"CC-MAIN-2024-33\", \"CC-MAIN-2024-30\"],  # Query multiple crawls\n    status_codes=[200, 201],\n    mime_types=[\"text/html\"],\n    charsets=[\"utf-8\"],\n    languages=[\"en\"],\n)\n\nresults = search(filter_config, limit=20)\nprint(f\"Found {len(results)} URLs matching filters\")\n\n# Using indexed columns for better performance\nfilter_config = FilterConfig(\n    url_host_tlds=[\"edu\", \"gov\"],  # Much faster than url_patterns=[\"%.edu\", \"%.gov\"]\n    status_codes=[200],\n)\nresults = search(filter_config, limit=50)\nprint(f\"Found {len(results)} .edu and .gov sites\")\n\n# Fetch and process content (returns clean text)\nfilter_config = FilterConfig(url_patterns=[\"%.example.com\"])\ncontent_results = fetch(filter_config, limit=2)\nprint(f\"Processed {len(content_results)} content records\")\nfor record, processed in content_results:\n    if processed:\n        print(f\"  {record.url}: {processed['word_count']} words\")\n        print(f\"    Title: {processed.get('title', 'N/A')}\")\n\n# List available Common Crawl datasets\ncrawls = list_crawls()\nprint(f\"Available crawls: {len(crawls)}\")\nprint(f\"Latest: {crawls[0]}\")\n\n# Index data in a vector store\nfilter_config = FilterConfig(url_patterns=[\"%.github.io\"])\nvector_config = VectorStoreConfig(\n    name=\"ml-research\",\n    chunk_size=800,\n    overlap=400,\n    embedding_model=\"text-embedding-3-small\",\n    embedding_dimensions=1536,\n)\n\nresult = index(filter_config, vector_config, limit=50)\nprint(f\"Created vector store: {result['vector_store_name']}\")\nprint(f\"Vector Store ID: {result['vector_store_id']}\")\nprint(f\"Processed records: {result['total_fetched']}\")\n\n# List cc-vec vector stores (default - only shows stores created by cc-vec)\nstores = list_vector_stores()\nprint(f\"Available stores: {len(stores)}\")\nfor store in stores[:3]:\n    print(f\"  {store['name']} (ID: {store['id']}, Status: {store['status']})\")\n\n# List ALL vector stores (including non-cc-vec stores)\nall_stores = list_vector_stores(cc_vec_only=False)\nprint(f\"All stores: {len(all_stores)}\")\n\n# Query vector store for RAG\nquery_results = query_vector_store(\"vs-123abc\", \"What is machine learning?\", limit=5)\nprint(f\"Query found {len(query_results.get('results', []))} relevant results\")\nfor i, result in enumerate(query_results.get(\"results\", []), 1):\n    print(f\"  {i}. Score: {result.get('score', 0):.3f}\")\n    print(f\"     Content: {result.get('content', '')[:100]}...\")\n    print(f\"     File: {result.get('file_id', 'N/A')}\")\n```\n\n\n## 3. 🔌 MCP Server (Claude Desktop)\n\n**Setup:**\n1. Copy and edit the config: `cp claude_desktop_config.json ~/Library/Application\\ Support/Claude/claude_desktop_config.json`\n2. Update the directory path and API key in the config file\n3. Restart Claude Desktop\n\nThe config uses stdio mode (required by Claude Desktop):\n```json\n{\n  \"mcpServers\": {\n    \"cc-vec\": {\n      \"command\": \"uv\",\n      \"args\": [\"run\", \"--directory\", \"your-path-to-the-repo\", \"cc-vec\", \"mcp-serve\", \"--mode\", \"stdio\"],\n      \"env\": {\n        \"ATHENA_OUTPUT_BUCKET\": \"your-athena-output-bucket\",\n        \"OPENAI_API_KEY\": \"your-openai-api-key-here\"\n        // \"OPENAI_BASE_URL\": \"http://localhost:11434/v1\"   // Optional: Use for Ollama, Llama Stack, or other endpoints\n        // \"OPENAI_EMBEDDING_MODEL\": \"ollama/nomic-embed-text:latest\"     // Optional: Specify custom embedding model\n        // \"OPENAI_EMBEDDING_DIMENSIONS\": \"768\"              // Optional: Specify embedding dimensions\n      }\n    }\n  }\n}\n```\n\n**Available MCP tools:**\n\n```\n# Search and analysis (no OpenAI key needed)\ncc_search - Search Common Crawl for URLs matching patterns with advanced filtering\ncc_stats - Get statistics and cost estimates for patterns with advanced filtering\ncc_fetch - Download actual content from matched URLs with advanced filtering\ncc_list_crawls - List available Common Crawl dataset IDs\n\n# Vector operations (require OPENAI_API_KEY)\ncc_index - Create and populate vector stores from Common Crawl content with chunking config\ncc_list_vector_stores - List OpenAI vector stores (defaults to cc-vec created only)\ncc_query - Query vector stores for relevant content\n```\n\n**Example usage in Claude Desktop:**\n- \"Use cc_search to find GitHub Pages sites: url_pattern=%.github.io, limit=10\"\n- \"Use cc_stats to analyze education sites: url_pattern=%.edu\"\n- \"Use cc_search with indexed columns for better performance: url_host_tlds=['edu', 'gov'], limit=20\"\n- \"Use cc_search with registered domains: url_host_registered_domains=['github.com'], limit=15\"\n- \"Use cc_search for specific paths: url_host_names=['github.io'], url_paths=['/blog/%'], limit=10\"\n- \"Use cc_search across multiple crawls: url_pattern=%.edu, crawl_ids=['CC-MAIN-2024-33', 'CC-MAIN-2024-30']\"\n- \"Use cc_fetch to get content: url_host_names=['github.io'], limit=5\"\n- \"Use cc_list_crawls to show available Common Crawl datasets\"\n- \"Use cc_index to create vector store: vector_store_name=research, url_pattern=%.arxiv.org, limit=100, chunk_size=800\"\n- \"Use cc_list_vector_stores to show cc-vec stores (default)\"\n- \"Use cc_list_vector_stores with cc_vec_only=false to show all vector stores\"\n- \"Use cc_query to search: vector_store_id=vs-123, query=machine learning\"\n\n**Note:** All filter options available in CLI (shown via `cc-vec list-filter-columns`) are also available in MCP tools.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommoncrawl%2Fcc-vec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommoncrawl%2Fcc-vec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommoncrawl%2Fcc-vec/lists"}