Integration Guide
This guide demonstrates how to integrate the OpCon MCP Server with various MCP clients.
Claude Desktop Integration
Prerequisites
- Claude Desktop app installed
- OpCon API access credentials
Configuration Steps
- Locate your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
- Add the OpCon MCP server configuration:
{
"mcpServers": {
"opcon": {
"command": "node",
"args": ["/absolute/path/to/OpyConyMcpy/dist/index.js"],
"env": {
"OPCON_BASE_URL": "https://your-opcon-server:9010",
"OPCON_TOKEN": "your-application-token"
}
}
}
}
-
Restart Claude Desktop
-
Verify the server is connected by checking available tools
Example Prompts
Once configured, you can use prompts like:
- “List all access codes in OpCon”
- “Show me the master schedules”
- “Get daily jobs for today”
- “Check the status of job XYZ”
MCP Inspector (Testing)
For testing and development, use the MCP Inspector:
# Install globally (optional)
npm install -g @modelcontextprotocol/inspector
# Build the server first
npm run build
# Run the inspector
npx @modelcontextprotocol/inspector node dist/index.js
Set the environment variables:
export OPCON_BASE_URL="https://your-server:9010"
export OPCON_TOKEN="your-token"
npx @modelcontextprotocol/inspector node dist/index.js
VS Code Integration
You can test the server directly in VS Code:
- Open the integrated terminal
- Set environment variables:
export OPCON_BASE_URL="https://your-server:9010" export OPCON_TOKEN="your-token" - Run the server:
npm run dev
Custom MCP Client
To integrate with a custom MCP client:
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { spawn } from 'child_process';
const transport = new StdioClientTransport({
command: 'node',
args: ['dist/index.js'],
env: {
...process.env,
OPCON_BASE_URL: 'https://your-server:9010',
OPCON_TOKEN: 'your-token',
},
});
const client = new Client({
name: 'my-client',
version: '1.0.0',
}, {
capabilities: {},
});
await client.connect(transport);
// List available tools
const tools = await client.listTools();
console.log('Available tools:', tools);
// Call a tool
const result = await client.callTool({
name: 'getApiAccesscodes',
arguments: {
Limit: 10,
},
});
console.log('Result:', result);
Docker Integration
Create a Dockerfile for containerized deployment:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY dist ./dist
COPY swagger.json ./
ENV NODE_ENV=production
CMD ["node", "dist/index.js"]
Build and run:
docker build -t opcon-mcp-server .
docker run -e OPCON_BASE_URL=https://server:9010 \
-e OPCON_TOKEN=token \
opcon-mcp-server
Troubleshooting
Server Not Starting
- Check Node.js version: Must be 18 or higher
node --version - Verify environment variables:
echo $OPCON_BASE_URL echo $OPCON_TOKEN - Check build artifacts:
ls -la dist/
Authentication Errors
- Token authentication:
- Verify token is valid
- Check token hasn’t expired
- Ensure token has necessary permissions
- Username/Password authentication:
- Verify credentials are correct
- Check network connectivity to OpCon server
- TLS errors:
- For self-signed certificates, set
OPCON_VERIFY_TLS=false - Only use this in development environments
- For self-signed certificates, set
Tools Not Appearing
- Check swagger.json exists:
ls -la swagger.json - Verify OpenAPI spec is valid:
npm install -g @apidevtools/swagger-cli swagger-cli validate swagger.json - Check server logs for parsing errors
Connection Issues
- Verify OpCon API is accessible:
curl -k https://your-server:9010/api/health -
Check firewall rules
- Verify port is correct (default: 9010)
Best Practices
- Use tokens over passwords for better security
- Rotate tokens regularly
- Use environment-specific configurations
- Enable TLS verification in production
- Monitor API usage and rate limits
- Keep the server updated with latest dependencies
- Review logs regularly for errors or unusual activity