@mmdnzhd/mcp-cursor
v2.0.1
Published
MCP server for Cursor IDE integration - provides AI-powered code analysis, Git operations, testing, and more via cursor-agent CLI
Downloads
220
Maintainers
Readme
MCP Cursor Server
یک MCP Server قدرتمند برای Cursor IDE که امکانات پیشرفتهای مثل تحلیل کد، عملیات Git، تستنویسی و بیشتر را از طریق cursor-agent CLI فراهم میکند.
A powerful MCP (Model Context Protocol) server for Cursor IDE that provides advanced features like code analysis, Git operations, test generation, and more through cursor-agent CLI integration.
✨ Features
- 🔍 Code Analysis: Deep code analysis with metrics and quality indicators
- 🔧 Git Operations: Commit, push, pull, diff, status with conventional commits support
- 🧪 Test Generation: Automatic test generation and execution
- 📁 File Operations: Create, read, write, delete, copy, move files
- 🔎 Code Search: Advanced code search with regex and filtering
- 🤖 AI-Powered: Deep search and code explanation capabilities
- 🎯 Navigation: Go to line, go to symbol, find definitions and usages
- 📦 Workspace Management: Project creation and workspace switching
- 🔌 Extension Management: Install and manage Cursor extensions
- ⚡ Free Prompt Execution: Execute custom operations with safety features
📋 Prerequisites
Before using this MCP server, you need to have cursor-agent CLI installed and configured:
For Linux/macOS:
# Install cursor-agent globally
npm install -g cursor-agentFor Windows:
Important: On Windows, cursor-agent only works through WSL (Windows Subsystem for Linux).
Install WSL (if not already installed):
wsl --installInside WSL, install cursor-agent:
wsl npm install -g cursor-agentMake sure WSL is accessible from Windows PATH
Note: The MCP server automatically detects Windows and runs cursor-agent through WSL.
🚀 Installation
Method 1: Using NPX (Recommended)
Add to your MCP configuration file (.kiro/settings/mcp.json or ~/.kiro/settings/mcp.json):
{
"mcpServers": {
"cursor-mcp": {
"command": "npx",
"args": ["-y", "@mmdnzhd/mcp-cursor"]
}
}
}Method 2: Global Installation
npm install -g @mmdnzhd/mcp-cursorThen in your MCP config:
{
"mcpServers": {
"cursor-mcp": {
"command": "mcp-cursor"
}
}
}🔧 Configuration
The server automatically handles session management and workspace context. No additional configuration is required.
Optional Environment Variables
You can set these environment variables for customization:
{
"mcpServers": {
"cursor-mcp": {
"command": "npx",
"args": ["-y", "@mmdnzhd/mcp-cursor"],
"env": {
"CURSOR_AGENT_TIMEOUT": "120000"
}
}
}
}📚 Available Tools
Code Analysis
analyze_code- Analyze code with multiple depth levelsget_code_issues- Get code issues with filtering and sorting
Git Operations
git_commit- Commit with conventional commits supportgit_push- Push to remotegit_pull- Pull from remotegit_diff- Show differencesgit_status- Show repository status
Testing
generate_test- Generate tests for filesrun_tests- Execute testsget_test_coverage- Get coverage reports
File Operations
create_file,delete_file,copy_file,move_fileread_file,write_file
Code Search & Navigation
search_code- Advanced code searchfind_definition- Find symbol definitionsfind_usages- Find symbol usagesgo_to_line,go_to_symbol- Navigate code
AI-Powered Features
ai_deep_search- Deep web search across multiple sourcesai_explain_deep- Comprehensive code explanations
And More!
- Code editing (add function, add class, insert code)
- Terminal integration
- Workspace management
- Extension management
- Free prompt execution with safety features
🎯 Usage Examples
Example 1: Analyze Code
// The MCP client will call:
{
"tool": "analyze_code",
"arguments": {
"filePath": "src/index.ts",
"analysisLevel": "deep"
}
}Example 2: Git Commit with Conventional Commits
{
"tool": "git_commit",
"arguments": {
"message": "feat: add new feature",
"conventional": true,
"all": true
}
}Example 3: Search Code
{
"tool": "search_code",
"arguments": {
"query": "function.*export",
"useRegex": true,
"fileTypes": ["ts", "js"]
}
}🏗️ Architecture
This MCP server acts as a bridge between MCP clients (like Kiro, Claude Desktop, etc.) and cursor-agent CLI:
MCP Client → MCP Cursor Server → cursor-agent CLI → Cursor IDEThe server:
- Receives tool calls from MCP clients
- Translates them into cursor-agent CLI commands
- Executes the commands with proper error handling
- Formats and returns structured responses
🔒 Safety Features
The execute_free_prompt tool includes safety features:
- Safe mode enabled by default
- Blocks dangerous operations
- Protects critical files
- Dry-run mode for previewing changes
- Confirmation requirements for destructive operations
🛠️ Development
Build
npm run buildRun Locally
npm startProject Structure
mcp-cursor/
├── src/
│ ├── index.ts # Main server logic
│ ├── cursor-tools.ts # Tool definitions
│ └── tool-prompts.ts # Prompt templates
├── build/ # Compiled output
├── package.json
├── tsconfig.json
└── README.md🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📝 License
MIT License - see LICENSE file for details
🐛 Troubleshooting
cursor-agent not found
On Linux/macOS:
# Check if cursor-agent is available
cursor-agent --version
# If not, install it
npm install -g cursor-agentOn Windows:
# Make sure WSL is installed
wsl --version
# Check cursor-agent inside WSL
wsl cursor-agent --version
# If not found, install inside WSL
wsl
npm install -g cursor-agent
exitWSL Issues on Windows
If you get "WSL not found" error:
- Install WSL:
wsl --install - Restart your computer
- Open WSL and install Node.js:
wsl curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs npm install -g cursor-agent
Permission Issues
On Unix systems, you might need to make the script executable:
chmod +x node_modules/.bin/mcp-cursorSession Issues
The server maintains sessions per workspace. If you encounter session issues, restart the MCP server.
📞 Support
- NPM Package: @mmdnzhd/mcp-cursor
- Author: mmdnzhd
🙏 Acknowledgments
- Built on Model Context Protocol
- Powered by cursor-agent
- Inspired by the Cursor IDE community
نصب و راهاندازی (فارسی)
پیشنیازها
برای لینوکس/مک:
npm install -g cursor-agentبرای ویندوز:
مهم: در ویندوز، cursor-agent فقط از طریق WSL کار میکند.
- نصب WSL (اگر نصب نیست):
wsl --install- داخل WSL، cursor-agent را نصب کنید:
wsl
npm install -g cursor-agentنصب
در فایل .kiro/settings/mcp.json یا ~/.kiro/settings/mcp.json:
{
"mcpServers": {
"cursor-mcp": {
"command": "npx",
"args": ["-y", "@mmdnzhd/mcp-cursor"]
}
}
}استفاده
بعد از نصب، تمام ابزارها از طریق MCP client شما قابل دسترسی هستند.
Made with ❤️ for the Cursor community
