Reuse Before Generate — Claude Code MCP server
Searches public code and package indexes for an existing solution before your agent starts scaffolding one from scratch.
claude mcp add reuse-before-generate -e GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generateWhat Reuse Before Generate does
The server steps in ahead of code generation and queries public catalogs in parallel: GitHub, GitLab, npm, PyPI, crates.io, NuGet, Maven Central, RubyGems, Packagist, Docker Hub, Hugging Face. It also covers app and tool listings such as Show HN, Flathub, F-Droid, GNOME Extensions, Homebrew, AUR, Conda and CRAN. Results come back as structured Markdown, and the agent is nudged to search the web for commercial products and community threads as well.
Every source sits behind a public endpoint, so no API keys are needed. One unavailable or rate-limited catalog does not block the rest — you still get what the others return. A GitHub token is optional and its only job is raising GitHub's search limit.
This matters when your assistant reaches for thousands of lines the moment you describe a feature. To make the check automatic, drop an instruction into CLAUDE.md, .cursorrules, GEMINI.md or AGENTS.md: call check_before_building (or reuse_before_generate) first, run a web search next, then show a short comparison table and ask whether to reuse or extend something that exists.
What it helps with
- find a maintained library instead of writing the module yourself
- check whether an app for your use case already ships
- compare options from several ecosystems in one table
- make the agent ask before it scaffolds a new project
Example prompts for the agent
- Check with reuse-before-generate whether a terminal markdown viewer already exists
- Before we write this service, look for existing tools and show me a comparison table
- Call
check_before_buildingfor offline speech to text on GNOME
How to install Reuse Before Generate
Platform CLI
claude mcp add reuse-before-generate -e GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generateReplace <…> with your own values
Platform CLI
codex mcp add reuse-before-generate --env GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generateReplace <…> with your own values
Config file
{
"mcpServers": {
"reuse-before-generate": {
"command": "npx",
"args": [
"-y",
"reuse-before-generate"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"reuse-before-generate": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"reuse-before-generate"
],
"env": {
"GITHUB_TOKEN": "<GITHUB_TOKEN>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e GITHUB_TOKEN=<GITHUB_TOKEN> reuse-before-generate npx -y reuse-before-generateReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Reuse Before Generate
How do I install Reuse Before Generate in Claude Code?
Run claude mcp add reuse-before-generate -e GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generate. You can leave the token out, but GitHub search allows fewer requests without it.
What does Reuse Before Generate do?
It looks up your idea across public code and package indexes before an agent builds it, then returns the matches as a Markdown table.
Does it need API keys?
No. All sources use public endpoints. A GitHub token is optional and only lifts GitHub's rate limit.