MCP Harbor

by nomagicln
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides tools for interacting with Harbor container registry, enabling operations on projects, repositories, tags, and Helm charts such as listing, creating, and deleting resources.

  • Enables management of Helm charts within Harbor registry, including listing available charts, viewing chart versions, and deleting chart versions.

MCP 하버

MCP Harbor는 Harbor 컨테이너 레지스트리와 상호 작용하는 모델 컨텍스트 프로토콜(MCP) 서버를 제공하는 Node.js 애플리케이션입니다. 또한 Harbor 작업을 위한 REST API도 포함되어 있습니다.

목차

특징

  • MCP 서버 : 모델 컨텍스트 프로토콜을 통해 Harbor와 상호 작용하기 위한 도구를 제공합니다.
  • REST API : Harbor 운영을 위한 RESTful 엔드포인트를 제공합니다.
  • Harbor Operations : 프로젝트, 저장소, 태그 및 Helm 차트에 대한 작업을 지원합니다.
  • TypeScript : 더 나은 유형 안전성과 개발자 경험을 위해 TypeScript로 작성됨
  • 자동화된 테스트 : 안정적인 기능을 위한 포괄적인 테스트 모음

필수 조건

MCP Harbor를 설치하기 전에 다음 사항을 확인하세요.

  • Node.js 18.x 이상
  • npm 8.x 이상
  • Harbor 레지스트리 인스턴스에 대한 액세스
  • Git(저장소 복제용)

설치

  1. 저장소를 복제합니다.지엑스피1
  2. 프로젝트 디렉토리로 이동합니다.
    cd mcp-harbor
  3. 종속성 설치:
    npm install
  4. 프로젝트를 빌드하세요:
    npm run build
  5. 애플리케이션을 시작합니다:
    npm start

구성

환경 변수

다음 변수를 사용하여 루트 디렉토리에 .env 파일을 만듭니다.

# Required HARBOR_URL=https://your-harbor-instance.com HARBOR_USERNAME=your_username HARBOR_PASSWORD=your_password # Optional PORT=3000 # Server port (default: 3000) LOG_LEVEL=info # Logging level (default: info) ENABLE_HTTPS=false # Enable HTTPS (default: false) SSL_CERT_PATH=/path/to/cert.pem # Required if ENABLE_HTTPS=true SSL_KEY_PATH=/path/to/key.pem # Required if ENABLE_HTTPS=true

구성 파일

추가 구성 옵션은 src/config/harbor.config.ts 에서 설정할 수 있습니다.

