A Model Context Protocol (MCP) server for interacting with the SMA OpCon REST API. This server enables AI agents and applications to interact with OpCon automation platform through a standardized protocol.
View Full Documentation - Complete guide including:
- Quick Start Guide - Get started in minutes
- Tool Reference - All 257 available tools with detailed parameters
- Configuration Guide - Environment setup
- Integration Guide - MCP client integration
- Examples - Usage examples
- β Complete API Coverage: Automatically generates MCP tools from OpenAPI specification
- β Authentication Support: Token-based and username/password authentication
- β Type Safety: Written in TypeScript with full type definitions
- β Comprehensive Testing: Unit tests with Jest
- β CI/CD: GitHub Actions workflows for testing, linting, and security
- β Development Tools: DevContainer and VSCode integration
- β Best Practices: ESLint, Prettier, and security scanning
- β Grafana Support: Prometheus metrics for monitoring and observability
- Node.js 18 or higher
- Access to an OpCon API server
- OpCon API credentials (token or username/password)
npm installThe server is configured via environment variables:
| Variable | Required | Description |
|---|---|---|
OPCON_BASE_URL |
Yes | OpCon API base URL (e.g., https://opcon-server:9010) |
OPCON_TOKEN |
No* | Application token for authentication |
OPCON_USERNAME |
No* | Username for authentication |
OPCON_PASSWORD |
No* | Password for authentication |
OPCON_VERIFY_TLS |
No | Set to false to disable TLS verification (default: true) |
OPCON_METRICS_ENABLED |
No | Set to true to enable Prometheus metrics (default: false) |
OPCON_METRICS_PORT |
No | Port for metrics HTTP server (default: 9090) |
*Either OPCON_TOKEN or both OPCON_USERNAME and OPCON_PASSWORD are required.
# Development mode
npm run dev
# Production mode (after building)
npm run build
node dist/index.jsConfigure your MCP client (e.g., Claude Desktop, MCP Inspector) to use this server:
{
"mcpServers": {
"opcon": {
"command": "node",
"args": ["/path/to/OpyConyMcpy/dist/index.js"],
"env": {
"OPCON_BASE_URL": "https://your-opcon-server:9010",
"OPCON_TOKEN": "your-token-here"
}
}
}
}The server automatically generates MCP tools from the OpCon OpenAPI specification. Each API endpoint becomes a callable tool.
257 tools across 65 categories including:
- DailyJobs (40 tools) - Monitor and manage daily job execution
- DailySchedules (11 tools) - Daily schedule operations
- Machines (10 tools) - Machine configuration and monitoring
- Calendars (8 tools) - Calendar management
- AccessCodes (5 tools) - Access code management
- Resources (5 tools) - Resource management
- And 59 more categories...
For a complete list, see the Tool Reference.
# Install dependencies
npm install
# Run in development mode
npm run dev# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage# Run ESLint
npm run lint
# Fix ESLint issues
npm run lint:fix
# Check formatting
npm run format:check
# Fix formatting
npm run formatnpm run buildThe OpCon MCP Server supports Prometheus metrics that can be visualized in Grafana.
- Enable metrics collection:
export OPCON_METRICS_ENABLED=true- Start the metrics HTTP server:
# Development mode
npm run dev:metrics
# Production mode (after building)
node dist/metrics-server.js- Access metrics at
http://localhost:9090/metrics
- Request counts: Total MCP tool requests by tool and method
- Error rates: Errors by tool, method, and error type
- Request duration: Latency histograms with p95, p99 percentiles
- Tools available: Number of registered MCP tools
- Set up Prometheus to scrape the metrics endpoint
- Import the dashboard from
grafana/dashboard.json - Configure your Prometheus data source in Grafana
For detailed instructions, see grafana/README.md.
This project includes a DevContainer configuration for VS Code. To use it:
- Install Docker and VS Code
- Install the Remote - Containers extension
- Open the project in VS Code
- Click "Reopen in Container" when prompted
The project includes VS Code settings and recommended extensions:
- ESLint: Code linting
- Prettier: Code formatting
- Jest Runner: Run tests from the editor
- TypeScript: Enhanced TypeScript support
GitHub Actions workflows are configured for:
- CI: Linting, testing, and building on multiple Node.js versions
- Security: CodeQL analysis, dependency review, and npm audit
OpyConyMcpy/
βββ .devcontainer/ # DevContainer configuration
βββ .github/
β βββ workflows/ # GitHub Actions workflows
βββ .vscode/ # VS Code settings
βββ src/
β βββ index.ts # Main server entry point
β βββ client.ts # OpCon API client
β βββ parser.ts # OpenAPI spec parser
β βββ types.ts # Type definitions
βββ tests/ # Unit tests
βββ swagger.json # OpCon OpenAPI specification
βββ package.json # Project dependencies
βββ tsconfig.json # TypeScript configuration
βββ jest.config.js # Jest configuration
βββ .eslintrc.json # ESLint configuration
βββ .prettierrc # Prettier configuration
The MCP server architecture consists of:
- Parser: Reads the OpenAPI specification and generates MCP tool definitions
- Client: Handles HTTP communication with the OpCon API, including authentication
- Server: Implements the MCP protocol and routes tool calls to the appropriate API endpoints
MCP Client β MCP Server β OpCon Client β OpCon REST API
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
- Always use HTTPS in production
- Store credentials securely (use environment variables, never commit them)
- Enable TLS verification unless absolutely necessary
- Regularly update dependencies
- Review security scan results in GitHub Actions
MIT
For issues and questions, please use the GitHub issue tracker.