Knip Mcp Server
@gtrias
About Knip Mcp Server
This MCP server provides AI agents with powerful code cleanup capabilities through knip.dev integration. It's designed to work seamlessly with Cursor AI and other MCP-compatible tools to maintain clean, efficient codebases.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"knip": {
"command": "npx",
"args": [
"@genar/knip-mcp-server"
],
"env": {
"KNIP_PROJECT_ROOT": ".",
"KNIP_LOG_LEVEL": "info",
"KNIP_SAFE_MODE": "true"
}
}
}
}Tools
10Run comprehensive code analysis
Find unused files
Find unused exports
Find unused imports
Find unused dependencies
Safely remove unused files
Clean up unused imports
Auto-fix common issues
View knip configuration
Validate knip config
Overview
What is Knip Mcp Server?
Knip Mcp Server is a Model Context Protocol (MCP) server that integrates with knip.dev to help AI agents identify and clean up unused files, imports, exports, and dependencies in JavaScript/TypeScript projects. It is designed for developers using MCP-compatible tools like Cursor AI.
How to use Knip Mcp Server?
Install globally (npm install -g @genar/knip-mcp-server) or locally in your project, then run knip-mcp-server or npx @genar/knip-mcp-server. Configure via environment variables (KNIP_PROJECT_ROOT, KNIP_CONFIG_PATH, KNIP_BACKUP_DIR, KNIP_LOG_LEVEL, KNIP_SAFE_MODE). Integrate with Cursor AI by adding an MCP server entry, Cursor rules, or a per-project .mcp-config.json file.
Key features of Knip Mcp Server
- Comprehensive code analysis via knip
- Unused file, import, export, and dependency detection
- Safe removal with dry-run mode and automatic backups
- Full workspace and monorepo support
- Safety measures (file limits, critical‑file protection)
- Backup mechanisms before destructive operations
Use cases of Knip Mcp Server
- Clean up unused code after implementing a new feature
- Audit npm dependencies for unused packages
- Run a project health check with recommendations
FAQ from Knip Mcp Server
What safety features does Knip Mcp Server provide?
All destructive operations default to dry‑run mode. Automatic backups are created before modifications. Safe mode prevents removal of critical files (e.g., package.json). Configurable file limits prevent accidental bulk deletions.
How can I integrate Knip Mcp Server with Cursor AI?
Three options: 1) Add a server in Cursor MCP settings with command npx @genar/knip-mcp-server. 2) Create a .cursor/rules/knip-mcp.md file with workflow rules. 3) Create a per‑project .mcp-config.json file and reference it in Cursor’s MCP settings.
Does Knip Mcp Server support monorepos?
Yes, it has full workspace support. The knip_scan, knip_get_unused_files, and other tools accept a workspace parameter for analyzing specific workspaces.
What configuration files are supported?
The server supports knip.json, knip.jsonc, .knip.json, .knip.jsonc, knip.config.js, and knip.config.ts.
Frequently asked questions
What safety features does Knip Mcp Server provide?
All destructive operations default to dry‑run mode. Automatic backups are created before modifications. Safe mode prevents removal of critical files (e.g., `package.json`). Configurable file limits prevent accidental bulk deletions.
How can I integrate Knip Mcp Server with Cursor AI?
Three options: 1) Add a server in Cursor MCP settings with command `npx @genar/knip-mcp-server`. 2) Create a `.cursor/rules/knip-mcp.md` file with workflow rules. 3) Create a per‑project `.mcp-config.json` file and reference it in Cursor’s MCP settings.
Does Knip Mcp Server support monorepos?
Yes, it has full workspace support. The `knip_scan`, `knip_get_unused_files`, and other tools accept a `workspace` parameter for analyzing specific workspaces.
What configuration files are supported?
The server supports `knip.json`, `knip.jsonc`, `.knip.json`, `.knip.jsonc`, `knip.config.js`, and `knip.config.ts`.
Basic information
More Developer Tools MCP servers
Grafana MCP server
grafanaMCP server for Grafana
Unity MCP (Server + Plugin)
IvanMurzakAI Skills, MCP Tools, and CLI for Unity Engine. Full AI develop and test loop. Use cli for quick setup. Efficient token usage, advanced tools. Any C# method may be turned into a tool by a single line. Works with Claude Code, Gemini, Copilot, Cursor and any other absolutely for fr
OpenSumi
opensumiA framework helps you quickly build AI Native IDE products. MCP Client, supports Model Context Protocol (MCP) tools via MCP server.
Altronis
sypherinMCP server + CLI for Altronis — Singapore AI consulting. Ask the Lyra consultant, generate a grant-matched AI transformation plan, pull curated SG AI events/news. Read-only, wraps altronis.sg.
mcp-excalidraw
yctimlinMCP server and Claude Code skill for Excalidraw — programmatic canvas toolkit to create, edit, and export diagrams via AI agents with real-time canvas sync.
Comments