Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

Google Workspace MCP

LibreChat에서 Gmail, Drive, Calendar, People 및 Chat을 위한 Google의 원격 Workspace MCP 서버를 구성하세요.

Google은 Google Workspace 제품을 위한 원격 Model Context Protocol (MCP) 서버를 제공합니다. LibreChat에서 각 Google Workspace 제품은 자체적인 OAuth가 활성화된 원격 MCP 서버로 구성됩니다.

개발자 프리뷰

Google은 Workspace MCP 서버를 Google Workspace 개발자 미리보기 프로그램(Developer Preview Program)의 일부로 지정하고 있습니다. 이 기능을 광범위하게 배포하기 전에 Google의 최신 문서를 검토하십시오. 사용 가능한 제품, 범위 및 확인 요구 사항이 변경될 수 있습니다.

구성할 내용

Google Workspace MCP는 하나의 통합된 서버가 아닙니다. 사용자에게 노출하려는 제품만 구성하십시오:

제품MCP 서버 URL
Gmailhttps://gmailmcp.googleapis.com/mcp/v1
Google Drivehttps://drivemcp.googleapis.com/mcp/v1
Google Calendarhttps://calendarmcp.googleapis.com/mcp/v1
People APIhttps://people.googleapis.com/mcp/v1
Google Chathttps://chatmcp.googleapis.com/mcp/v1

각 사용자는 LibreChat UI에서 각 서버에 연결합니다. LibreChat은 사용자별로 OAuth 토큰을 저장하므로, Gmail, Drive, Calendar, People 및 Chat 액세스는 연결을 승인한 Google 계정을 따릅니다.

필수 조건

  • Google Cloud 프로젝트.
  • 해당 프로젝트에서 API를 활성화하고 OAuth 클라이언트를 생성할 수 있는 권한.
  • gcloud가 설치 및 인증되었거나, Google Cloud 콘솔에 대한 액세스 권한이 있어야 합니다.
  • librechat.yaml이 마운트되거나 로드된 상태로 실행 중인 LibreChat 인스턴스.
  • 사용자가 LibreChat을 열 때 사용하는 공개 기본 URL입니다. 예를 들어 로컬 개발 환경의 경우 http://localhost:3080, 프로덕션 환경의 경우 https://chat.example.com을 사용합니다.

OAuth 콜백 경로

LibreChat의 MCP OAuth 콜백 경로는 BASE_URL/api/mcp/SERVER_NAME/oauth/callback입니다. SERVER_NAMElibrechat.yamlmcpServers 아래에 있는 키(예: gmail 또는 drive)입니다.

설정

Google Workspace API 활성화

PROJECT_ID를 귀하의 Google Cloud 프로젝트 ID로 교체하세요:

gcloud services enable gmail.googleapis.com \
  drive.googleapis.com \
  calendar-json.googleapis.com \
  chat.googleapis.com \
  people.googleapis.com \
  --project=PROJECT_ID

Google Workspace MCP 서비스 활성화

구성하려는 제품에 대해 MCP 서비스를 활성화하세요:

gcloud services enable gmailmcp.googleapis.com \
  drivemcp.googleapis.com \
  calendarmcp.googleapis.com \
  chatmcp.googleapis.com \
  people.googleapis.com \
  --project=PROJECT_ID

필요에 따라 Google Chat 구성하기

Google Chat MCP 서버를 사용하려면 동일한 Google Cloud 프로젝트 내에 Chat 앱이 필요합니다.

Google Cloud 콘솔에서 Google Chat API > Manage > Configuration을 열고 Chat 앱을 생성하세요:

  • 앱 이름: Chat MCP
  • 아바타 URL: https://developers.google.com/chat/images/quickstart-app-avatar.png
  • 설명: Chat MCP server
  • 기능: Enable interactive features를 끕니다.
  • 로그(Logs): **로그에 오류 기록(Log errors to Logging)**을 선택하세요.

Save를 클릭합니다.

채팅을 위해 Workspace 계정이 필요합니다

Google Chat 앱 구성은 개인용 Google 계정에서는 사용하지 못할 수 있습니다. 콘솔에 Google Chat API는 Google Workspace 사용자만 사용할 수 있다고 표시되는 경우, chat MCP 서버를 생략하거나 Workspace 기반 프로젝트/계정을 사용하세요.

