glean-powershell
glean-powershell is a complete, idiomatic PowerShell client for the published Glean REST APIs (the Client API and the Indexing API) generated from the gleanwork/open-api specification 1. The module is generated from the OpenAPI specs by a deterministic Python generator and layered over a small hand-written runtime, so it can be regenerated whenever the spec changes. It provides 111 operations (68 client + 43 indexing) as typed cmdlets, a robust authentication system supporting both API tokens and browser-based SSO, and an MCP server for integration with AI tools like Claude Code.
| Subsystem | Description |
|---|---|
| Python Generator | Deterministic code generator that maps OpenAPI specs to PowerShell cmdlets, parameters, and types. |
| OpenAPI Specs | Pinned REST API specifications for the Client and Indexing APIs, vendored in generator/specs/. |
| PowerShell Module | The importable module containing 111 generated cmdlets and a hand-written runtime for HTTP, auth, and retry logic. |
| Authentication Runtime | Handles API token and Cookie/SSO modes, storing credentials encrypted with owner-only permissions. |
| MCP Server | A PowerShell-based server exposing Glean as tools to MCP hosts like Claude Code, speaking JSON-RPC 2.0 over stdio. |
| PowerShell Hosts | End-user environments (PowerShell 7.2+) where the module is imported and cmdlets are executed. |
README.md L1-120 (showing 40 of 120)
# Glean PowerShell Module
A complete, idiomatic PowerShell client for the **published Glean REST APIs** (the Client
API and the Indexing API) from the
[`gleanwork/open-api`](https://github.com/gleanwork/open-api) specification: **111 operations**
(68 client + 43 indexing), every published operation except the one the upstream overlay marks
for removal. Glean ships official SDKs for Python, TypeScript, Java, and Go; this fills the
PowerShell gap.
The module is **generated** from the OpenAPI specs by a deterministic Python generator and
layered over a small hand-written runtime, so it can be regenerated whenever the spec
changes. A data-driven test suite proves the generated surface matches the spec by contract
(parameters, required flags, media types, HTTP method/path/body), not just by file count.
## Getting started
### 1. Prerequisites
PowerShell 7.2 or newer (`pwsh`). Check with `pwsh -v`. If you do not have it:
- Windows: `winget install Microsoft.PowerShell`
- macOS: `brew install --cask powershell`
- Linux: see https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-linux
### 2. Install the module
Pick one.
**From a release package (for end users).** Download `Glean-<version>.zip` and `SHA256SUMS`, then:
```powershell
pwsh ./install.ps1 -PackagePath ./Glean-<version>.zip # verifies the SHA256, then installs
```
This installs into your user module path so `Import-Module Glean` works from any session. Add
`-RegisterMcp` to also wire up the MCP server for Claude Code.
**From source (for development).** Run the test suite and import in place:
```bash