{ timeout: 30000, // API request timeout in milliseconds retryAttempts: 3, // Number of retry attempts for failed requests cacheEnabled: true, // Enable response caching cacheTTL: 300 // Cache TTL in seconds }

API 엔드포인트

프로젝트

  • GET /projects - 모든 프로젝트 나열
  • GET /projects/:id - 프로젝트 세부 정보 가져오기
  • POST /projects - 새 프로젝트 만들기
  • DELETE /projects/:id - 프로젝트 삭제

저장소

  • GET /projects/:projectId/repositories - 프로젝트의 저장소 나열
  • DELETE /projects/:projectId/repositories/:repositoryName - 저장소 삭제

태그

  • GET /projects/:projectId/repositories/:repositoryName/tags - 저장소의 태그 나열
  • DELETE /projects/:projectId/repositories/:repositoryName/tags/:tag - 태그 삭제

헬름 차트

  • GET /projects/:projectId/charts - 프로젝트의 Helm 차트 나열
  • GET /projects/:projectId/charts/:chartName/versions - Helm 차트 버전 나열
  • DELETE /projects/:projectId/charts/:chartName/versions/:version - Helm 차트 버전 삭제

MCP 도구

MCP 서버는 다음 도구를 제공합니다.

도구 이름설명매개변수
list_projectsHarbor의 모든 프로젝트 나열없음
get_projectID로 프로젝트 세부 정보 가져오기id: number
create_project새 프로젝트를 만듭니다name: string, public?: boolean
delete_project프로젝트 삭제id: number
list_repositories프로젝트의 저장소 나열projectId: number
delete_repository저장소 삭제projectId: number, repoName: string
list_tags저장소의 태그 나열projectId: number, repoName: string
delete_tag태그 삭제projectId: number, repoName: string, tag: string
list_chartsHelm 차트 목록projectId: number
list_chart_versions차트 버전 목록projectId: number, chartName: string
delete_chart차트 버전 삭제projectId: number, chartName: string, version: string

개발

개발 모드에서 실행

npm run dev

테스트 실행

# Run all tests npm test # Run tests with coverage npm run test:coverage # Run specific test file npm test -- test/harbor.test.ts

디버그 도구

이 프로젝트에는 tools 디렉토리에 디버그 도구가 포함되어 있습니다.

# Test Harbor connection npm run test:connection # Start debug server npm run debug:server

프로젝트 구조

mcp-harbor ├── src │ ├── app.ts # Main application entry point (MCP server) │ ├── config │ │ └── harbor.config.ts # Harbor configuration │ ├── controllers │ │ └── harbor.controller.ts # REST API controllers │ ├── services │ │ └── harbor.service.ts # Harbor service implementation │ ├── models │ │ └── harbor.model.ts # Data models │ ├── routes │ │ └── harbor.routes.ts # API route definitions │ └── types │ └── index.ts # TypeScript type definitions ├── test │ └── harbor.test.ts # Tests for Harbor service ├── tools │ ├── debug-server.ts # Debug server implementation │ └── test-connection.ts # Connection testing utility ├── .env.example # Example environment variables ├── .gitignore # Git ignore file ├── package.json # Project dependencies ├── tsconfig.json # TypeScript configuration └── README.md # Project documentation

문제 해결

일반적인 문제

  1. 연결 실패
    Error: Unable to connect to Harbor instance
    • HARBOR_URL이 올바르고 접근 가능한지 확인하세요.
    • 네트워크 연결 확인
    • Harbor 인스턴스가 실행 중인지 확인하세요.
  2. 인증 실패
    Error: Invalid credentials
    • HARBOR_USERNAME과 HARBOR_PASSWORD가 올바른지 확인하세요.
    • 사용자에게 필요한 권한이 있는지 확인하세요
  3. 빌드 오류
    Error: TypeScript compilation failed
    • 모든 종속성이 설치되었는지 확인하려면 npm install 실행하세요.
    • TypeScript 버전 호환성 확인
    • dist 디렉토리를 지우고 다시 빌드하세요

디버그 모드

다음을 설정하여 디버그 로깅을 활성화합니다.

LOG_LEVEL=debug

지원하다

추가 도움이 필요하면:

  1. DEBUG.md 파일을 확인하세요
  2. 연결 테스트를 실행합니다: npm run test:connection
  3. logs/ 디렉토리에서 애플리케이션 로그를 검토하세요.

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

-
security - not tested
F
license - not found
-
quality - not tested

Harbor 컨테이너 레지스트리와 상호 작용하고 프로젝트, 저장소, 태그 및 Helm 차트에 대한 작업을 지원하기 위한 모델 컨텍스트 프로토콜 서버를 제공하는 Node.js 애플리케이션입니다.

  1. Table of Contents
    1. Features
      1. Prerequisites
        1. Installation
          1. Configuration
            1. Environment Variables
            2. Configuration File
          2. API Endpoints
            1. Projects
            2. Repositories
            3. Tags
            4. Helm Charts
          3. MCP Tools
            1. Development
              1. Running in Development Mode
              2. Running Tests
              3. Debug Tools
            2. Project Structure
              1. Troubleshooting
                1. Common Issues
                2. Debug Mode
                3. Support
              2. License
                ID: 7zkzz915sh