diff --git a/.github 2/workflows/koyeb-preview.yml b/.github 2/workflows/koyeb-preview.yml new file mode 100644 index 00000000..72285ba8 --- /dev/null +++ b/.github 2/workflows/koyeb-preview.yml @@ -0,0 +1,78 @@ +name: Build and deploy backend to preview + +on: + workflow_dispatch: + pull_request: + types: [synchronize, labeled] + +jobs: + deploy: + concurrency: + group: '${{ github.ref_name }}' + cancel-in-progress: true + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'deploy-preview') + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install and configure the Koyeb CLI + uses: koyeb-community/koyeb-actions@v2 + with: + api_token: '${{ secrets.KOYEB_PREVIEW_TOKEN }}' + - name: Build and deploy to Koyeb preview + run: | + koyeb deploy . platform-koyeb-preview/main \ + --instance-type nano \ + --region was \ + --archive-builder docker \ + --archive-docker-dockerfile remote.Dockerfile \ + --privileged \ + --type web \ + --port 3001:http \ + --route /:3001 \ + --wait \ + --env CLIENT_ID=${{secrets.CLIENT_ID}} \ + --env CLIENT_SECRET=${{secrets.CLIENT_SECRET}} \ + --env OAUTH_DATABASE_URL=${{secrets.PREVIEW_OAUTH_DATABASE_URL}} \ + --env SERVER_HOST=${{vars.KOYEB_PREVIEW_SERVER_HOST}} \ + --env NEON_API_HOST=${{vars.NEON_API_HOST_STAGING}} \ + --env UPSTREAM_OAUTH_HOST=${{vars.OAUTH_HOST_STAGING}} \ + --env COOKIE_SECRET=${{secrets.COOKIE_SECRET}} \ + + - name: Comment on PR with deployment URL + if: ${{ github.event_name == 'pull_request' && success() }} + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // GitHub bot id taken from (https://api.github.com/users/github-actions[bot]) + const githubActionsBotId = 41898282 + + const ownerRepoParams = { + owner: context.repo.owner, + repo: context.repo.repo, + } + + // Hidden start marker for the comment + const startMarker = ''; + const body = `${startMarker} + 🚀 Preview deployment ready: [https://preview-mcp.neon.tech](https://preview-mcp.neon.tech)`; + + const comments = await github.paginate(github.rest.issues.listComments, { + ...ownerRepoParams, + issue_number: context.issue.number, + }); + + // Delete previous comments regarding preview deployments. + for (comment of comments.filter(comment => comment.user.id === githubActionsBotId && comment.body.startsWith(startMarker))) { + await github.rest.issues.deleteComment({ + comment_id: comment.id, + ...ownerRepoParams, + }) + } + + await github.rest.issues.createComment({ + ...ownerRepoParams, + issue_number: context.issue.number, + body + }); diff --git a/.github 2/workflows/koyeb-prod.yml b/.github 2/workflows/koyeb-prod.yml new file mode 100644 index 00000000..b89141ca --- /dev/null +++ b/.github 2/workflows/koyeb-prod.yml @@ -0,0 +1,42 @@ +name: Build and deploy backend to production + +on: + workflow_dispatch: + push: + branches: + - 'main' + +jobs: + deploy: + concurrency: + group: '${{ github.ref_name }}' + cancel-in-progress: true + runs-on: ubuntu-latest + # Only main branch is allowed to deploy to production + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install and configure the Koyeb CLI + uses: koyeb-community/koyeb-actions@v2 + with: + api_token: '${{ secrets.KOYEB_PROD_TOKEN }}' + - name: Build and deploy to Koyeb production + run: | + koyeb deploy . platform-${{ github.ref_name }}/main \ + --instance-type medium \ + --region was \ + --archive-builder docker \ + --archive-docker-dockerfile remote.Dockerfile \ + --privileged \ + --type web \ + --port 3001:http \ + --route /:3001 \ + --wait \ + --env CLIENT_ID=${{secrets.PROD_CLIENT_ID}} \ + --env CLIENT_SECRET=${{secrets.PROD_CLIENT_SECRET}} \ + --env OAUTH_DATABASE_URL=${{secrets.PROD_OAUTH_DATABASE_URL}} \ + --env SERVER_HOST=${{vars.PROD_SERVER_HOST}} \ + --env NEON_API_HOST=${{vars.PROD_NEON_API_HOST}} \ + --env UPSTREAM_OAUTH_HOST=${{vars.PROD_OAUTH_HOST}} \ + --env COOKIE_SECRET=${{secrets.COOKIE_SECRET}} \ diff --git a/.github 2/workflows/pr.yml b/.github 2/workflows/pr.yml new file mode 100644 index 00000000..bf529f6d --- /dev/null +++ b/.github 2/workflows/pr.yml @@ -0,0 +1,30 @@ +name: Lint and Build + +on: + pull_request: + branches: + - main + +jobs: + lint-and-build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: .bun-version + - name: Install root dependencies + run: bun install --frozen-lockfile + - name: Install landing dependencies + working-directory: landing + run: bun install --frozen-lockfile + - name: Lint + run: bun run lint + - name: Build + run: bun run build diff --git a/README.md b/README.md index 695746bc..6ea0d131 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ [![npm downloads](https://img.shields.io/npm/dt/@neondatabase/mcp-server-neon)](https://www.npmjs.com/package/@neondatabase/mcp-server-neon) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/neondatabase/mcp-server-neon)](https://archestra.ai/mcp-catalog/neondatabase__mcp-server-neon) + The Model Context Protocol (MCP) is a [new, standardized protocol](https://modelcontextprotocol.io/introduction) designed to manage context between large language models (LLMs) and external systems. This repository offers an installer and an MCP Server for [Neon](https://neon.tech). Neon's MCP server acts as a bridge between natural language requests and the [Neon API](https://api-docs.neon.tech/reference/getting-started-with-neon-api). Built upon MCP, it translates your requests into the necessary API calls, enabling you to manage tasks such as creating projects and branches, running queries, and performing database migrations seamlessly.