Gitignore MCP Tool
A MCP server for generating
.gitignorefiles using gitignore.io API
🌟 Features
- Gitignore Generation: Generate
.gitignorefiles - Template Listing: Browse all available gitignore templates
🛠️ 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