Google Auth 플랫폼 구성

Google Cloud 콘솔에서 Google Auth Platform으로 이동합니다.

Google Auth Platform이 아직 구성되지 않았다면, Get Started를 클릭하고 다음을 제공하세요:

  • App name: 명확한 이름을 사용하세요(예: LibreChat Google Workspace MCP).
  • 사용자 지원 이메일: 귀하의 지원 이메일 또는 Google 그룹.
  • Audience: Google Workspace 조직의 경우 Internal을 선택하고, 사용자가 조직 외부인이거나 개인 Google 계정을 사용하는 경우 External을 선택하세요.
  • 개발자 연락처 정보: Google이 프로젝트에 대해 알림을 보낼 수 있는 이메일 주소입니다.

External을 선택하고 앱을 테스트 모드로 유지하는 경우, Audience > Test users 아래에 본인 및 허용할 다른 사용자를 추가하세요.

데이터 액세스 범위(Data Access scopes) 추가

Data Access > Add or Remove Scopes를 엽니다. Manually add scopes 아래에 사용하려는 서버의 스코프를 붙여넣습니다.

https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/gmail.compose
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/calendar.calendarlist.readonly
https://www.googleapis.com/auth/calendar.events.freebusy
https://www.googleapis.com/auth/calendar.events.readonly
https://www.googleapis.com/auth/directory.readonly
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/contacts.readonly
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.messages.readonly
https://www.googleapis.com/auth/chat.messages.create
https://www.googleapis.com/auth/chat.users.readstate.readonly

Add to Table, Update, 그리고 Save를 클릭하세요.

민감 및 제한된 범위

Gmail, Drive, Chat, Contacts 및 Directory 범위는 Google의 민감한 범위 또는 제한된 범위 검토를 트리거할 수 있습니다. 개인용 또는 제한된 개발 용도로 사용하는 경우, 사용자에게 확인되지 않은 앱 경고가 표시될 수 있으며 100명의 사용자 제한이 적용됩니다. 공개용 또는 조직 전체에서 사용하는 경우, Google의 OAuth 확인 절차와 필요한 모든 제한된 범위 검토를 완료하십시오.

웹 애플리케이션 OAuth 클라이언트 생성

Google Auth Platform > Clients에서 OAuth 클라이언트를 생성합니다:

  • 애플리케이션 유형: Web application
  • Name: 설명이 포함된 이름을 사용하세요 (예: LibreChat Google Workspace MCP)

구성하는 모든 서버에 대해 승인된 리디렉션 URI를 추가하세요. 로컬 개발의 경우:

http://localhost:3080/api/mcp/gmail/oauth/callback
http://localhost:3080/api/mcp/drive/oauth/callback
http://localhost:3080/api/mcp/calendar/oauth/callback
http://localhost:3080/api/mcp/people/oauth/callback
http://localhost:3080/api/mcp/chat/oauth/callback

프로덕션 환경의 경우, http://localhost:3080을 사용자의 LibreChat URL로 교체하세요:

https://chat.example.com/api/mcp/gmail/oauth/callback

Create를 클릭한 다음, Client IDClient secret을 복사하세요.

.env에 OAuth 자격 증명 추가하기

LibreChat .env 파일에 OAuth 클라이언트 값을 추가하세요:

GOOGLE_WORKSPACE_MCP_CLIENT_ID=your-oauth-client-id
GOOGLE_WORKSPACE_MCP_CLIENT_SECRET=your-oauth-client-secret

librechat.yaml의 참조를 함께 업데이트한다면 다른 환경 변수 이름을 사용할 수 있습니다.

librechat.yaml에 MCP 서버 추가하기

mcpServers 아래에 원하는 서버를 추가하세요. 이 예제는 현재 문서화된 모든 Google Workspace MCP 서버를 사용합니다:

