A Model Context Protocol (MCP) compliant server that formats files using .editorconfig rules. This project started from a specific workflow issue I kept running into. I found that while working with AI coding agents, they would often generate code with minor formatting errors, like trailing whitespace or inconsistent newlines. Our linters would then flag these issues, and the agent would spend val
Add this skill
npx mdskills install neilberkman/editorconfig-mcpWell-documented formatting tool with clear API and strong security features, but permissions exceed actual needs
1# EditorConfig MCP Server23A Model Context Protocol (MCP) compliant server that formats files using `.editorconfig` rules.45This project started from a specific workflow issue I kept running into. I found that while working with AI coding agents, they would often generate code with minor formatting errors, like trailing whitespace or inconsistent newlines. Our linters would then flag these issues, and the agent would spend valuable cycles fixing its own simple mistakes.67This EditorConfig MCP Server is the tool I built to solve that problem for myself. It acts as a proactive formatting gatekeeper, using your project's .editorconfig rules to ensure files are correct from the start. My hope is that it might be useful to others who've encountered a similar frustration in their AI-assisted development process.89## Installation1011### Global Installation (Recommended)1213```bash14npm install -g editorconfig-mcp-server15```1617Then start the server:1819```bash20editorconfig-mcp-server21```2223### Using npx (No Installation)2425```bash26npx editorconfig-mcp-server27```2829### Local Installation3031```bash32npm install editorconfig-mcp-server33```3435Then add to your project's scripts in `package.json`:3637```json38{39 "scripts": {40 "format-server": "editorconfig-mcp-server"41 }42}43```4445### From Source4647```bash48git clone https://github.com/yourusername/editorconfig-mcp-server.git49cd editorconfig-mcp-server50npm install51npm start52```5354## Features5556- **MCP Compliant**: Follows all MCP design patterns and best practices57- **JSON Schema Validation**: All inputs are validated using JSON Schema58- **Rate Limiting**: Built-in rate limiting (100 requests/minute)59- **OpenAPI Spec**: Self-documenting API with OpenAPI 3.0 specification60- **Versioned API**: Uses semantic versioning with `/v1/` prefix61- **Stateless**: No state retained between requests62- **Security**: Path validation prevents directory traversal attacks63- **Error Handling**: Consistent error format with helpful hints6465## Installation6667```bash68npm install69```7071## Usage7273### Starting the Server7475```bash76# If installed globally77editorconfig-mcp-server7879# Using npx80npx editorconfig-mcp-server8182# With custom port83PORT=8080 editorconfig-mcp-server8485# From source86npm start87```8889The server will start on port 8432 by default.9091### Configuration9293- `PORT` - Server port (default: 8432)94 - Default port chosen to avoid conflicts with common development servers95 - Example: `PORT=8080 editorconfig-mcp-server`9697### Integration with AI Tools9899#### Claude Code100101To add this server to Claude Code, run:102103```bash104claude mcp add editorconfig npx editorconfig-mcp-server105```106107#### Other MCP-Compatible Tools108109This server is designed to be used with AI coding assistants that support MCP. Configure your AI tool to connect to:110111- Base URL: `http://localhost:8432`112- Protocol: MCP over HTTP113114## API Endpoints115116### Tools (Actions)117118#### `POST /v1/tools/format_file`119120Format a single file using .editorconfig rules.121122**Request:**123124```json125{126 "file_path": "src/index.js"127}128```129130**Response:**131132```json133{134 "success": true,135 "file_path": "src/index.js",136 "bytes": 1234137}138```139140#### `POST /v1/tools/format_files`141142Format multiple files matching a glob pattern.143144**Request:**145146```json147{148 "pattern": "**/*.js"149}150```151152**Response:**153154```json155{156 "success": true,157 "pattern": "**/*.js",158 "count": 5,159 "files": ["src/index.js", "src/utils.js", ...]160}161```162163### Metadata164165- `GET /openapi.json` - OpenAPI 3.0 specification166- `GET /.well-known/mcp/servers.json` - MCP server manifest167- `GET /health` - Health check endpoint168169## Error Handling170171All errors follow a consistent format:172173```json174{175 "error": "Error type",176 "message": "Human-readable message",177 "hint": "Helpful suggestion",178 "expected_format": {} // Optional, for validation errors179}180```181182## Rate Limiting183184The server implements rate limiting:185186- Window: 1 minute187- Max requests: 100 per window188- Returns 429 status when exceeded189190## Security191192- Input validation using JSON Schema193- Path traversal protection194- Payload size limit (1MB)195- Ignores sensitive directories (node_modules, .git)196197## Versioning198199This project follows [Semantic Versioning](https://semver.org/):200201- MAJOR version for incompatible API changes202- MINOR version for backwards-compatible functionality additions203- PATCH version for backwards-compatible bug fixes204205To release a new version:206207```bash208# For a patch release (1.0.0 -> 1.0.1)209npm version patch210211# For a minor release (1.0.0 -> 1.1.0)212npm version minor213214# For a major release (1.0.0 -> 2.0.0)215npm version major216```217218This will:2192201. Run the linter2212. Update the version in package.json2223. Create a git commit and tag2234. Push the commit and tag to GitHub224225## Publishing226227### NPM Package228229To publish this package to npm:2302311. Create an npm account at https://www.npmjs.com2322. Login to npm: `npm login`2333. Update version using `npm version` (see above)2344. Run: `npm publish`235236For automated publishing via GitHub:2372381. Add your npm token as a GitHub secret named `NPM_TOKEN`2392. Create a GitHub release - the publish workflow will automatically publish to npm240241### MCP Server Registry242243To register this server in the MCP registry:2442451. Ensure your server implements the MCP specification2462. Host your server publicly (e.g., npm, GitHub releases)2473. Submit a PR to the MCP registry repository248249## Development250251```bash252# Install dependencies253npm install254255# Run linter256npm run lint257258# Fix linting issues259npm run lint:fix260261# Start server262npm start263```264265## License266267MIT268
Full transparency — inspect the skill content before installing.