- ConnectWise Manage MCP Server
ConnectWise Manage MCP Server
ConnectWise Manage MCP Server
This is a Model Context Protocol (MCP) server for the ConnectWise Manage API.
Prerequisites
- Node.js (v14 or higher)
- PowerShell 5.1 or higher
- ConnectWiseManageAPI PowerShell module (see installation options below)
- ConnectWise Manage API credentials
Installation
-
Clone or download this repository
git clone https://github.com/jasondsmith72/CWM-MCP.git cd CWM-MCP -
Install the required Node.js dependencies:
npm install -
Install the ConnectWiseManageAPI PowerShell module using one of these methods:
Option 1 (Recommended): Bundle the module with the MCP server (no external installation required)
# Run in PowerShell .\install-module.ps1 -BundleOption 2: Install the module globally via PowerShell Gallery
# Run in PowerShell as Administrator Install-Module 'ConnectWiseManageAPI'Option 3: Install the module locally via Git
# Run in PowerShell .\install-module.ps1 -Local -
Configure your environment variables by copying .env.example to .env and editing the values:
PORT=3000 CWM_SERVER=your-cwm-server CWM_COMPANY=your-company CWM_PUBKEY=your-public-key CWM_PRIVATEKEY=your-private-key CWM_CLIENTID=your-client-id -
Start the server:
npm startOr run the included batch file:
start-server.bat -
Configure Claude Desktop (manual post-installation step):
To integrate with Claude Desktop, copy the
claude_desktop_config.jsonfile to your Claude Desktop configuration directory:# Windows (default location) C:\Users\<YourUsername>\AppData\Roaming\Claude\claude_desktop_config.jsonThe configuration file contains:
{ "mcpServers": [ { "name": "ConnectWise Manage MCP", "description": "MCP server for ConnectWise Manage API integration", "proxyUrl": "http://localhost:3000" } ] }This configuration allows Claude Desktop to connect to your local MCP server and access ConnectWise Manage data.
Usage
The server implements the Model Context Protocol (MCP) for ConnectWise Manage API access.
Creating a Context
POST /context
Response:
{ "contextId": "abc123", "status": "created" }
Connecting to ConnectWise Manage
POST /context/:contextId/connect
Body (optional, will use .env values if not provided):
{ "server": "na.myconnectwise.net", "company": "your-company", "pubKey": "your-public-key", "privateKey": "your-private-key", "clientId": "your-client-id" }
Getting System Info
POST /context/:contextId/getSystemInfo
Getting Companies
POST /context/:contextId/getCompanies
Body (optional):
{ "conditions": "name like '%acme%'" }
Getting Tickets
POST /context/:contextId/getTickets
Body (optional):
{ "conditions": "status='Open'" }
Executing Custom Commands
POST /context/:contextId/executeCommand
Body:
{ "command": "Get-CWMMember", "params": { "Condition": "identifier='admin'" } }
Deleting a Context
DELETE /context/:contextId
Implementation Details
This MCP server acts as a bridge between the Model Context Protocol and the ConnectWiseManageAPI PowerShell module. It provides a RESTful API that follows the MCP protocol pattern while internally using PowerShell to execute commands against the ConnectWise Manage API.
Key components:
- server.js - The main Express.js server that implements the MCP endpoints
- powershell-bridge.js - A bridge module that executes PowerShell commands and converts between JSON and PowerShell formats
- fetch-module.ps1 - Script to download and bundle the ConnectWiseManageAPI module with the server
- modules/ConnectWiseManageAPI - Directory where the ConnectWiseManageAPI module is stored when bundled
Module Loading
The server will attempt to load the ConnectWiseManageAPI module in the following order:
- Bundled module in the modules/ConnectWiseManageAPI directory (if installed with -Bundle option)
- Local module in the modules/ConnectWiseManageAPI directory (if installed with -Local option)
- Global module installed in the PowerShell module path
Troubleshooting
If you encounter issues with the ConnectWiseManageAPI module:
- Try running the bundled installation option: .\install-module.ps1 -Bundle
- Check if the module was correctly downloaded to the modules/ConnectWiseManageAPI directory
- If using the global installation method, ensure you have administrator privileges
- Check Windows PowerShell execution policy with Get-ExecutionPolicy
License
MIT