openground install-mcp command generates and installs MCP (Model Context Protocol) server configuration for various AI agents.
Usage
Options
Automatically install to Claude Code using the
claude CLI.Requirements: Claude Code CLI must be installed and available in PATH.Automatically install to Cursor by modifying the MCP configuration file.Config Location:
- macOS:
~/.cursor/mcp.json - Linux:
~/.cursor/mcp.json - Windows:
%APPDATA%\Cursor\mcp.json
Automatically install to OpenCode by modifying the configuration file.Config Location:
~/.config/opencode/opencode.jsonGenerate WSL-compatible configuration (uses
wsl.exe wrapper).Note: Only applicable when showing JSON output (no agent flag specified).Behavior
Default (No Flags)
Shows the MCP configuration JSON that you can manually copy:Automatic Installation
When using agent-specific flags, the command:- Creates a backup of existing configuration (timestamped)
- Reads current configuration
- Adds/updates the openground entry
- Writes atomically to prevent corruption
- Validates the JSON
Safety Features
- Backups: Creates timestamped backups before modifying config files
- Validation: Validates JSON before writing
- Atomic Writes: Uses temporary files to prevent corruption
- Error Handling: Provides clear error messages and recovery instructions
Examples
Install to Claude Code
- Claude Code CLI must be installed: https://code.claude.com/docs/en/cli
Install to Cursor
Install to OpenCode
Generate WSL Configuration
Configuration Formats
Claude Code
Uses theclaude CLI:
Cursor
JSON format in~/.cursor/mcp.json:
OpenCode
JSON format in~/.config/opencode/opencode.json:
WSL (Windows Subsystem for Linux)
For running OpenGround in WSL from Windows:Troubleshooting
Claude Code: ‘claude’ CLI Not Found
Error:- Install Claude Code CLI: https://code.claude.com/docs/en/cli
- Or use manual installation:
openground install-mcp(without flags)
Invalid JSON in Config File
Error:- Fix the JSON syntax manually
- Or delete the file and reinstall:
rm ~/.cursor/mcp.json && openground install-mcp --cursor
Permission Denied
Error:After Installation
- Restart your agent (Claude Code, Cursor, or OpenCode)
- Verify installation:
- Claude Code:
claude mcp list - Cursor/OpenCode: Check MCP settings in the UI
- Claude Code:
- Test the connection:
- Ask the agent to search your documentation
- Example: “Search my OpenAI docs for authentication”
Related Commands
- openground add - Add documentation to search
- openground list - View available libraries
- openground config - Configure OpenGround