A Model Context Protocol (MCP) server that provides file and git operations for n8n workflows.
- read_file: Read file contents
- write_file: Create or update files
- list_files: List files and directories (with recursive option)
- delete_file: Delete files or directories
- create_directory: Create new directories
- git_status: Check repository status
- git_add: Stage files for commit
- git_commit: Create commits
- git_push: Push to remote repository
- git_pull: Pull from remote repository
- git_log: View commit history
- git_diff: Show file differences
- search_in_files: Search for text patterns in files
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start server
npm start# Build image
docker build -t mcp-file-git-server .
# Run container
docker run -d \
--name mcp-file-git-server \
-p 3001:3001 \
-e PROJECT_ROOT=/workspace \
-v /path/to/your/project:/workspace:rw \
mcp-file-git-serverAdd to your docker-compose.yml:
services:
mcp-server:
build: ./mcp-file-git-server
container_name: mcp-file-git-server
environment:
- PROJECT_ROOT=/workspace
- PORT=3001
- NODE_ENV=production
ports:
- "3001:3001"
volumes:
- /path/to/your/project:/workspace:rw
- ~/.gitconfig:/root/.gitconfig:ro
- ~/.ssh:/root/.ssh:ro
networks:
- n8n-traefik_default
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3PROJECT_ROOT: Path to project directory (default:/workspace)PORT: Server port (default:3001)
- Health Check:
GET http://localhost:3001/health - SSE Endpoint:
POST http://localhost:3001/sse(for n8n-nodes-mcp) - Message Endpoint:
POST http://localhost:3001/message
- Go to Credentials → New
- Search for "MCP"
- Configure:
- Transport:
SSE(Server-Sent Events) - URL:
http://mcp-file-git-server:3001/sse
- Transport:
- Save
- Add MCP Client node
- Select your MCP credential
- Choose operation (List Tools, Call Tool, etc.)
- Connect to AI Agent Tool via
ai_toolconnection
curl http://localhost:3001/healthcurl -X POST http://localhost:3001/sse \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Ensure the mounted project directory has correct permissions:
sudo chown -R $(id -u):$(id -g) /path/to/your/projectInitialize git in the project directory:
docker exec -it mcp-file-git-server sh
cd /workspace
git init
git config user.name "Your Name"
git config user.email "your@email.com"
exitCheck Docker network connectivity:
# From n8n container
docker exec -it n8n-traefik-n8n-1 sh
wget -O- http://mcp-file-git-server:3001/health
exitMIT