diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65075ef..c955dc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,16 +5,22 @@ on: tags: - 'v*' +permissions: + contents: read + packages: write + jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: '20' - registry-url: 'https://registry.npmjs.org' + registry-url: 'https://npm.pkg.github.com' + scope: '@buzzvil' + package-manager-cache: false - name: Install dependencies run: npm ci @@ -25,7 +31,10 @@ jobs: - name: Test run: npm test - - name: Publish to npm - run: npm publish --access public + - name: Verify package contents + run: npm pack --dry-run + + - name: Publish to GitHub Packages + run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml index 5aaa57a..0586d4e 100644 --- a/.github/workflows/tagpr.yml +++ b/.github/workflows/tagpr.yml @@ -9,19 +9,22 @@ permissions: pull-requests: write actions: write issues: write + packages: write jobs: tagpr: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: '20' - registry-url: 'https://registry.npmjs.org' + registry-url: 'https://npm.pkg.github.com' + scope: '@buzzvil' + package-manager-cache: false - name: Install dependencies run: npm ci @@ -40,8 +43,12 @@ jobs: if: steps.tagpr.outputs.tag != '' run: npm test - - name: Publish to npm + - name: Verify package contents if: steps.tagpr.outputs.tag != '' - run: npm publish --access public + run: npm pack --dry-run + + - name: Publish to GitHub Packages + if: steps.tagpr.outputs.tag != '' + run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 7b3b04b..a74b1f7 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,40 @@ a browser — instead, it reads the cached tokens left behind by ## Installation +### Run with npx from GitHub Packages + +GitHub Packages requires npm authentication even for public packages. Create a +classic personal access token with only the `read:packages` scope, then sign in +once (use your GitHub username and the token as the password): + +```bash +npm login --scope=@buzzvil --auth-type=legacy --registry=https://npm.pkg.github.com +``` + +Set the required Redash/OIDC environment variables, then log in to Redash and +run the MCP server: + +```bash +export REDASH_URL=https://redash.example.com +export REDASH_OIDC_ISSUER=https://authentik.example.com/application/o/redash-api/ +export REDASH_OIDC_CLIENT_ID=redash-api + +npx -y @buzzvil/redash-mcp login +npx -y @buzzvil/redash-mcp +``` + +For non-interactive environments, map the scope and token in `~/.npmrc`: + +```ini +@buzzvil:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN} +``` + +GitHub Packages does not support anonymous npm installs, including for public +packages. Authentication-free `npx` requires publishing to npmjs.org as well. + +### Build from source + 1. Clone this repository: ```bash git clone https://github.com/Buzzvil/redash-mcp.git @@ -91,7 +125,7 @@ a browser — instead, it reads the cached tokens left behind by 5. **Log in once** — opens your browser, completes PKCE, writes tokens to the cache: ```bash npm start -- login - # or, after publish: npx @suthio/redash-mcp login + # or, from GitHub Packages: npx -y @buzzvil/redash-mcp login ``` 6. Start the server: ```bash @@ -124,7 +158,7 @@ To use this MCP server with Claude for Desktop, configure it in your Claude for "mcpServers": { "redash": { "command": "npx", - "args": ["-y", "@suthio/redash-mcp"], + "args": ["-y", "@buzzvil/redash-mcp"], "env": { "REDASH_URL": "https://redash.example.com", "REDASH_OIDC_ISSUER": "https://authentik.example.com/application/o/redash-api/", diff --git a/package-lock.json b/package-lock.json index 7b5a6e4..aee2bbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@suthio/redash-mcp", + "name": "@buzzvil/redash-mcp", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@suthio/redash-mcp", + "name": "@buzzvil/redash-mcp", "version": "0.1.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 505a255..d71ef89 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@suthio/redash-mcp", + "name": "@buzzvil/redash-mcp", "version": "0.1.0", "description": "MCP server for Redash integration", "type": "module", @@ -30,6 +30,13 @@ ], "author": "", "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/Buzzvil/redash-mcp.git" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, "dependencies": { "@modelcontextprotocol/sdk": "^1.1.0", "axios": "^1.6.2",