diff --git a/packages/opsxdb-mcp/LICENSE b/packages/opsxdb-mcp/LICENSE new file mode 100644 index 0000000..140f94f --- /dev/null +++ b/packages/opsxdb-mcp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 1024way + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/opsxdb-mcp/README.md b/packages/opsxdb-mcp/README.md new file mode 100644 index 0000000..83ef6d1 --- /dev/null +++ b/packages/opsxdb-mcp/README.md @@ -0,0 +1,49 @@ +# @rlwj-lab/opsxdb-mcp + +MCP (Model Context Protocol) launcher for OpsxDB. + +This package ships a small Node CLI that **spawns the Go `opsxdb-mcp` binary** over stdio. Build the binary from the OpsxDB repo, then point the launcher at it. + +## Install + +```bash +npm i -g @rlwj-lab/opsxdb-mcp +# or +npx -y @rlwj-lab/opsxdb-mcp +``` + +## Build the Go binary + +From the OpsxDB repository: + +```bash +cd server && go build -o ../bin/opsxdb-mcp ./cmd/opsxdb-mcp +``` + +Put `bin/opsxdb-mcp` on `PATH`, or set: + +```bash +export OPSXDB_MCP_BIN=/absolute/path/to/opsxdb-mcp +``` + +## Cursor / Claude Desktop + +```json +{ + "mcpServers": { + "opsxdb": { + "command": "npx", + "args": ["-y", "@rlwj-lab/opsxdb-mcp"], + "env": { + "OPSXDB_MCP_BIN": "/absolute/path/to/opsxdb-mcp" + } + } + } +} +``` + +Config: `~/.opsxdb/mcp.json`, `~/.opsxdb/connections.json`. + +## License + +MIT diff --git a/packages/opsxdb-mcp/bin/cli.js b/packages/opsxdb-mcp/bin/cli.js new file mode 100755 index 0000000..506c9f5 --- /dev/null +++ b/packages/opsxdb-mcp/bin/cli.js @@ -0,0 +1,39 @@ +#!/usr/bin/env node +'use strict'; + +const { spawn } = require('child_process'); +const { + resolveBinary, + missingBinaryMessage, +} = require('../dist/resolve-binary.js'); + +const bin = resolveBinary(); +if (!bin) { + process.stderr.write(missingBinaryMessage()); + process.exit(1); +} + +const child = spawn(bin, process.argv.slice(2), { + stdio: 'inherit', + env: process.env, + windowsHide: true, +}); + +child.on('error', (err) => { + process.stderr.write( + `opsxdb-mcp: failed to start "${bin}": ${err.message}\n` + ); + process.exit(1); +}); + +child.on('exit', (code, signal) => { + if (signal) { + try { + process.kill(process.pid, signal); + } catch { + process.exit(1); + } + return; + } + process.exit(code == null ? 1 : code); +}); diff --git a/packages/opsxdb-mcp/index.js b/packages/opsxdb-mcp/index.js new file mode 100644 index 0000000..22ec485 --- /dev/null +++ b/packages/opsxdb-mcp/index.js @@ -0,0 +1,16 @@ +'use strict'; + +/** + * @rlwj-lab/opsxdb-mcp + * Node launcher for the OpsxDB Go MCP server (stdio). + * Prefer the `opsxdb-mcp` bin / `npx @rlwj-lab/opsxdb-mcp`. + */ +const { + resolveBinary, + missingBinaryMessage, +} = require('./dist/resolve-binary.js'); + +module.exports = { + resolveBinary, + missingBinaryMessage, +}; diff --git a/packages/opsxdb-mcp/package.json b/packages/opsxdb-mcp/package.json new file mode 100644 index 0000000..1ca4618 --- /dev/null +++ b/packages/opsxdb-mcp/package.json @@ -0,0 +1,29 @@ +{ + "name": "@rlwj-lab/opsxdb-mcp", + "version": "0.1.0", + "description": "MCP server for opsxdb", + "main": "index.js", + "bin": { + "opsxdb-mcp": "bin/cli.js" + }, + "files": [ + "index.js", + "bin", + "dist", + "LICENSE", + "README.md" + ], + "keywords": [ + "mcp", + "opsxdb", + "database" + ], + "license": "MIT", + "author": "1024way", + "engines": { + "node": ">=18" + }, + "publishConfig": { + "access": "public" + } +}