# Glacier Grep

> High-performance, zero-allocation, SIMD-accelerated C# search engine and index for .NET 10 with MCP support.

- **Type:** MCP server
- **Install:** `agentstack add mcp-ian-cowley-glacier-grep`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ian-cowley](https://agentstack.voostack.com/s/ian-cowley)
- **Installs:** 0
- **Category:** [Search](https://agentstack.voostack.com/c/search)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ian-cowley](https://github.com/ian-cowley)
- **Source:** https://github.com/ian-cowley/Glacier.Grep

## Install

```sh
agentstack add mcp-ian-cowley-glacier-grep
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Glacier.Grep

[](https://www.nuget.org/packages/Glacier.Grep/)
[](https://www.nuget.org/packages/Glacier.Grep/)

**Glacier.Grep** is a native, high-performance, zero-allocation C# search engine and index for .NET 10. Built to take on `ripgrep` within the Glacier ecosystem, it provides aggressive hardware acceleration (SIMD), concurrent work-stealing directory scanning, and built-in support for the Model Context Protocol (MCP).

---

## Key Features

*   🚀 **SIMD-Accelerated Hot Path**: Utilizes hardware-accelerated set searching via .NET 10 `SearchValues` and auto-vectorized scanning on raw UTF-8 bytes without string conversions.
*   📂 **Lock-Free Directory Enumeration**: Implements custom `FileSystemEnumerable` checking which evaluates file metadata (hidden status, symlinks) and ignore matches entirely on the stack before materializing path strings.
*   ⚙️ **Advanced Ignore File Support**: Evaluates rules from `.gitignore`, `.ignore`, and `.rgignore` hierarchically, matching `ripgrep`'s prioritized exclusion behavior.
*   ⚡ **Hybrid I/O Dispatcher**: Automatically routes files based on size (using zero-copy Memory-Mapped Files for >1MB and RandomAccess read into `ArrayPool` for )` for zero heap allocation searches.
*   🤖 **MCP Server Support**: Built-in support for the Model Context Protocol, allowing seamless integration with AI agents and tools.

---

## Installation

To build and run Glacier.Grep, clone this repository and build using .NET 10 CLI:

```bash
dotnet build src/Glacier.Grep.Host/Glacier.Grep.Host.csproj -c Release
```

---

## Quick Start (CLI Mode)

You can run Glacier.Grep directly from the command line:

```bash
# Basic literal search
dotnet run --project src/Glacier.Grep.Host/Glacier.Grep.Host.csproj "public class"

# Case-sensitive search with 2 lines of context in a specific directory
dotnet run --project src/Glacier.Grep.Host/Glacier.Grep.Host.csproj "public class" --dir "C:\src\myproject" --sensitive --context 2

# Regex search restricted to C# files
dotnet run --project src/Glacier.Grep.Host/Glacier.Grep.Host.csproj "void\s+\w+Async" --regex --globs "*.cs"

# Search hidden files, binary files, and invert the match (lines NOT containing "Oranges")
dotnet run --project src/Glacier.Grep.Host/Glacier.Grep.Host.csproj "Oranges" --hidden --text --invert

# Limit search depth to 2 directories
dotnet run --project src/Glacier.Grep.Host/Glacier.Grep.Host.csproj "target" --max-depth 2
```

---

## MCP Server Setup

Glacier.Grep includes a built-in MCP (Model Context Protocol) server host, allowing you to use your search engine as a tool for AI agents (like Claude or Antigravity).

### 1. Build the Server
Build the host application in Release mode:

```bash
dotnet build src/Glacier.Grep.Host/Glacier.Grep.Host.csproj -c Release
```

### 2. Configure Your Client
Add the following entry to your `mcp_config.json`:

```json
{
  "mcpServers": {
    "glacier-grep": {
      "command": "dotnet",
      "args": [
        "ABS_PATH_TO_REPO/src/Glacier.Grep.Host/bin/Release/net10.0/Glacier.Grep.Host.dll"
      ]
    }
  }
}
```

### 3. Available Tools

- **`search_grep`**: Performs a high-performance search across files in a directory.
  - `query` (string, required): The search query (literal or regex).
  - `path` (string, optional): Base directory to search.
  - `isRegex` (boolean, optional): Treat query as regular expression.
  - `caseSensitive` (boolean, optional): Perform case-sensitive match.
  - `contextLines` (integer, optional): Lines of context to include around matches.
  - `fileGlobs` (array of strings, optional): Filter files (e.g. `["*.cs"]`).
  - `searchHidden` (boolean, optional): Search hidden files and folders.
  - `searchBinary` (boolean, optional): Search binary files (do not skip).
  - `invertMatch` (boolean, optional): Invert the match (show lines that do NOT contain the query).
  - `maxDepth` (integer, optional): Maximum recursion depth for subdirectories.

---

## Performance

Glacier.Grep is aggressively optimized for .NET 10 to saturate memory bandwidth, performing within ~1.2x of Ripgrep's raw Rust execution speed on typical developer workloads, and even outperforming it on case-sensitive paths.

### Benchmark (Searching the entire Glacier/PolarsPlus workspace)
- **Target**: 590 files, 257.83 MB
- **OS/Hardware**: Windows (x64), modern multi-core CPU

| Engine | Query | Execution Time (Warmed) | Performance Ratio |
| :--- | :--- | :--- | :--- |
| **Ripgrep (Rust)** | `"public class"` (Sensitive) | 134.9 ms | 1.12x |
| **Glacier.Grep (.NET 10)** | `"public class"` (Sensitive) | **120.4 ms** | **1.00x (FASTER)** |
| **Ripgrep (Rust)** | `"public class"` (Insensitive) | 137.9 ms | 1.00x |
| **Glacier.Grep (.NET 10)** | `"public class"` (Insensitive) | **210.4 ms** | **1.52x** (improved from 1.7x) |
| **Ripgrep (Rust)** | `"ThreadIndependentReaderWriterLock"` (Insensitive) | 115.7 ms | 1.00x |
| **Glacier.Grep (.NET 10)** | `"ThreadIndependentReaderWriterLock"` (Insensitive) | **142.3 ms** | **1.23x** (improved from 1.7x) |

---

## Architecture

1.  **Directory Traverser**: Zero-allocation metadata filtration. Prunes ignored folders (like `.git`, `node_modules`, `bin/`) and applies `.gitignore`, `.ignore`, and `.rgignore` rules.
2.  **Hybrid I/O Dispatcher**: Chooses the fastest reading technique depending on file size.
3.  **Search Core**: Evaluates the bytes using `ReadOnlySpan` and JIT vectorization.
4.  **MCP Integration**: Integrates the search capabilities over standard stdio JSON-RPC.

---

## Credits

Developed by **Ian Cowley** and **Antigravity (Google DeepMind)**.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ian-cowley](https://github.com/ian-cowley)
- **Source:** [ian-cowley/Glacier.Grep](https://github.com/ian-cowley/Glacier.Grep)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-ian-cowley-glacier-grep
- Seller: https://agentstack.voostack.com/s/ian-cowley
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