mcpServers:
  gmail:
    type: streamable-http
    url: 'https://gmailmcp.googleapis.com/mcp/v1'
    timeout: 60000
    initTimeout: 150000
    requiresOAuth: true
    startup: false
    oauth:
      authorization_url: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent'
      token_url: 'https://oauth2.googleapis.com/token'
      client_id: '${GOOGLE_WORKSPACE_MCP_CLIENT_ID}'
      client_secret: '${GOOGLE_WORKSPACE_MCP_CLIENT_SECRET}'
      scope: 'https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.compose'
      redirect_uri: 'http://localhost:3080/api/mcp/gmail/oauth/callback'
      token_exchange_method: default_post
      token_endpoint_auth_methods_supported: ['client_secret_post']

  drive:
    type: streamable-http
    url: 'https://drivemcp.googleapis.com/mcp/v1'
    timeout: 60000
    initTimeout: 150000
    requiresOAuth: true
    startup: false
    oauth:
      authorization_url: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent'
      token_url: 'https://oauth2.googleapis.com/token'
      client_id: '${GOOGLE_WORKSPACE_MCP_CLIENT_ID}'
      client_secret: '${GOOGLE_WORKSPACE_MCP_CLIENT_SECRET}'
      scope: 'https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.file'
      redirect_uri: 'http://localhost:3080/api/mcp/drive/oauth/callback'
      token_exchange_method: default_post
      token_endpoint_auth_methods_supported: ['client_secret_post']

  calendar:
    type: streamable-http
    url: 'https://calendarmcp.googleapis.com/mcp/v1'
    timeout: 60000
    initTimeout: 150000
    requiresOAuth: true
    startup: false
    oauth:
      authorization_url: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent'
      token_url: 'https://oauth2.googleapis.com/token'
      client_id: '${GOOGLE_WORKSPACE_MCP_CLIENT_ID}'
      client_secret: '${GOOGLE_WORKSPACE_MCP_CLIENT_SECRET}'
      scope: 'https://www.googleapis.com/auth/calendar.calendarlist.readonly https://www.googleapis.com/auth/calendar.events.freebusy https://www.googleapis.com/auth/calendar.events.readonly'
      redirect_uri: 'http://localhost:3080/api/mcp/calendar/oauth/callback'
      token_exchange_method: default_post
      token_endpoint_auth_methods_supported: ['client_secret_post']

  people:
    type: streamable-http
    url: 'https://people.googleapis.com/mcp/v1'
    timeout: 60000
    initTimeout: 150000
    requiresOAuth: true
    startup: false
    oauth:
      authorization_url: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent'
      token_url: 'https://oauth2.googleapis.com/token'
      client_id: '${GOOGLE_WORKSPACE_MCP_CLIENT_ID}'
      client_secret: '${GOOGLE_WORKSPACE_MCP_CLIENT_SECRET}'
      scope: 'https://www.googleapis.com/auth/directory.readonly https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/contacts.readonly'
      redirect_uri: 'http://localhost:3080/api/mcp/people/oauth/callback'
      token_exchange_method: default_post
      token_endpoint_auth_methods_supported: ['client_secret_post']

  chat:
    type: streamable-http
    url: 'https://chatmcp.googleapis.com/mcp/v1'
    timeout: 60000
    initTimeout: 150000
    requiresOAuth: true
    startup: false
    oauth:
      authorization_url: 'https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent'
      token_url: 'https://oauth2.googleapis.com/token'
      client_id: '${GOOGLE_WORKSPACE_MCP_CLIENT_ID}'
      client_secret: '${GOOGLE_WORKSPACE_MCP_CLIENT_SECRET}'
      scope: 'https://www.googleapis.com/auth/chat.spaces.readonly https://www.googleapis.com/auth/chat.memberships.readonly https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages.create https://www.googleapis.com/auth/chat.users.readstate.readonly'
      redirect_uri: 'http://localhost:3080/api/mcp/chat/oauth/callback'
      token_exchange_method: default_post
      token_endpoint_auth_methods_supported: ['client_secret_post']

LibreChat가 공용 URL에 배포된 경우, 모든 redirect_uri를 Google Cloud에 등록된 정확한 리디렉션 URI와 일치하도록 업데이트하세요.

엄격한 MCP 도메인 허용 목록

librechat.yaml에서 mcpSettings.allowedDomains를 구성하는 경우, gmailmcp.googleapis.com, drivemcp.googleapis.com, calendarmcp.googleapis.com, chatmcp.googleapis.com, people.googleapis.com과 같이 사용하는 Google MCP 호스트를 추가하세요.

