OpenSpec MCP - NPX Package
OpenSpec MCP Server for Cursor IDE - AI-powered API specification generation and management. Now available as an NPX package for easy installation!
About OpenSpec
OpenSpec is an AI-powered tool for generating, managing, and validating API specifications. This MCP server provides seamless integration with Cursor IDE.
🚀 Quick Start (NPX Method - Recommended)
The easiest way to use OpenSpec MCP is via NPX. No manual installation required!
1. Configure Cursor
Open or create ~/.cursor/mcp.json:
Windows: C:\Users\<YourUsername>\.cursor\mcp.json
macOS/Linux: ~/.cursor/mcp.json
Add the OpenSpec MCP configuration:
{
"mcpServers": {
"openspec": {
"command": "npx",
"args": ["-y", "openspec-mcp-x@latest"],
"env": {}
}
}
}
⚠️ If you already have other MCP servers, add the "openspec" entry to your existing "mcpServers" object (don't replace the entire file).
2. Restart Cursor
Completely quit and restart Cursor IDE.
3. Verify Installation
In Cursor, ask the AI:
Check OpenSpec installation status
That's it! The NPX package will automatically:
- ✅ Detect and use your Python installation (3.10+)
- ✅ Install required Python dependencies (mcp, requests)
- ✅ Set up the MCP server for you
4. Install OpenSpec CLI (Required)
OpenSpec MCP requires the OpenSpec CLI tool. Install it with:
npm install -g @fission-ai/openspec
Verify installation:
openspec --version
Requirements
1. Python 3.10+
For running the MCP server.
Check if installed:
python --version
python3 --version
If not installed or version is below 3.10:
2. Node.js & npm
Required for OpenSpec CLI to work.
Check if installed:
node --version
npm --version
If not installed, follow the installation guide for your platform:
🪟 Windows Installation
⚠️ IMPORTANT FOR WINDOWS: All commands below include non-interactive flags to avoid installation prompts. This is crucial when AI assistants execute these commands.
Method 1: winget (Recommended - Windows 10+)
# Install Node.js LTS with non-interactive flags
# These flags prevent interactive prompts that would block automated installation
winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
# After installation, restart your terminal and verify
node --version
npm --version
Method 2: Chocolatey
# Install Node.js LTS with -y flag to skip confirmation
choco install nodejs-lts -y
# Verify installation
node --version
npm --version
Method 3: Scoop
# Scoop is non-interactive by default
scoop install nodejs-lts
node --version
npm --version
Method 4: Manual Download
- Visit https://nodejs.org/
- Download the LTS (Long Term Support) version installer
- Run the installer (requires administrator privileges)
- Follow the installation wizard
- Restart your terminal after installation
- Verify:
node --version and npm --version
📝 Note: After installation on Windows, you MUST restart your terminal or IDE for the PATH environment variable to be updated. If commands still don't work, restart your computer.
🍎 macOS Installation
Method 1: Homebrew (Recommended)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node@20
node --version
npm --version
Method 2: nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install --lts
nvm use --lts
node --version
npm --version
Method 3: Manual Download
- Visit https://nodejs.org/
- Download the LTS version for macOS
- Open the .pkg file and follow the installer
- Verify:
node --version and npm --version
✅ Post-Installation Verification
After installing Node.js and npm, verify the installation:
node --version
npm --version
npm install -g npm@latest
🔧 Troubleshooting Node.js Installation
Windows - Command not found after installation:
- Close all terminal windows completely
- Open a new terminal/PowerShell window
- Try again:
node --version
- If still not working, restart your computer
- Environment variable refresh is required on Windows
macOS - Permission errors with npm:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile
Verify PATH:
- Node.js should be added to your system PATH automatically
- If commands don't work, check if the installation directory is in your PATH
- Windows:
C:\Program Files\nodejs\
- macOS (Homebrew):
/usr/local/bin/ or /opt/homebrew/bin/
3. Cursor IDE
The IDE this MCP server integrates with.
🤖 For AI Assistants: Automated Prerequisite Installation
If you're an AI assistant helping users set up OpenSpec MCP, follow this automated workflow:
Step 1: Check Current System
First, detect the platform and check what's already installed:
winget --version
brew --version
Step 2: Auto-detect Missing Prerequisites
Check each requirement:
python --version || python3 --version
node --version
npm --version
pip --version || pip3 --version
Step 3: Install Missing Components
Based on detection results, use the appropriate commands from the platform-specific sections above.
🪟 Windows Workflow (Non-Interactive Commands)
⚠️ CRITICAL FOR WINDOWS: ALWAYS use non-interactive flags to prevent installation prompts!
# If Node.js/npm is missing, use winget with non-interactive flags:
winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
# Alternative with Chocolatey (if available):
choco install nodejs-lts -y
# After installation, MUST restart terminal or commands won't be found
# Remind user to close and reopen terminal/IDE
# Then verify installation:
node --version
npm --version
Why non-interactive flags are essential on Windows:
--accept-package-agreements: Auto-accepts package license agreements
--accept-source-agreements: Auto-accepts source agreements (e.g., Microsoft Store terms)
- Without these flags, the command will pause and wait for user input, blocking automated installations
🍎 macOS Workflow
brew --version || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node@20
node --version
npm --version
Step 4: Install OpenSpec CLI
After ensuring Node.js and npm are installed:
npm install -g @fission-ai/openspec
openspec --version
Important for Windows users:
- On Windows, if
openspec command is not found after installation, the user needs to restart their terminal
- npm global packages are installed to:
C:\Users\<Username>\AppData\Roaming\npm
- This path should be in the system PATH after Node.js installation
Step 5: Proceed with MCP Server Setup
Once all prerequisites are confirmed, continue with the Installation section below.
💡 Essential Tips for AI Assistants
For Windows:
- ⚠️ ALWAYS use non-interactive flags:
--accept-package-agreements --accept-source-agreements
- ⚠️ ALWAYS remind users to restart terminal after Node.js installation
- Environment variables only refresh after terminal restart
- If user reports "command not found" after installation → they need to restart terminal
For macOS:
- Check if Homebrew is installed before using it
- Use
python3 and pip3 commands (not python and pip)
- npm permission issues can be fixed with the npm-global setup (see troubleshooting section)
General:
- Always verify each component after installation before proceeding
- Check version numbers to ensure requirements are met (Python 3.10+, Node.js 18+)
- If a command fails, provide the relevant troubleshooting section link
- Test OpenSpec CLI installation before proceeding to MCP server setup
📦 Alternative Installation Methods
Method 1: NPX (Recommended - See Quick Start Above)
The NPX method is the easiest and doesn't require manual installation. See the Quick Start section above.
Method 2: Manual Installation (Advanced)
If you prefer to install manually or need a development setup:
1. Verify Your Python Command
First, check which Python command works on your system:
python --version
python3 --version
Remember which command works (either python or python3), you'll need it in step 3.
2. Install Python Package
Navigate to the openspec-mcp directory and install:
cd D:\Tools\0mcp\openspec-mcp
pip install -e .
3. Configure Cursor
Configuration File Location
All platforms: ~/.cursor/mcp.json
- macOS/Linux:
~/.cursor/mcp.json
- Windows:
C:\Users\<YourUsername>\.cursor\mcp.json
💡 Tip: This is Cursor's main MCP configuration file, shared by all MCP servers.
⚠️ IMPORTANT: Adding vs. Creating Configuration
Option A: If the configuration file does NOT exist (first MCP server):
Create the file ~/.cursor/mcp.json with this content:
{
"mcpServers": {
"openspec": {
"command": "REPLACE_WITH_YOUR_PYTHON_COMMAND",
"args": ["-m", "openspec_mcp.server"],
"env": {}
}
}
}
⚠️ Replace REPLACE_WITH_YOUR_PYTHON_COMMAND with the command you verified in step 1 (python or python3).
Option B: If the configuration file ALREADY exists (adding to existing MCP servers):
⚠️ DO NOT replace the entire file! Only add the "openspec" entry inside the existing "mcpServers" object.
Example - if your current config has other servers:
{
"mcpServers": {
"some-other-server": {
"command": "...",
"args": ["..."],
"env": {}
}
}
}
Add the openspec entry like this (add a comma after the previous server):
{
"mcpServers": {
"some-other-server": {
"command": "...",
"args": ["..."],
"env": {}
},
"openspec": {
"command": "REPLACE_WITH_YOUR_PYTHON_COMMAND",
"args": ["-m", "openspec_mcp.server"],
"env": {}
}
}
}
⚠️ Remember to replace REPLACE_WITH_YOUR_PYTHON_COMMAND with your verified Python command.
✅ Multiple MCP servers can coexist in the same configuration file!
4. Restart Cursor
Completely quit and restart Cursor.
✅ Verification
After installation (either NPX or manual method), verify in Cursor:
Check OpenSpec installation status
Or use the tool directly:
Use check_openspec_status tool
This will confirm:
- ✅ Python is installed and accessible
- ✅ MCP dependencies are installed
- ✅ OpenSpec CLI is available
- ✅ MCP server is running correctly
Available Tools
check_openspec_status - Check if OpenSpec is installed and get version info
openspec_init - Initialize OpenSpec in a directory
openspec_generate - Generate API specification
openspec_validate - Validate an API specification file
openspec_help - Get help information about OpenSpec commands
Usage Examples
Check Installation Status
Use check_openspec_status tool
This will check if OpenSpec CLI is installed and show version info.
Install OpenSpec CLI
Make sure Node.js and npm are installed first (see Requirements section).
Install OpenSpec CLI using npm:
npm install -g @fission-ai/openspec
Verify installation:
openspec --version
Initialize OpenSpec in a Project
Use openspec_init tool with:
- directory: ./my-project
Generate API Specification
Use openspec_generate tool with:
- directory: ./my-project
- output: ./api/openapi.yaml
- format: openapi
Validate Specification
Use openspec_validate tool with:
- file_path: ./api/openapi.yaml
Workflow
-
Install Node.js and npm (if not already installed):
-
Install OpenSpec CLI (first time only):
npm install -g @fission-ai/openspec
-
Check installation:
Use check_openspec_status tool
-
Initialize in your project:
Use openspec_init tool with directory: ./my-project
-
Generate specifications:
Use openspec_generate tool with directory: ./my-project
-
Validate specifications:
Use openspec_validate tool with file_path: ./api/spec.yaml
Troubleshooting
MCP Server Not Showing
- Check Python version:
python --version or python3 --version (must be 3.10+)
- Verify configuration file path
- Restart Cursor completely
- Check Cursor developer console for errors
Dependency Installation Failed
python -m pip install --upgrade pip
pip cache purge
pip install -e .
OpenSpec CLI Not Found
1. Check if Node.js and npm are installed:
node --version
npm --version
If not found, install Node.js from https://nodejs.org/ or use package managers (see Requirements).
2. Install OpenSpec CLI:
npm install -g @fission-ai/openspec
3. Verify installation:
openspec --version
4. Test with MCP:
Use check_openspec_status tool
npm Permission Errors (macOS/Linux)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile
Configuration
OpenSpec can be configured through its configuration files. After running openspec_init, you'll find configuration files in your project directory.
Refer to the OpenSpec documentation for detailed configuration options.
License
MIT
📦 Package Information
NPX Package
npm install -g openspec-mcp-x
npx openspec-mcp-x@latest
Version History
See CHANGELOG.md for version history and updates.
Publishing
For maintainers:
./publish.sh
./update.sh
Related Resources
Support
For issues related to: