Skip to main content
Glama
README.md
# api-dead-ends

[![test](https://github.com/talikbaku/api-dead-ends/actions/workflows/test.yml/badge.svg)](https://github.com/talikbaku/api-dead-ends/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/api-dead-ends)](https://www.npmjs.com/package/api-dead-ends)
[![MCP server](https://img.shields.io/badge/MCP-server-6E56CF)](#-ai-agents-mcp-utcp)
[![Claude Code plugin](https://img.shields.io/badge/Claude%20Code-plugin-D97757)](#-ai-agents-mcp-utcp)
[![UTCP](https://img.shields.io/badge/UTCP-manual-2E7D32)](#-ai-agents-mcp-utcp)
![license](https://img.shields.io/badge/license-MIT-blue)

**Find API endpoints that fail, are never called, or are missing from your OpenAPI spec β€” using the logs and metrics you already have.** CLI, MCP server, UTCP manual and Claude Code plugin.

OpenAPI vs real traffic: compares your spec (or your framework's route list) with request counts from your logs, APM or metrics, and finds unused API endpoints, endpoints not called in production, shadow APIs and zombie APIs β€” an API inventory from facts. Local, read-only, zero dependencies, any language.

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/talikbaku/api-dead-ends/main/docs/media/report-dark.svg">
  <img src="https://raw.githubusercontent.com/talikbaku/api-dead-ends/main/docs/media/report-light.svg" width="720" alt="api-dead-ends in a terminal: endpoints with server errors, undocumented endpoints, endpoints not called in 30 days, and deprecated endpoints that are still called">
</picture>

## πŸ€– Don't want to read? Copy this into Claude Code or Cursor

```text
Set up api-dead-ends for me (https://github.com/talikbaku/api-dead-ends) β€” a read-only CLI and MCP server that compares my OpenAPI spec (or route list) with real traffic and lists endpoints with errors, endpoints not called in the window, and undocumented (shadow) endpoints.
1. Check Node.js >= 20 (22+ recommended); tell me how to install it if missing.
2. Claude Code: /plugin marketplace add talikbaku/api-dead-ends then /plugin install api-dead-ends@api-dead-ends-marketplace
   Cursor or another MCP client: add server "ade" = {"command":"npx","args":["-y","api-dead-ends@0.2.0","mcp"]}
3. Run detect_project, tell me which services, specs and traffic sources you found, and ask what's missing in one block.
4. Rules: never paste raw logs into the chat, never call non-GET endpoints in production, never call an endpoint "dead" β€” "not called" is only a hint.
Short docs: https://github.com/talikbaku/api-dead-ends/blob/main/llms.txt
```

## πŸ” What it finds

| | Finding | Example |
|---|---|---|
| βœ– | **Broken** β€” share of 5xx per endpoint, plus endpoints with many client errors (4xx) | `POST /promo/apply` β€” 23% of calls end in 500 |
| ! | **Undocumented (shadow)** β€” called in production, missing from the spec | `GET /api/v1/products/{id}/reviews` β€” 34,507 calls |
| β—‹ | **Not called** in the window β€” with the window length and a confidence level | `POST /orders/{id}/repeat` β€” 0 calls in 30 days |
| ↓ | **Deprecated but still called** | `GET /legacy/catalog` β€” 6,826 calls |

> [!NOTE]
> "Not called" is a hint, not a verdict: the endpoint may be used monthly, by a partner, by an old app version β€” or its traffic may not be logged. api-dead-ends recommends; a human decides.

## πŸ€” Why not just Datadog, Sentry or an AI?

- **Spec vs reality.** Monitoring shows what is called; it doesn't know what your spec promises. api-dead-ends puts both side by side.
- **Numbers come from code, not from a model.** Same input β†’ same report. AI is optional, on top.
- **CI fails only on what's new** β€” a new undocumented endpoint or growing use of a deprecated one. Never on "not called".

**Verified on real production data:** Elasticsearch / Kibana / OpenSearch.
**Built from vendor docs, feedback welcome:** Datadog APM & Logs Β· Prometheus / Thanos / Mimir Β· Loki Β· App Insights Β· CloudWatch Β· Athena Β· BigQuery Β· New Relic Β· Dynatrace Β· Splunk Β· nginx / Apache / JSON access logs Β· any CSV

```mermaid
flowchart LR
  src["Your logs / APM / metrics"] -->|"query β†’ aggregated counts only"| use["usage table<br/>method Β· path Β· calls Β· status"]
  spec["OpenAPI spec<br/>or framework route list"] --> rep
  use --> rep{{"report<br/>by code, not LLM"}}
  rep --> md["report.md / .json"]
  rep --> ci["CI gate"]
  rep --> mcp["MCP β†’ Claude Code, Cursor"]
```

## πŸš€ Quick start

Node.js 20+ (22+ recommended). No install, no dependencies:

```bash
npx api-dead-ends init
```

`init` scans your repo (services, languages, frameworks, specs), asks a few questions β€” Enter accepts the default β€” and writes `.api-dead-ends/NEXT-STEPS.md` with the exact commands for each service. It never changes your code.

**Already have an export** from Kibana, Datadog, Prometheus…? Two commands:

```bash
npx api-dead-ends convert elasticsearch kibana-response.json --spec openapi.json -o usage.csv
npx api-dead-ends report --usage usage.csv --spec openapi.json --days 15 --out report/
```

**No logs?** Today the tool needs some traffic data β€” at least nginx/Apache access logs. Options: [no logs](docs/MORE.md#no-logs-at-all).

**No OpenAPI spec?** Ask your framework for its route list (`rails routes`, `flask routes`, Spring `/actuator/mappings`, Gin debug output, Laravel `route:list`…):

```bash
npx api-dead-ends spec from-routes routes.txt -o openapi.json
```

## πŸ“Š Example report

From the synthetic demo in [`examples/`](examples/) β€” [full report](examples/report/report.md):

```text
## Summary
- 2 endpoints with server errors (5xx β‰₯ 1% of calls and β‰₯ 10 responses) β€” and 1,624 more 5xx on 3 endpoints below that threshold.
- 1 endpoint with many client errors (4xx other than 401/404 β‰₯ 10%).
- 3 undocumented endpoints called (not in the spec).
- 3 endpoints not called in 30 days, 2 rare, 2 deprecated but still called. Confidence: low.
```

## πŸ‘₯ By role

| You are | You ask | Look at |
|---|---|---|
| QA / SDET | Which endpoints return 5xx in real traffic? Which have no traffic at all? | Server errors Β· Client errors Β· Not called |
| Backend | What does my API actually serve before I refactor or deprecate? | Not called Β· Deprecated but still called |
| DevOps / SRE | Can I get this from the Prometheus / Loki / ES I already run, with no agent? | `query prometheus --preset …`, `query loki` |
| AppSec | Which undocumented endpoints do real clients hit? Any debug paths answering 200? | Undocumented (flags debug/admin paths) |
| Analyst | Where does the spec differ from reality? | Undocumented Β· Not called |
| Product | Which features' endpoints does nobody use? | Not called (with confidence) |
| Small team, no logs | What can I get today? | Access logs β†’ `convert accesslog`; see [no logs](docs/MORE.md#no-logs-at-all) |

## πŸ€– AI agents (MCP, UTCP)

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/talikbaku/api-dead-ends/main/docs/media/claude-dark.svg">
  <img src="https://raw.githubusercontent.com/talikbaku/api-dead-ends/main/docs/media/claude-light.svg" width="720" alt="Claude Code with the api-dead-ends plugin: it calls detect_project and analyze_usage, finds DELETE /orders/{id} failing 7.4% of the time and a 502 spike on POST /payments, lists endpoints not called in 90 days, and says not seen does not prove an endpoint is dead">
</picture>

<sub>A real Claude Code run with the plugin on the synthetic test project; answer abridged.</sub>

**Claude Code plugin** (MCP server + a skill with guardrails):

```
/plugin marketplace add talikbaku/api-dead-ends
/plugin install api-dead-ends@api-dead-ends-marketplace
```

**Cursor, VS Code, Windsurf, Claude Desktop** β€” any MCP client:

```json
{ "mcpServers": { "ade": { "command": "npx", "args": ["-y", "api-dead-ends@0.2.0", "mcp"] } } }
```

Five tools, reading only inside the working directory: `detect_project`, `setup_plan`, `build_query`, `spec_from_routes`, `analyze_usage`.

**UTCP** (experimental): no server needed β€” `npx api-dead-ends utcp` prints a UTCP manual with the same five tools that call the CLI directly. Register it as a `cli` call template in any UTCP client.

Any other chat assistant: paste [`prompts/any-ai.md`](prompts/any-ai.md) with your `report.json`. Details: [docs/MCP.md](docs/MCP.md).

## πŸ›‘οΈ Safe by default

- **Aggregates only.** The tool reads counts per method + path + status. Raw log lines, IPs, tokens and request bodies never enter it; IDs and token-like path segments are folded to `{id}`, query strings dropped.
- **No network.** It prints queries; you run them with your own access. The only exception is `fetch elasticsearch` with your read-only key.
- **Nothing changes your code.** `init` writes a config and next steps, never overwrites, and keeps raw exports out of git.
- **Traffic is untrusted.** Paths from logs are escaped in reports and in MCP output, so they can't inject Markdown or instructions. [docs/SECURITY.md](docs/SECURITY.md)

## βš™οΈ CI gate

```bash
npx api-dead-ends report --usage usage.csv --spec openapi.json --write-baseline baseline.json   # once
npx api-dead-ends report --usage usage.csv --spec openapi.json --baseline baseline.json --fail-on new-shadow,deprecated-growth
```

Exit codes: `0` ok Β· `1` check failed Β· `2` bad input.

## πŸ§ͺ Try the demo

```bash
git clone https://github.com/talikbaku/api-dead-ends.git && cd api-dead-ends
node bin/api-dead-ends.mjs report --usage examples/shop-usage.csv --spec examples/shop.openapi.json --days 30 --out /tmp/report
```

All data in `examples/` is synthetic.

## ⚠️ Limits

- **Window.** Logs often keep 7–30 days; monthly jobs may not show up. Confidence: low < 35 days, medium < 90, high β‰₯ 90. APM metrics keep months β€” prefer them for "not called".
- **Coverage.** Traffic that bypasses the logged layer, or endpoints that don't log, are invisible.
- **Verified sources.** Elasticsearch/Kibana is verified on real production data; the other adapters are built from vendor docs β€” please report parsing problems.

## πŸ“š More

**Status:** v0.2.0. [docs/MORE.md](docs/MORE.md) β€” all flags, thresholds, path templating, framework route lists, no-logs options, FAQ Β· [docs/SOURCES.md](docs/SOURCES.md) β€” every source Β· [docs/MCP.md](docs/MCP.md) Β· [docs/SECURITY.md](docs/SECURITY.md) Β· [CHANGELOG.md](CHANGELOG.md)

**Try it on your traffic and tell me what broke** β€” [open an issue](https://github.com/talikbaku/api-dead-ends/issues). Useful? ⭐ Star the repo.

[MIT](LICENSE) Β© 2026 Talat Gurbanbayov Β· also by the author: [curl2k6](https://github.com/talikbaku/curl2k6) β€” k6 performance regression checks from a curl