LibreChat 재시작

.envlibrechat.yaml을 다시 불러올 수 있도록 LibreChat을 재시작하세요.

배포명령어
Dockerdocker compose up -d
Local서버를 중지한 후 다시 시작하세요

Docker에서 로드된 서버를 확인하려면 API 로그를 확인하세요:

docker logs LibreChat --tail 200 | grep MCP

LibreChat의 각 서버 연결하기

LibreChat을 열고, MCP Settings 또는 채팅 입력창의 MCP Servers 드롭다운을 엽니다.

각 Google Workspace 서버에 대해:

  1. Connect를 클릭하세요.
  2. 브라우저에서 Google OAuth 흐름을 완료하세요.
  3. 요청된 스코프를 검토하세요.
  4. Allow을 클릭하세요.

OAuth가 성공하면, 서버의 도구를 채팅과 Agent Builder에서 사용할 수 있게 됩니다.

테스트

한 번에 하나의 서버를 대상으로 하는 프롬프트를 시도해 보세요:

서버프롬프트
People"내 Google 프로필에 따르면 내 이름은 뭐야?"
Drive"Marketing Plan이라는 파일을 찾아서 요약해 줘."
Gmail"마케팅 계획에 관한 내 최근 이메일을 찾아줘."
Gmail"[email protected]으로 마케팅 계획을 승인한다는 내용의 이메일 초안을 작성해 줘."
Calendar"Ariel과의 다음 회의는 언제야?"
Chat"마케팅 계획에 관한 최근 Google Chat 메시지를 검색해 줘."

문제 해결

증상확인해야 할 사항
Google에서 redirect_uri_mismatch 오류 발생Google OAuth 클라이언트 리디렉션 URI는 프로토콜, 호스트 이름, 포트, 서버 이름 및 경로를 포함하여 librechat.yamlredirect_uri와 정확히 일치해야 합니다.
LibreChat에 서버는 표시되지만 도구가 없음LibreChat UI에서 서버를 연결하세요. OAuth가 활성화된 원격 서버는 사용자가 인증을 완료한 후에 도구를 노출합니다.
Google에서 확인되지 않은 앱 경고 표시민감하거나 제한된 범위를 요청하는 확인되지 않은 앱의 경우 예상되는 동작입니다. 개인용 또는 제한된 개발 용도로 사용하는 경우, 프로젝트가 Google의 확인되지 않은 사용자 제한에 도달할 때까지 경고를 무시하고 계속 진행할 수 있습니다.
테스트 중에는 OAuth가 작동하지만 나중에 만료됨테스트 모드의 외부 앱은 7일 후에 만료되는 새로 고침 토큰을 받을 수 있습니다. 더 긴 수명의 새로 고침 토큰을 얻으려면 앱을 프로덕션으로 게시하거나, 개발 중에 다시 인증하세요.
Google Chat 구성이 비활성화됨Chat에는 Google Workspace 기반 프로젝트/계정을 사용하거나 chat 서버를 생략하세요.
MCP 요청이 LibreChat 도메인 정책에 의해 차단됨mcpSettings.allowedDomains가 구성된 경우, 사용하는 Google MCP 서버 호스트 이름을 추가하세요.

보안 참고 사항

  • 신뢰할 수 있는 LibreChat 인스턴스에만 Google Workspace MCP 서버를 연결하세요.
  • 사용자가 실제로 필요로 하는 제품과 범위만 요청하세요.
  • 이메일 전송, 채팅 메시지 게시, 파일 업로드 또는 캘린더 이벤트 변경 전에 어시스턴트가 제안한 작업을 검토하세요.
  • 이메일 메시지, 문서, 채팅 메시지를 신뢰할 수 없는 입력으로 취급하세요. 이러한 메시지에는 어시스턴트에 영향을 주려는 간접적인 프롬프트 주입(indirect prompt injection) 시도가 포함되어 있을 수 있습니다.
  • 공개 또는 조직 전체 배포의 경우, Google OAuth 인증을 완료하고 조직의 타사 앱 액세스 제어 정책을 따르십시오.

이 가이드는 어떤가요?