editorconfig_mcp

editorconfig_mcp

Formats files using .editorconfig rules to ensure consistent formatting, especially for AI-generated code.

Category
访问服务器

README

EditorConfig MCP Server

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 valuable cycles fixing its own simple mistakes.

This 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.

Installation

Global Installation (Recommended)

npm install -g editorconfig-mcp-server

Then start the server:

editorconfig-mcp-server

Using npx (No Installation)

npx editorconfig-mcp-server

Local Installation

npm install editorconfig-mcp-server

Then add to your project's scripts in package.json:

{
  "scripts": {
    "format-server": "editorconfig-mcp-server"
  }
}

From Source

git clone https://github.com/yourusername/editorconfig-mcp-server.git
cd editorconfig-mcp-server
npm install
npm start

Features

  • MCP Compliant: Follows all MCP design patterns and best practices
  • JSON Schema Validation: All inputs are validated using JSON Schema
  • Rate Limiting: Built-in rate limiting (100 requests/minute)
  • OpenAPI Spec: Self-documenting API with OpenAPI 3.0 specification
  • Versioned API: Uses semantic versioning with /v1/ prefix
  • Stateless: No state retained between requests
  • Security: Path validation prevents directory traversal attacks
  • Error Handling: Consistent error format with helpful hints

Installation

npm install

Usage

Starting the Server

# If installed globally
editorconfig-mcp-server

# Using npx
npx editorconfig-mcp-server

# With custom port
PORT=8080 editorconfig-mcp-server

# From source
npm start

The server will start on port 8432 by default.

Configuration

  • PORT - Server port (default: 8432)
    • Default port chosen to avoid conflicts with common development servers
    • Example: PORT=8080 editorconfig-mcp-server

Integration with AI Tools

Claude Code

To add this server to Claude Code, run:

claude mcp add editorconfig npx editorconfig-mcp-server

Other MCP-Compatible Tools

This server is designed to be used with AI coding assistants that support MCP. Configure your AI tool to connect to:

  • Base URL: http://localhost:8432
  • Protocol: MCP over HTTP

API Endpoints

Tools (Actions)

POST /v1/tools/format_file

Format a single file using .editorconfig rules.

Request:

{
  "file_path": "src/index.js"
}

Response:

{
  "success": true,
  "file_path": "src/index.js",
  "bytes": 1234
}

POST /v1/tools/format_files

Format multiple files matching a glob pattern.

Request:

{
  "pattern": "**/*.js"
}

Response:

{
  "success": true,
  "pattern": "**/*.js",
  "count": 5,
  "files": ["src/index.js", "src/utils.js", ...]
}

Metadata

  • GET /openapi.json - OpenAPI 3.0 specification
  • GET /.well-known/mcp/servers.json - MCP server manifest
  • GET /health - Health check endpoint

Error Handling

All errors follow a consistent format:

{
  "error": "Error type",
  "message": "Human-readable message",
  "hint": "Helpful suggestion",
  "expected_format": {} // Optional, for validation errors
}

Rate Limiting

The server implements rate limiting:

  • Window: 1 minute
  • Max requests: 100 per window
  • Returns 429 status when exceeded

Security

  • Input validation using JSON Schema
  • Path traversal protection
  • Payload size limit (1MB)
  • Ignores sensitive directories (node_modules, .git)

Versioning

This project follows Semantic Versioning:

  • MAJOR version for incompatible API changes
  • MINOR version for backwards-compatible functionality additions
  • PATCH version for backwards-compatible bug fixes

To release a new version:

# For a patch release (1.0.0 -> 1.0.1)
npm version patch

# For a minor release (1.0.0 -> 1.1.0)
npm version minor

# For a major release (1.0.0 -> 2.0.0)
npm version major

This will:

  1. Run the linter
  2. Update the version in package.json
  3. Create a git commit and tag
  4. Push the commit and tag to GitHub

Publishing

NPM Package

To publish this package to npm:

  1. Create an npm account at https://www.npmjs.com
  2. Login to npm: npm login
  3. Update version using npm version (see above)
  4. Run: npm publish

For automated publishing via GitHub:

  1. Add your npm token as a GitHub secret named NPM_TOKEN
  2. Create a GitHub release - the publish workflow will automatically publish to npm

MCP Server Registry

To register this server in the MCP registry:

  1. Ensure your server implements the MCP specification
  2. Host your server publicly (e.g., npm, GitHub releases)
  3. Submit a PR to the MCP registry repository

Development

# Install dependencies
npm install

# Run linter
npm run lint

# Fix linting issues
npm run lint:fix

# Start server
npm start

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选