Purpose
editorconfig_mcp is a Model Context Protocol (MCP) compatible server used to format files using .editorconfig rules. It originated from a specific problem the author encountered in AI-assisted development: code generated by AI coding agents often contains subtle formatting errors, such as trailing whitespace or inconsistent line endings, which are then flagged by linters, causing the agent to spend valuable cycles fixing its own simple mistakes. This tool acts as a proactive formatting gatekeeper, using the project's .editorconfig rules to ensure files are correct from the start.
Key Capabilities
- Follows MCP design patterns and best practices.
- Validates all input using JSON Schema.
- Built-in rate limiting: 100 requests per minute.
- Provides an OpenAPI 3.0 specification for a self-describing API.
- Uses a semantically versioned API with a /v1/ prefix.
- Stateless: no state is retained between requests.
- Security: path validation prevents directory traversal attacks.
- Error handling: consistent error format with useful hints.
Usage
Installation
- Global installation (recommended)
- Use npx (no installation required)
- Local installation: then add it to the scripts in the project package.json
Starting the Server
The server starts on port 8432 by default. The port can be configured via the PORT environment variable, for example: PORT=8080 editorconfig-mcp-server. The default port was chosen to avoid conflicts with common development servers.
Integration with AI Tools
To add this server to Claude Code, run the corresponding command. This server is designed for AI coding assistants that support MCP. Configure your AI tool to connect to:
- Base URL: http://localhost:8432
- Protocol: MCP over HTTP
Tools (Actions)
- Format a single file using .editorconfig rules.
- Format multiple files using glob patterns.
Endpoints
- GET /openapi.json - OpenAPI 3.0 specification
- GET /.well-known/mcp/servers.json - MCP server manifest
- GET /health - Health check endpoint
All errors follow a consistent format. The server implements rate limiting: a window of 1 minute, a maximum of 100 requests per window, and returns a 429 status when exceeded.
Security and Validation
- Input validation using JSON Schema.
- Path traversal protection.
- Payload size limit (1MB).
- Ignore sensitive directories (node_modules, .git).
Releases
The project follows semantic versioning:
- MAJOR version for incompatible API changes
- MINOR version for backward-compatible feature additions
- PATCH version for backward-compatible bug fixes
Steps to release a new version:
- Update the version number in package.json
- Create a git commit and tag
- Push the commit and tag to GitHub
Publishing to npm:
- At https://www.npmjs.com create an npm account
- Log in to npm: npm login
- Update the version using npm version (see above)
- Run: npm publish
Automatic publishing via GitHub:
- Add the npm token as a GitHub secret named NPM_TOKEN
- Create a GitHub release - the publish workflow will automatically publish to npm
Registering with the MCP server registry:
- Ensure the server implements the MCP specification
- Publicly host the server (e.g. npm, GitHub releases)
- Submit a PR to the MCP registry repository
Use Cases
Suitable for developers using AI coding assistants (such as Claude Code) who want to ensure that AI-generated code automatically follows the project's .editorconfig formatting rules before committing, reducing linter errors and agent correction loops caused by formatting issues.
Limitations
The source material does not clearly mention the range of supported file types, the specific contents of the installation commands, the detailed parameters of MCP tool calls, or examples of integration with other AI tools. Some features, such as the specific behavior of rate limiting and the detailed contents of the error format, are not fully elaborated.