byteforce

CPN 한국어 자습서 · 외부 문서 한국어 미러

MCP 문서 · Registry

GitHub Actions로 게시 자동화하는 방법

How to Automate Publishing with GitHub Actions · 원문: modelcontextprotocol.io/registry/github-actions

아래는 원문을 한국어로 옮긴 미러입니다. 코드·명령은 원문 그대로이며, 가장 최신 정보는 하단 원문 링크에서 확인하세요.

참고: MCP 레지스트리는 현재 프리뷰 단계입니다. 일반 공개 전까지 주요 변경 사항이나 데이터 초기화가 발생할 수 있습니다. 문제가 발생하면 GitHub에 보고해 주세요.

1단계: 워크플로 파일 생성

서버 프로젝트 디렉터리에 .github/workflows/publish-mcp.yml 파일을 생성합니다. 다음은 npm 기반 로컬 서버의 예시이지만, MCP 레지스트리 게시 단계는 모든 패키지 유형에서 동일합니다:

OIDC 인증 (권장):

코드 · 명령
name: Publish to MCP Registry

on:
  push:
    tags: ["v*"] # Triggers on version tags like v1.0.0

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write # Required for OIDC authentication
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      ### Publish underlying npm package:

      - name: Set up Node.js
        uses: actions/setup-node@v5
        with:
          node-version: "lts/*"

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run test --if-present

      - name: Build package
        run: npm run build --if-present

      - name: Publish package to npm
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

      ### Publish MCP server:

      - name: Install mcp-publisher
        run: |
          curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher

      - name: Authenticate to MCP Registry
        run: ./mcp-publisher login github-oidc

      # Optional:
      # - name: Set version in server.json
      #   run: |
      #     VERSION=${GITHUB_REF#refs/tags/v}
      #     jq --arg v "$VERSION" '.version = $v' server.json > server.tmp && mv server.tmp server.json

      - name: Publish server to MCP Registry
        run: ./mcp-publisher publish

PAT 인증:

코드 · 명령
name: Publish to MCP Registry

on:
  push:
    tags: ["v*"] # Triggers on version tags like v1.0.0

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      ### Publish underlying npm package:

      - name: Set up Node.js
        uses: actions/setup-node@v5
        with:
          node-version: "lts/*"

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run test --if-present

      - name: Build package
        run: npm run build --if-present

      - name: Publish package to npm
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

      ### Publish MCP server:

      - name: Install mcp-publisher
        run: |
          curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher

      - name: Authenticate to MCP Registry
        run: ./mcp-publisher login github --token ${{ secrets.MCP_GITHUB_TOKEN }}

      - name: Publish server to MCP Registry
        run: ./mcp-publisher publish

DNS 인증:

코드 · 명령
name: Publish to MCP Registry

on:
  push:
    tags: ["v*"] # Triggers on version tags like v1.0.0

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      ### Publish underlying npm package:

      - name: Set up Node.js
        uses: actions/setup-node@v5
        with:
          node-version: "lts/*"

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm run test --if-present

      - name: Build package
        run: npm run build --if-present

      - name: Publish package to npm
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

      ### Publish MCP server:

      - name: Install mcp-publisher
        run: |
          curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher

      # TODO: `example.com`을 실제 도메인 이름으로 교체하세요
      - name: Authenticate to MCP Registry
        run: ./mcp-publisher login dns --domain example.com --private-key ${{ secrets.MCP_PRIVATE_KEY }}

      - name: Publish server to MCP Registry
        run: ./mcp-publisher publish

2단계: 시크릿 추가

선택한 인증 방법에 따라 리포지터리에 시크릿을 추가해야 할 수 있습니다:

패키지 레지스트리용 시크릿도 추가해야 할 수 있습니다. 예를 들어, 위의 워크플로는 npm 토큰이 담긴 NPM_TOKEN 시크릿이 필요합니다.

리포지터리에 시크릿을 추가하는 방법은 GitHub Actions에서 시크릿 사용하기를 참고하세요.

3단계: 태그 및 릴리스

워크플로를 트리거하는 버전 태그를 생성하고 푸시합니다:

코드 · 명령
git tag v1.0.0
git push origin v1.0.0

워크플로는 테스트를 실행하고, 패키지를 빌드하고, npm에 패키지를 게시한 뒤, MCP 레지스트리에 서버를 게시합니다.

문제 해결

오류 메시지 조치
"Authentication failed" OIDC의 경우 id-token: write 권한이 설정되었는지 확인하거나 시크릿을 점검합니다.
"Package validation failed" 패키지가 패키지 레지스트리(예: npm, PyPI)에 성공적으로 게시되었는지, 그리고 필요한 검증 정보가 포함되어 있는지 확인합니다.

원문(영어): https://modelcontextprotocol.io/registry/github-actions · 본 문서는 학습용 한국어 번역이며 원본의 권리는 원저작자(Model Context Protocol)에게 있습니다.

원문(영어): https://modelcontextprotocol.io/registry/github-actions