Q developer 에서 MCP 사용하기


Q developer

MCP(Model Context Protocol)

MCP(Model Context Protocol)란? MCP(Model Context Protocol)는 대규모 언어 모델(LLM) 애플리케이션과 외부 데이터 소스 및 도구 간의 원활한 통합을 가능하게 하는 개방형 프로토콜입니다. 이 프로토콜은 AI 모델이 필요한 컨텍스트와 연결되는 표준화된 방법을 제공합니다.

MCP 아키텍처

MCP 아키텍처를 살펴보면 MCP 서버는 로컬에서 기동되며 MCP Client에서는 해당 하는 MCP 서버로 MCP 프로토콜을 통해

MCP 구성요소

MCP Hosts: Programs like Claude Desktop, IDEs, or AI tools that want to access data through MCP MCP Clients: Protocol clients that maintain 1:1 connections with servers MCP Servers: Lightweight programs that each expose specific capabilities through the standardized Model Context Protocol Local Data Sources: Your computer’s files, databases, and services that MCP servers can securely access Remote Services: External systems available over the internet (e.g., through APIs) that MCP servers can connect to

  1. 호스트(Host)
    • 정의: LLM 애플리케이션으로, 서버로부터 데이터를 받아 처리함
    • 역할:
      • 여러 클라이언트 초기화 및 관리
      • 클라이언트-서버 수명 주기 관리
      • 사용자 권한 부여 결정 처리
      • 여러 클라이언트 간 컨텍스트 통합 관리
    • 예시: Q developer chat, Cursor IDE 등
  2. 클라이언트(Client)
    • 역할:
      • 단일 서버와 1:1 상태 유지 연결 관리
      • 호스트와 서버 간 양방향 메시지 라우팅
      • 서버의 도구, 리소스, 프롬프트 템플릿 등 기능 관리
      • 프로토콜 버전 및 기능 호환성 협상
      • 서버 리소스에 대한 구독 관리 및 변경 알림 처리
  3. 서버(Server)
    • 정의: LLM에 외부 데이터와 컨텍스트를 제공하는 기본 구성 요소
    • 주요 기능: 도구(Tools): LLM이 외부 앱과 상호작용할 수 있는 실행 가능한 함수(예: 파일 목록 조회, Gmail/Slack API 호출) 리소스(Resources): 텍스트 파일, 로그 파일, DB 스키마, 파일 내용, Git 히스토리 등 LLM에 추가 컨텍스트 제공 프롬프트 템플릿(Prompt Templates): 언어 모델 상호작용을 안내하는 사전 정의된 템플릿 또는 지침

도구는 모델이 제어하며, 리소스와 프롬프트는 사용자가 제어합니다. 모델은 주어진 컨텍스트에 따라 도구를 자동으로 발견하고 호출할 수 있습니다.

Q chat 을 통해 EKS MCP 를 사용하면 Host는 qchat 이 되고, Clients는 MCP Clients, 서버는 MCP 서버가 된다.


EKS MCP

  1. Global Configuration: ~/.aws/amazonq/mcp.json - Applies to all workspaces
  2. Workspace Configuration: .amazonq/mcp.json - Specific to the current workspace

mcp.json

{
  "mcpServers": {
    "awslabs.eks-mcp-server": {
      "autoApprove": [],
      "disabled": false,
      "command": "uvx",
      "args": [
        "awslabs.eks-mcp-server@latest",
        "--allow-write",
        "--allow-sensitive-data-access"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "transportType": "stdio"
    }
  }
}

qchat

위 설정을 하고 나면 MCP 서버가 기동된것을 알 수 있다. mcp 서버는 uvx 커맨드를 통해 local 에서 기동된다.

$ qchat
⚠ 0 of 1 mcp servers initialized. Servers still loading:
 - awslabseks_mcp_server

    ⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
 ⠀⠀⠀⣾⡿⢻⣿⡆⠀⠀⠀⢀⣄⡄⢀⣠⣤⣤⡀⢀⣠⣤⣤⡀⠀⠀⢀⣠⣤⣤⣤⣄⠀⠀⢀⣤⣤⣤⣤⣤⣤⡀⠀⠀⣀⣤⣤⣤⣀⠀⠀⠀⢠⣤⡀⣀⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⢠⣿⣿⠋⠀⠀⠀⠙⣿⣿⡆
 ⠀⠀⣼⣿⠇⠀⣿⣿⡄⠀⠀⢸⣿⣿⠛⠉⠻⣿⣿⠛⠉⠛⣿⣿⠀⠀⠘⠛⠉⠉⠻⣿⣧⠀⠈⠛⠛⠛⣻⣿⡿⠀⢀⣾⣿⠛⠉⠻⣿⣷⡀⠀⢸⣿⡟⠛⠉⢻⣿⣷⠀⠀⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⢸⣿⣿
 ⠀⢰⣿⣿⣤⣤⣼⣿⣷⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⢀⣴⣶⣶⣶⣿⣿⠀⠀⠀⣠⣾⡿⠋⠀⠀⢸⣿⣿⠀⠀⠀⣿⣿⡇⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⣇⠀⠀⠀⠀⠀⢸⣿⡿
 ⢀⣿⣿⠋⠉⠉⠉⢻⣿⣇⠀⢸⣿⣿⠀⠀⠀⣿⣿⠀⠀⠀⣿⣿⠀⠀⣿⣿⡀⠀⣠⣿⣿⠀⢀⣴⣿⣋⣀⣀⣀⡀⠘⣿⣿⣄⣀⣠⣿⣿⠃⠀⢸⣿⡇⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠈⢿⣿⣦⣀⣀⣀⣴⣿⡿⠃
 ⠚⠛⠋⠀⠀⠀⠀⠘⠛⠛⠀⠘⠛⠛⠀⠀⠀⠛⠛⠀⠀⠀⠛⠛⠀⠀⠙⠻⠿⠟⠋⠛⠛⠀⠘⠛⠛⠛⠛⠛⠛⠃⠀⠈⠛⠿⠿⠿⠛⠁⠀⠀⠘⠛⠃⠀⠀⠘⠛⠛⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⣿⣿⣋⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⢿⡧

╭─────────────────────────────── Did you know? ────────────────────────────────╮
│                                                                              │
│      Set a default model by running q settings chat.defaultModel MODEL.      │
│                          Run /model to learn more.                           │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

아래와 같이 uvx 를 통해 MCP 서버가 기동된다.

$ ps -ef | grep awslabs.eks-mcp-server
  504 88785 88761   0 10:26#오전 ttys008    0:00.36 /Users/bys/.local/bin/uv tool uvx awslabs.eks-mcp-server@latest --allow-write --allow-sensitive-data-access

Tag: [ qdev  mcp  eks  ]