A TypeScript/JavaScript MCP server for interacting with HaloPSA Workflows API, with enhanced compatibility and reliability features.
This implementation consists of three main components:
-
Direct HaloPSA API Implementation (
src/halopsa-direct.js
): A clean, focused implementation that handles authentication and API calls directly to the HaloPSA API. -
MCP Compatibility Layer (
src/mcp-compatibility.js
): Ensures cross-compatibility between different MCP protocol implementations, including FastMCP, Azure MCP, and Browser-use MCP server. -
MCP Wrapper (
src/halopsa-mcp.js
): A thin wrapper around the direct implementation that provides the MCP interface for Claude Desktop and other AI assistants.
- Reliable Claude Desktop integration with proper connection handling
- Cross-compatible with multiple MCP protocol implementations
- Tenant parameter for authentication
- Proper scope parameter for API access
- Case-sensitive API endpoint handling
- Clear error messaging
- Token caching for performance
- Detailed logging
- Graceful shutdown handling
The MCP server provides the following tools to Claude and other compatible AI assistants:
-
getWorkflows
: Get a list of workflows from HaloPSA -
getWorkflowSteps
: Get a list of workflow steps from HaloPSA -
getWorkflow
: Get a single workflow from HaloPSA by ID -
deleteWorkflow
: Delete a workflow from HaloPSA by ID -
createWorkflows
: Create new workflows in HaloPSA
# Clone the repository
git clone https://github.com/ssmanji89/halopsa-workflows-mcp.git
cd halopsa-workflows-mcp
# Install dependencies
npm install
# Create a .env file (see below)
cp .env.example .env
# Edit the .env file with your credentials
# Start the server
npm start
Create a .env
file with your HaloPSA API credentials:
# HaloPSA API Configuration
HALOPSA_BASE_URL=https://your-instance.halopsa.com
HALOPSA_CLIENT_ID=your-client-id
HALOPSA_CLIENT_SECRET=your-client-secret
HALOPSA_TENANT=your-tenant-name
HALOPSA_SCOPE=all
LOG_LEVEL=info
- The
HALOPSA_BASE_URL
should not include trailing slashes or "/api" - The
HALOPSA_TENANT
is required for authentication - The
HALOPSA_SCOPE
must be set (default is "all") - For debugging, set
LOG_LEVEL=debug
To integrate with Claude Desktop, create a claude_desktop_config.json
file in the appropriate location for your OS:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
Example configuration:
{
"halopsa-workflows": {
"command": "npx",
"args": ["-y", "halopsa-workflows-mcp@latest"],
"env": {
"HALOPSA_BASE_URL": "https://your-instance.halopsa.com",
"HALOPSA_CLIENT_ID": "your-client-id",
"HALOPSA_CLIENT_SECRET": "your-client-secret",
"HALOPSA_TENANT": "your-tenant-name"
}
}
}
For development, you can point to your local build:
{
"halopsa-workflows": {
"command": "node",
"args": ["/path/to/halopsa-workflows-mcp/halopsa-mcp.js"],
"env": {
"HALOPSA_BASE_URL": "https://your-instance.halopsa.com",
"HALOPSA_CLIENT_ID": "your-client-id",
"HALOPSA_CLIENT_SECRET": "your-client-secret",
"HALOPSA_TENANT": "your-tenant-name",
"LOG_LEVEL": "debug"
}
}
}
This MCP server includes a compatibility layer that ensures seamless operation across different MCP implementations:
- Protocol Negotiation: Automatically detects and adapts to different MCP protocol versions
- Transport Compatibility: Works with both stdio and HTTP/SSE transport methods
- Error Handling: Enhanced error handling with fallback mechanisms for compatibility issues
- Client Adaptation: Adapts to different client initialization requirements
For more details on compatibility, see the COMPATIBILITY.md file.
Several test scripts are included to verify functionality and compatibility:
# Test direct API functionality
npm run test
# Test basic startup functionality
node test-startup.js
# Test MCP client compatibility
node test-fastmcp-client.js
# Test standalone FastMCP compatibility
node test-fastmcp.js
# Run comprehensive compatibility tests
node test-compatibility.js
-
Connection Errors: If you see messages like "Client disconnected unexpectedly", ensure you're using the latest version of the package and your claude_desktop_config.json is correct.
-
Authentication Failures: Ensure your
HALOPSA_TENANT
is correctly set alongside the client ID and secret. -
API Errors: Check that your
HALOPSA_BASE_URL
does not include a trailing slash or "/api" suffix. -
Compatibility Issues: If you encounter protocol compatibility issues, check the debug logs for details. Try running the compatibility test script to identify specific issues.
To enable detailed logging, set LOG_LEVEL=debug
in your .env file or in the environment variables for the claude_desktop_config.json.
Check the Claude Desktop logs for detailed error messages:
# macOS
tail -f ~/Library/Logs/Claude/mcp*.log
# Windows
Get-Content -Path "$env:APPDATA\Claude\Logs\mcp*.log" -Wait
# Linux
tail -f ~/.local/share/Claude/logs/mcp*.log
For development with auto-reload:
npm run dev
halopsa-workflows-mcp/
├── halopsa-mcp.js # Main entry point (delegates to src/halopsa-mcp.js)
├── src/
│ ├── halopsa-direct.js # Direct HaloPSA API implementation
│ ├── halopsa-mcp.js # MCP server implementation
│ ├── mcp-compatibility.js # Compatibility layer for different MCP implementations
│ ├── index.js # Exports for package use
│ └── ... # Other source files
├── test-startup.js # Simple startup test
├── test-fastmcp-client.js # MCP client test
├── test-compatibility.js # Compatibility test
└── ... # Other files
MIT