Skip to main content
Glama
Gitignore MCP Tool

Gitignore MCP Tool

by hsiangjenli

A MCP server for generating .gitignore files using gitignore.io API

🌟 Features

  • Gitignore Generation: Generate .gitignore files

  • Template Listing: Browse all available gitignore templates

Related MCP server: GitLab MCP Server

πŸ› οΈ Getting Started

Environment Variables

Variable

Default

Description

GITIGNORE_API_BASE

https://www.toptal.com/developers/gitignore/api

Base URL for gitignore.io API

Local Development

  • Install dependencies:

uv sync
  • (Optional) Set custom API endpoint:

export GITIGNORE_API_BASE="https://your-custom-api.com/api"
  • Run the MCP server:

uv run --with fastmcp fastmcp run mcp_tools/main.py

Docker

  • Build the Docker image:

docker build -t mcp-gitignore:latest .
  • Run the container:

docker run -i --rm -p 8000:8000 mcp-gitignore:latest
  • Run with custom API endpoint:

docker run -i --rm -p 8000:8000 -e GITIGNORE_API_BASE="https://your-custom-api.com/api" mcp-gitignore:latest
  • Run MCP Server:

{
  "mcpServers": {
    "mcp-gitignore": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-p",
        "8000:8000",
        "mcp-gitignore:latest"
      ],
      "env": {
        "GITIGNORE_API_BASE": "https://www.toptal.com/developers/gitignore/api"
      }
    }
  }
}

🎯 API Endpoints

List Templates

GET /gitignore/templates/

List all available gitignore templates.

Generate .gitignore

POST /gitignore/generate/

Generate .gitignore file based on templates.

Request Body:

{
  "templates": ["python", "visualstudiocode", "macos"],
  "output_path": ".gitignore"
}

πŸ“š Documentation

  • Documentation is built using MkDocs and deployed to GitHub Pages.

  • To build the documentation locally:

chmod +x scripts/build_docs.sh
scripts/build_docs.sh
mkdocs build

Available Tools

2 tools
generate_gitignoreC

Generate a .gitignore file based on specified templates and save it to the specified path

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • success: Whether the operation was successful

      • message: Status message

      • content: Generated .gitignore content

    • Example:

{
  "success": true,
  "message": "string",
  "content": "string"
}
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{
  "detail": [
    "unknown_type"
  ]
}

Inputs: templates (required). Returns: content, message, success

list_gitignore_templatesB

List all available gitignore templates from gitignore.io

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • templates: List of available gitignore templates

    • Example:

{
  "templates": [
    "string"
  ]
}

Inputs: no named parameters. Returns: templates

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have completely distinct purposes with no overlap. 'generate_gitignore' creates a file based on templates, while 'list_gitignore_templates' provides the available template list. An agent would never confuse these tools as they serve different stages of the workflow.

    Naming Consistency5/5

    Both tools follow a perfect verb_noun pattern with consistent snake_case naming. 'generate_gitignore' and 'list_gitignore_templates' use clear, descriptive verbs that match their actions, creating a predictable naming convention throughout the tool set.

    Tool Count2/5

    With only 2 tools, this server feels under-scoped for a gitignore management system. While the tools cover basic functionality, there are obvious missing operations like updating existing gitignore files, deleting them, or managing custom templates that would make the surface more complete.

    Completeness3/5

    The tools provide core read and generate functionality but lack full lifecycle coverage. There's no way to update or delete generated gitignore files, and while templates can be listed, there's no ability to manage them. The surface covers basic workflows but leaves significant gaps for more complex scenarios.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers