Skip to main content
Glama

reuse-before-generate

npm license reuse-before-generate MCP server

Your idea probably already exists. Find out before you build it, not after.

When you ask an AI coding assistant to build an app or module, it overenthusiastically starts scaffolding thousands of lines of code from scratch—even when battle-tested open-source libraries or maintained tools already exist.

reuse-before-generate is a zero-dependency MCP server (and CLI tool) that intercepts the AI workflow before code generation begins. It searches public code and package indexes across multiple angles, formats results as structured Markdown, and directs the AI to search the web for existing SaaS products and community discussions.

Sources checked

The server checks these sources in parallel:

Source

What it searches

GitHub

Public repositories

GitLab

Public projects

npm

JavaScript packages

crates.io

Rust crates

NuGet

.NET packages

Hugging Face

Public models

Docker Hub

Public container images

Maven Central

Java artifacts

RubyGems

Ruby gems

Packagist

PHP packages

All added sources use public endpoints and do not require API keys. They are queried on a best-effort basis: if one source is unavailable or rate-limited, results from the other sources are still returned. A GitHub token is optional and only raises GitHub's search rate limit.


Quick Start & Installation

No API keys required to start.

1. Claude Code CLI

claude mcp add -s user reuse-before-generate -- npx -y reuse-before-generate

2. Cursor, Claude Desktop, Antigravity, Windsurf, or VS Code

Add this to your mcpServers configuration (e.g. ~/.claude/mcp.json, ~/.gemini/antigravity-ide/mcp_config.json, or Cursor settings):

{
  "mcpServers": {
    "reuse-before-generate": {
      "command": "npx",
      "args": ["-y", "reuse-before-generate@latest"]
    }
  }
}

Optional: Higher GitHub API Limits

You can optionally pass a GitHub token to raise GitHub's rate limits:

{
  "mcpServers": {
    "reuse-before-generate": {
      "command": "npx",
      "args": ["-y", "reuse-before-generate@latest"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

3. Run Directly in Terminal (CLI Mode)

You can run searches directly from your shell without an MCP client:

npx reuse-before-generate "terminal markdown viewer"
# or if cloned locally:
node index.js "gnome speech to text offline"

Related MCP server: idea-reality-mcp

🤖 Make It Automatic for AI Agents

To ensure your AI assistant checks for existing solutions before writing code, add this instruction to your CLAUDE.md, .cursorrules, GEMINI.md, or AGENTS.md:

Before scaffolding a new project or substantial new module from scratch:
1. Call `check_before_building` (or `reuse_before_generate`) from the `reuse-before-generate` MCP server.
2. Follow up with web search for existing commercial products or self-hosted tools as directed by the tool.
3. Present existing alternatives in a concise table and ask the user whether to reuse or extend an existing project instead of building from scratch.

🤖 AI Disclosure

For details on how AI is used in this project, see What I delegate to AI and what I don't.


License

MIT

Available Tools

2 tools
check_before_buildingA

Run before building from scratch. Searches GitHub, GitLab, npm, crates.io, NuGet, Hugging Face, Docker Hub, Maven Central, RubyGems, and Packagist across multiple query angles to find existing codebases, and provides targeted web search queries for finding commercial SaaS competitors.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNoSearch query or project description
queriesNoRECOMMENDED: 2-4 distinct technical search queries / keywords maintainers would use (e.g. ['gnome speech to text', 'gnome whisper dictation', 'linux offline voice typing']).
keywordsNoOptional search keywords
descriptionNoDescription of what you want to build

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It names the exact registries covered, notes that multiple query angles are used, and states that it also generates targeted web search queries for competitor research. It stops short of describing the return format or error/edge-case behavior, but it is substantially transparent for a read-oriented search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one focused, front-loaded sentence with no filler: the usage trigger comes first, followed by the precise scope. The long list of registries is justified because it defines the tool's coverage and prevents confusion with sibling tools.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a discovery tool with no output schema, the description explains what it searches and partially what it returns ('provides targeted web search queries'). However, it does not specify the format or nature of the codebase-search results, nor does it address how this tool relates to reuse_before_generate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters. The description adds only a general hint about 'multiple query angles,' which explains how queries are used at a high level but does not add detail beyond the schema's parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action and resource: it runs before building from scratch, searches a specific set of code registries, and finds existing codebases. It does not explicitly contrast itself with reuse_before_generate, so sibling differentiation is only implicit rather than named.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The opening phrase gives an explicit trigger condition: 'Run before building from scratch.' This tells the agent when to use the tool, but it does not provide explicit when-not-to-use guidance or name the sibling as an alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

reuse_before_generateA

Run before building from scratch. Searches GitHub, GitLab, npm, crates.io, NuGet, Hugging Face, Docker Hub, Maven Central, RubyGems, and Packagist across multiple query angles to find existing codebases, and provides targeted web search queries for finding commercial SaaS competitors.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNoSearch query or project description
queriesNoRECOMMENDED: 2-4 distinct technical search queries / keywords maintainers would use (e.g. ['gnome speech to text', 'gnome whisper dictation', 'linux offline voice typing']).
keywordsNoOptional search keywords
descriptionNoDescription of what you want to build

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the search spans many registries 'across multiple query angles' and that it 'provides targeted web search queries'—useful behavioral traits. However, it does not state whether the operation is read-only, whether it makes external network calls, or what the result structure looks like. This is a moderate gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler. The imperative instruction is front-loaded, and the platform list is compact yet specific. Every phrase earns its place; there is no redundant restating of the tool name or schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers input intent, scope, and one output aspect (web search queries for competitors), but it does not explain what the agent will actually receive back (e.g., a list of repos, links, scores). With no output schema and no annotations, this missing return-value information is a clear gap for correct invocation and result handling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters. The description adds general context (e.g., multiple query angles, competitor search) but does not add specific syntax, defaults, or parameter relationships beyond what the schema provides. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Run before building from scratch') and resource ('Searches GitHub, GitLab, npm...') with a clear purpose: finding existing codebases and providing competitor-search queries. This fully distinguishes it from the sibling 'check_before_building' by focusing on reuse rather than validation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The first phrase 'Run before building from scratch' gives an explicit when-to-use signal. It does not name alternatives or exclusions, but the context is clear enough for an agent to select this tool at the appropriate stage. Slight deduction for not contrasting with check_before_building.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.2.5
    • Changedcheck_before_building18 fields changed
      • removedInput schema / $schema
        Removed value: -"http://json-schema.org/draft-07/schema#"
      • removedInput schema / additionalProperties
        Removed value: -false
      • changedInput schema / properties / description / description
        Previous value: -"Plain-language description of the project/module about to be built — what it does, not how. The more specific, the better the match quality."New value: +"Description of what you want to build"
      • removedInput schema / properties / description / minLength
        Removed value: -10
      • changedInput schema / properties / keywords / description
        Previous value: -"REQUIRED: 3-4 precise search terms YOU infer from the description, using your own understanding of what the user actually means — do this especially when the description is vague, informal, or from a non-native speaker. Pick the concrete domain noun a maintainer would actually put in their README, not a generic category word: e.g. for 'thing that checks my code doesn't have secret keys by mistake' prefer [\"git\", \"secrets\", \"detect\", \"leak\"] over [\"secret\", \"scanner\", \"detect\", \"git\"] — 'scanner' is broad enough to pull in unrelated security-tool listicles, while 'leak'/'secrets' matches how gitleaks/trufflehog actually describe themselves. Avoid generic tooling-ecosystem words (mcp, agent, server, tool, app) unless the description has nothing more specific — they return noise (awesome-lists, unrelated MCP servers) rather than real competitors. Critically, favor the word a maintainer would use to describe WHAT THE TOOL IS over the word describing the USER'S PROBLEM: a real 'pretty JSON in the terminal' tool likely calls itself a 'viewer' or 'processor', not a 'pretty-printer'/'colorizer'; a real static-site link checker likely says it validates 'rendered HTML', not 'static site alt-text'. If your first guess doesn't match, mentally simulate the README of the tool you're picturing and pull words straight from that sentence."New value: +"Optional search keywords"
      • removedInput schema / properties / keywords / items
        Removed value: -{
        -  "type": "string"
        -}
      • removedInput schema / properties / keywords / maxItems
        Removed value: -6
      • removedInput schema / properties / keywords / minItems
        Removed value: -3
      • addedInput schema / properties / keywords / oneOf
        Added value: +[
        +  {
        +    "items": {
        +      "type": "string"
        +    },
        +    "type": "array"
        +  },
        +  {
        +    "type": "string"
        +  }
        +]
      • removedInput schema / properties / keywords / type
        Removed value: -"array"
      • removedInput schema / properties / queries / additionalProperties
        Removed value: -false
      • changedInput schema / properties / queries / description
        Previous value: -"Optional high-quality intent inferred semantically by the calling agent: category names what this is, outcome says what it accomplishes, synonyms supplies distinct terminology maintainers or product makers may use, constraints supplies up to 8 must-have properties, priorities supplies up to 4 ordered preferences, and artifactType says whether the desired result is an application, hosted service, CLI, or library. Older callers may omit these optional fields; the server will infer conservative fallbacks."New value: +"RECOMMENDED: 2-4 distinct technical search queries / keywords maintainers would use (e.g. ['gnome speech to text', 'gnome whisper dictation', 'linux offline voice typing'])."
      • addedInput schema / properties / queries / items
        Added value: +{
        +  "type": "string"
        +}
      • removedInput schema / properties / queries / properties
        Removed value: -{
        -  "artifactType": {
        -    "enum": [
        -      "application",
        -      "service",
        -      "cli",
        -      "library"
        -    ],
        -    "type": "string"
        -  },
        -  "category": {
        -    "minLength": 2,
        -    "type": "string"
        -  },
        -  "constraints": {
        -    "items": {
        -      "minLength": 2,
        -      "type": "string"
        -    },
        -    "maxItems": 8,
        -    "type": "array"
        -  },
        -  "outcome": {
        -    "minLength": 2,
        -    "type": "string"
        -  },
        -  "priorities": {
        -    "description": "Ordered preferences from most important to least important, such as [\"Android\", \"iOS\"]. Both can appear in results, but earlier entries receive more ranking weight.",
        -    "items": {
        -      "minLength": 2,
        -      "type": "string"
        -    },
        -    "maxItems": 4,
        -    "type": "array"
        -  },
        -  "synonyms": {
        -    "minLength": 2,
        -    "type": "string"
        -  }
        -}
      • removedInput schema / properties / queries / required
        Removed value: -[
        -  "category",
        -  "outcome",
        -  "synonyms"
        -]
      • changedInput schema / properties / queries / type
        Previous value: -"object"New value: +"array"
      • addedInput schema / properties / query
        Added value: +{
        +  "description": "Search query or project description",
        +  "type": "string"
        +}
      • removedInput schema / required
        Removed value: -[
        -  "description",
        -  "keywords"
        -]
    • Changedreuse_before_generate18 fields changed
      • removedInput schema / $schema
        Removed value: -"http://json-schema.org/draft-07/schema#"
      • removedInput schema / additionalProperties
        Removed value: -false
      • changedInput schema / properties / description / description
        Previous value: -"Plain-language description of the project/module about to be built — what it does, not how. The more specific, the better the match quality."New value: +"Description of what you want to build"
      • removedInput schema / properties / description / minLength
        Removed value: -10
      • changedInput schema / properties / keywords / description
        Previous value: -"REQUIRED: 3-4 precise search terms YOU infer from the description, using your own understanding of what the user actually means — do this especially when the description is vague, informal, or from a non-native speaker. Pick the concrete domain noun a maintainer would actually put in their README, not a generic category word: e.g. for 'thing that checks my code doesn't have secret keys by mistake' prefer [\"git\", \"secrets\", \"detect\", \"leak\"] over [\"secret\", \"scanner\", \"detect\", \"git\"] — 'scanner' is broad enough to pull in unrelated security-tool listicles, while 'leak'/'secrets' matches how gitleaks/trufflehog actually describe themselves. Avoid generic tooling-ecosystem words (mcp, agent, server, tool, app) unless the description has nothing more specific — they return noise (awesome-lists, unrelated MCP servers) rather than real competitors. Critically, favor the word a maintainer would use to describe WHAT THE TOOL IS over the word describing the USER'S PROBLEM: a real 'pretty JSON in the terminal' tool likely calls itself a 'viewer' or 'processor', not a 'pretty-printer'/'colorizer'; a real static-site link checker likely says it validates 'rendered HTML', not 'static site alt-text'. If your first guess doesn't match, mentally simulate the README of the tool you're picturing and pull words straight from that sentence."New value: +"Optional search keywords"
      • removedInput schema / properties / keywords / items
        Removed value: -{
        -  "type": "string"
        -}
      • removedInput schema / properties / keywords / maxItems
        Removed value: -6
      • removedInput schema / properties / keywords / minItems
        Removed value: -3
      • addedInput schema / properties / keywords / oneOf
        Added value: +[
        +  {
        +    "items": {
        +      "type": "string"
        +    },
        +    "type": "array"
        +  },
        +  {
        +    "type": "string"
        +  }
        +]
      • removedInput schema / properties / keywords / type
        Removed value: -"array"
      • removedInput schema / properties / queries / additionalProperties
        Removed value: -false
      • changedInput schema / properties / queries / description
        Previous value: -"Optional high-quality intent inferred semantically by the calling agent: category names what this is, outcome says what it accomplishes, synonyms supplies distinct terminology maintainers or product makers may use, constraints supplies up to 8 must-have properties, priorities supplies up to 4 ordered preferences, and artifactType says whether the desired result is an application, hosted service, CLI, or library. Older callers may omit these optional fields; the server will infer conservative fallbacks."New value: +"RECOMMENDED: 2-4 distinct technical search queries / keywords maintainers would use (e.g. ['gnome speech to text', 'gnome whisper dictation', 'linux offline voice typing'])."
      • addedInput schema / properties / queries / items
        Added value: +{
        +  "type": "string"
        +}
      • removedInput schema / properties / queries / properties
        Removed value: -{
        -  "artifactType": {
        -    "enum": [
        -      "application",
        -      "service",
        -      "cli",
        -      "library"
        -    ],
        -    "type": "string"
        -  },
        -  "category": {
        -    "minLength": 2,
        -    "type": "string"
        -  },
        -  "constraints": {
        -    "items": {
        -      "minLength": 2,
        -      "type": "string"
        -    },
        -    "maxItems": 8,
        -    "type": "array"
        -  },
        -  "outcome": {
        -    "minLength": 2,
        -    "type": "string"
        -  },
        -  "priorities": {
        -    "description": "Ordered preferences from most important to least important, such as [\"Android\", \"iOS\"]. Both can appear in results, but earlier entries receive more ranking weight.",
        -    "items": {
        -      "minLength": 2,
        -      "type": "string"
        -    },
        -    "maxItems": 4,
        -    "type": "array"
        -  },
        -  "synonyms": {
        -    "minLength": 2,
        -    "type": "string"
        -  }
        -}
      • removedInput schema / properties / queries / required
        Removed value: -[
        -  "category",
        -  "outcome",
        -  "synonyms"
        -]
      • changedInput schema / properties / queries / type
        Previous value: -"object"New value: +"array"
      • addedInput schema / properties / query
        Added value: +{
        +  "description": "Search query or project description",
        +  "type": "string"
        +}
      • removedInput schema / required
        Removed value: -[
        -  "description",
        -  "keywords"
        -]
  2. 2 tool updatesv0.2.4
    • Changedcheck_before_building1 field changed
      • addedInput schema / properties / queries
        Added value: +{
        +  "additionalProperties": false,
        +  "description": "Optional high-quality intent inferred semantically by the calling agent: category names what this is, outcome says what it accomplishes, synonyms supplies distinct terminology maintainers or product makers may use, constraints supplies up to 8 must-have properties, priorities supplies up to 4 ordered preferences, and artifactType says whether the desired result is an application, hosted service, CLI, or library. Older callers may omit these optional fields; the server will infer conservative fallbacks.",
        +  "properties": {
        +    "artifactType": {
        +      "enum": [
        +        "application",
        +        "service",
        +        "cli",
        +        "library"
        +      ],
        +      "type": "string"
        +    },
        +    "category": {
        +      "minLength": 2,
        +      "type": "string"
        +    },
        +    "constraints": {
        +      "items": {
        +        "minLength": 2,
        +        "type": "string"
        +      },
        +      "maxItems": 8,
        +      "type": "array"
        +    },
        +    "outcome": {
        +      "minLength": 2,
        +      "type": "string"
        +    },
        +    "priorities": {
        +      "description": "Ordered preferences from most important to least important, such as [\"Android\", \"iOS\"]. Both can appear in results, but earlier entries receive more ranking weight.",
        +      "items": {
        +        "minLength": 2,
        +        "type": "string"
        +      },
        +      "maxItems": 4,
        +      "type": "array"
        +    },
        +    "synonyms": {
        +      "minLength": 2,
        +      "type": "string"
        +    }
        +  },
        +  "required": [
        +    "category",
        +    "outcome",
        +    "synonyms"
        +  ],
        +  "type": "object"
        +}
    • Addedreuse_before_generate
  3. 1 tool updatev0.2.3
    • First observedcheck_before_building

TDQS

B3.3/5.0

Scored across 2 tools

Disambiguation1/5

Both tools have identical descriptions and perform the exact same search across the same registries. There is no way for an agent to distinguish between them, making misselection certain.

Naming Consistency2/5

Both names follow a snake_case verb_noun pattern, but the verbs 'check' and 'reuse' are synonyms in this context, and the nouns 'building' and 'generate' are also synonymous. The consistent pattern does not help because the semantics are essentially the same.

Tool Count2/5

With only 2 tools that duplicate the same functionality, the server is severely under-scoped. A single tool would suffice, or the server should provide a broader set of distinct capabilities.

Completeness2/5

The server's entire surface is one search operation offered twice. There are no complementary tools (e.g., to process results, filter, or initiate generation), leaving the domain coverage incomplete and redundant.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers