# gitwhy

The shared AI context engine for git — save, search, and share the reasoning behind code changes. Captures the why behind every commit and slide on PRs for coding agents.

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add gitwhy-cli/gitwhy

# Browse available tools
npx -y @smithery/cli@latest tool list gitwhy-cli/gitwhy

# Get full schema for a tool
npx -y @smithery/cli@latest tool get gitwhy-cli/gitwhy gitwhy_get

# Call a tool
npx -y @smithery/cli@latest tool call gitwhy-cli/gitwhy gitwhy_get '{}'
```

## Direct MCP Connection

Endpoint: `https://gitwhy--gitwhy-cli.run.tools`

**Required config:**
- `GITWHY_API_KEY` (header) — Your GitWhy API key. Get one at https://app.gitwhy.dev/dashboard/api-keys

## Tools (8)

- `gitwhy_get` — Retrieve a saved context by its ID. Returns the full markdown content including metadata, reasoning, and file changes. …
- `gitwhy_list` — Browse saved contexts and the domain/topic tree structure. Use to discover what contexts exist in this repo. Call with …
- `gitwhy_post_pr` — Post or update a GitHub PR comment summarizing the development context for linked commits. Use when the developer wants…
- `gitwhy_publish` — Make synced contexts visible to the team (shared). Auto-syncs to cloud if not already synced. Use when the developer wa…
- `gitwhy_save` — Save development context (reasoning, decisions, trade-offs) for the current coding session. Use after completing a mean…
- `gitwhy_search` — Search saved contexts by keyword or natural language query. Returns matching context summaries ranked by relevance usin…
- `gitwhy_status` — Check GitWhy setup state, pending commits, and sync status for the current repo. Use to determine whether to suggest sa…
- `gitwhy_sync` — Upload local contexts to the GitWhy cloud as private (not shared with team). Use after saving contexts locally to back …

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get gitwhy-cli/gitwhy <tool-name>
```

## Prompts (3)

- `browse-contexts` (repo) — Browse all saved development contexts organized by domain and topic
- `search-decisions` (query, repo) — Search past coding decisions and context in your repository
- `understand-change` (context_id) — Understand why a specific code change was made by looking up its context
