Skip to content

rigerc/gitignore-recommender

Repository files navigation

gitignore-recommender MCP Server

A Model Context Protocol server that recommends and generates .gitignore files from the official github/gitignore repository.

This TypeScript-based MCP server provides:

  • Recommendation tool: recommend_gitignore — analyze a workspace and suggest matching templates.
  • Generation tool: generate_gitignore — fetch templates and generate or write a combined .gitignore.

Key files

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Run locally

You can run the compiled server directly:

node build/index.js

Or use npx to run the package:

npx -y gitignore-recommender

When run, the server listens on stdio and exposes MCP tools such as recommend_gitignore and generate_gitignore.

Usage

Examples of how to invoke the tools (via an MCP-capable client):

  • Recommend templates (inspect-only): JSON call to tool recommend_gitignore with optional arguments:
{
  "workspacePath": "d:/dev/projects/mcpservers",
  "maxFiles": 20000
}
  • Generate a .gitignore by auto-detection and write to disk:
{
  "workspacePath": "d:/dev/projects/mcpservers",
  "topN": 1,
  "writeToFile": true
}
  • Generate from explicit templates and return content (no write):
{
  "workspacePath": "C:/path/to/project",
  "templates": ["Node", "VisualStudioCode"],
  "writeToFile": false
}

Preparing for distribution via npx

To make this package runnable via npx you should:

  1. Update package.json with repository, author and license metadata (already included in this repo). See package.json.

  2. Ensure the bin field points to the compiled entrypoint (this repo already has: "gitignore-recommender": "./build/index.js").

  3. Build the package before publishing:

npm run build
  1. Publish to npm (choose a package name that is available):
npm publish --access public

After publishing, users can run:

npx -y gitignore-recommender

or add it as the MCP server command in your MCP settings:

{
  "mcpServers": {
    "gitignore-recommender": {
      "command": "npx",
      "args": ["-y", "gitignore-recommender"]
    }
  }
}

Notes and considerations

  • Network access is required at runtime to fetch templates from raw.githubusercontent.com.
  • The MCP server must have write permission to the target workspace if you plan to use generate_gitignore with writeToFile: true.
  • Update the repository field in package.json to your GitHub repo before publishing so users can find the source.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published