textlint MCP Server Setup
Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and services through a unified interface. textlint CLI contains an MCP server that you can register with your code editor to allow LLMs to use textlint directly.
Prerequisites
- textlint v14.8.0 or later
- AI-powered code editor with MCP support (VS Code with Copilot Chat, Cursor, or Windsurf)
- A configured textlint project - The MCP server requires an existing textlint configuration since textlint has no default rules
Quick Start
First, you need to set up textlint in your project. textlint has no default rules, so you must configure rules before using the MCP server. See the Configuring textlint guide for setup instructions.
After setting up textlint, start the MCP server with:
npx textlint --mcp
This starts textlint as an MCP server using stdio transport, allowing AI assistants to interact with textlint's linting and fixing capabilities.
Setup in Different Editors
VS Code with GitHub Copilot
To configure textlint MCP server in VS Code, create a .vscode/mcp.json
file in your project:
{
"servers": {
"textlint": {
"type": "stdio",
"command": "npx",
"args": ["textlint", "--mcp"]
}
}
}
Alternatively, you can use the Command Palette:
- Press
Ctrl+Shift+P
(Windows/Linux) orCmd+Shift+P
(macOS) - Type and select
MCP: Add Server
- Select
Command (stdio)
from the dropdown - Enter
npx textlint --mcp
as the command - Type
textlint
as the server ID - Choose
Workspace Settings
to create the configuration in.vscode/mcp.json
Cursor
Create a .cursor/mcp.json
file in your project directory:
{
"mcpServers": {
"textlint": {
"command": "npx",
"args": ["textlint", "--mcp"],
"env": {}
}
}
}
For global configuration, create ~/.cursor/mcp.json
in your home directory with the same configuration.
Windsurf
- Navigate to Windsurf → Settings → Advanced Settings
- Scroll down to the Cascade section and click "Add Server"
- Select "Add custom server +"
- Add the following configuration to your
~/.codeium/windsurf/mcp_config.json
:
{
"mcpServers": {
"textlint": {
"command": "npx",
"args": ["textlint", "--mcp"],
"env": {}
}
}
}
- Press the refresh button to update the available MCP servers
Available Tools
The textlint MCP server provides four main tools:
lintFile
Lint one or more files using textlint configuration.
Parameters:
filePaths
(Array): File paths to lint
Example usage:
"Lint the current file for text issues"
lintText
Lint raw text content using textlint configuration.
Parameters:
text
(String): Text content to lintstdinFilename
(String): Filename to use for the text (affects rule application)
Example usage:
"Check this text for writing issues: 'This is a sample text.'"
getLintFixedFileContent
Get lint-fixed content of files using textlint's auto-fix capability. This tool returns the corrected content without modifying the original files.
Parameters:
filePaths
(Array): File paths to get fixed content for
Example usage:
"Get the textlint auto-fixed version of the current file"
getLintFixedTextContent
Get lint-fixed content of raw text using textlint's auto-fix capability.
Parameters:
text
(String): Text content to get fixed version ofstdinFilename
(String): Filename to use for the text
Example usage:
"Get the auto-fixed version of this text and show me the corrected content"
Configuration
Important: The textlint MCP server requires an existing textlint configuration to function properly. textlint doesn't include any rules by default, so you must configure your project before using the MCP server.
The textlint MCP server uses your existing textlint configuration:
.textlintrc.json
or other textlint config files- Installed textlint rules and plugins
- Standard textlint ignore patterns
Setting up textlint (Required)
Before using the MCP server, make sure you have:
- A textlint configuration file in your project (
.textlintrc.json
,.textlintrc.js
, etc.) - Required textlint rules installed as dependencies
- Appropriate plugins for your file types
For detailed configuration instructions, see Configuring textlint.
Example Prompts
Here are some example prompts you can use with AI assistants:
Lint the current file with textlint MCP and explain any text issues found
Get the auto-fixed content for src/README.md using textlint
Check this markdown text for writing problems and show me the corrected version
Get textlint auto-fixed content for all files in the docs/ directory
Troubleshooting
If you encounter issues with the textlint MCP server:
- Check MCP server status: Use your editor's MCP server list/status feature
- Verify textlint installation: Ensure textlint and your rules are properly installed
- Check configuration: Verify your
.textlintrc
file is valid - Review logs: Check MCP server logs for error messages
- Test manually: Try running
npx textlint --mcp
in your terminal to see if the server starts
Common issues:
- Missing textlint configuration file
- Uninstalled textlint rules or plugins
- Incorrect file paths in MCP configuration
- Version compatibility (requires textlint v14.8.0+)
Additional Resources
- textlint Documentation
- Model Context Protocol Documentation
- VS Code MCP Servers Documentation
- GitHub Pull Request #1522 - Original MCP implementation
References: