# Testing Guide for CMMS MCP Server
This guide explains how to test the MCP server with various clients including Claude Desktop, ChatGPT, and command-line tools.
## Prerequisites
1. Build the project:
```bash
npm install
npm run build
```
2. Verify the server runs:
```bash
npm start
```
(You should see "CMMS MCP Server running on stdio" in stderr)
## Testing with Claude Desktop
Claude Desktop is the most common way to use MCP servers.
### 1. Find Claude Desktop Config File
**macOS:**
```bash
~/Library/Application Support/Claude/claude_desktop_config.json
```
**Windows:**
```
%APPDATA%\Claude\claude_desktop_config.json
```
**Linux:**
```bash
~/.config/Claude/claude_desktop_config.json
```
### 2. Add Server Configuration
Edit the config file and add:
```json
{
"mcpServers": {
"cmms-mcp-server": {
"command": "node",
"args": ["/Users/anuwatthisuka/Documents/Developer/CodeSandbox/cmms-mcp-server/dist/index.js"],
"env": {}
}
}
}
```
**Important:** Replace the path with your actual absolute path to `dist/index.js`.
### 3. Restart Claude Desktop
Close and reopen Claude Desktop completely.
### 4. Verify Connection
In Claude Desktop, you should see:
- Tools available in the tools menu
- Resources available in the resources menu
- You can ask Claude to use tools like "Get all production orders" or "Show me maintenance tasks"
## Testing with Command Line (MCP Inspector)
You can test the server directly using the MCP Inspector tool.
### 1. Install MCP Inspector
```bash
npm install -g @modelcontextprotocol/inspector
```
### 2. Run Inspector
```bash
mcp-inspector node dist/index.js
```
This will open a web interface where you can:
- List all available tools
- Test tool calls
- View resources
- See server capabilities
## Testing with Custom Test Script
We've included a test script to verify all functionality.
### Run Test Script
```bash
npm test
```
Or manually:
```bash
node test/test-server.js
```
## Manual Testing Examples
### Test 1: List Tools
```bash
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js
```
### Test 2: Call a Tool
```bash
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_production_orders","arguments":{"status":"in-progress"}}}' | node dist/index.js
```
### Test 3: List Resources
```bash
echo '{"jsonrpc":"2.0","id":3,"method":"resources/list","params":{}}' | node dist/index.js
```
## Testing with Other MCP Clients
### Cline (VS Code Extension)
1. Install the "Cline" extension in VS Code
2. Configure MCP servers in VS Code settings
3. The server will be available in Cline chat
### Continue (VS Code Extension)
1. Install "Continue" extension
2. Add server config to Continue settings
3. Use MCP tools in Continue chat
### Custom Integration
You can integrate with any MCP-compatible client by:
1. Starting the server process with stdio transport
2. Sending JSON-RPC 2.0 messages
3. Receiving responses on stdout
## Example Queries for Testing
Once connected to Claude Desktop or another client, try these:
1. **MES Queries:**
- "Get all production orders"
- "Show me equipment that's currently running"
- "What work orders are in progress?"
2. **CMMS Queries:**
- "List all maintenance tasks"
- "Show me overdue maintenance tasks"
- "Create a new preventive maintenance task for asset-001"
- "Get maintenance history for asset-002"
3. **IoT Queries:**
- "Show me all active sensors"
- "Get sensor readings from the last 24 hours"
- "What alerts are currently unacknowledged?"
- "Acknowledge alert alert-001"
## Troubleshooting
### Server Not Starting
- Check that `dist/index.js` exists (run `npm run build`)
- Verify Node.js version (should be 18+)
- Check for errors in console
### Tools Not Appearing
- Verify the config file path is correct (use absolute path)
- Restart Claude Desktop completely
- Check Claude Desktop logs for errors
### Connection Issues
- Ensure the server path in config is absolute
- Check file permissions
- Verify all dependencies are installed
## Debug Mode
Run in development mode to see detailed logs:
```bash
npm run dev
```
This will show all JSON-RPC messages being exchanged.
## Next Steps
Once testing is successful:
1. Replace mock data with real API integrations
2. Add authentication/authorization
3. Add error handling and retries
4. Implement data persistence if needed