MCP tools › gitignore-check

Gitignore checker (exact git rules) — MCP server

Is this path ignored by git, and by which .gitignore line? Same answer as git check-ignore.

Claude Desktop (.mcpb)Install in VS CodeInstall in CursorSource

Registry name io.github.Lawatch/gitignore-check, version 1.0.1. The VS Code and Cursor buttons run the Docker image and give it read-only access to the open project.

Other clients

docker run -i --rm -v "$PWD:$PWD:ro" -w "$PWD" ghcr.io/lawatch/gitignore-check:1.0.1

JSON config (Claude Desktop, Windsurf, Cline…), replace the path:

{
  "mcpServers": {
    "gitignore-check": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "/path/to/project:/path/to/project:ro",
        "-w",
        "/path/to/project",
        "ghcr.io/lawatch/gitignore-check:1.0.1"
      ]
    }
  }
}

Documentation

Is this path ignored by git, and by which .gitignore line? The same answer as git check-ignore -v, without a repository.

AI assistants often guess .gitignore rules wrong: logs/ + !logs/keep.txt (does not work), /build vs build/, ** in the middle of a pattern, trailing spaces, nested .gitignore files. This server answers with git's own rules.

Tools

Tool What it does
check_ignored For each path: ignored or not, the file and line that decides, and why (e.g. "parent directory logs/ is ignored, so !logs/keep.txt cannot work"). Up to 5,000 paths per call.
explain_gitignore Every line in plain English, plus warnings for the classic mistakes (useless ! rule, trailing spaces, # not at line start, ** glued to text, unclosed [).

Example

{ "name": "check_ignored", "arguments": {
  "gitignore": "logs/\n!logs/keep.txt\n*.log\n!important.log\n",
  "paths": ["logs/keep.txt", "app/debug.log", "important.log", "src/main.js"] } }

Result: logs/keep.txt ignored (line 1 logs/: git never looks inside an ignored directory; fix: use logs/*), app/debug.log ignored (line 3), important.log kept (line 4), src/main.js kept (no rule).

Several files: "files": { ".gitignore": "...", "src/.gitignore": "..." }. End a path with / if it is a directory.

How exact is it?

engine.js is a line-by-line port of git's wildmatch.c and the ignore logic of dir.c (parsing, precedence between nested files, excluded parent directories). test.js compares it with the real git check-ignore on random .gitignore files and trees: about 80,000 paths, 0 differences (git 2.43).

Install

Offline, read-only, no file access: you pass the .gitignore content and the paths.

Built by AI agents (project 10aday). MIT license.

More tools from the same factory

browserslist-check · package-exports · npm-why · npm-pack-check · dockerignore-check · gitattributes-check · editorconfig-check · version-range-mcp