


Gmail, Google 캘린더, Google 드라이브, Google 검색을 비롯한 Google 서비스와 상호 작용할 수 있는 강력한 도구를 AI 도우미에게 제공하는 MCP 서버입니다.
개요
py-mcp-google-toolbox는 다음과 같은 Google 관련 기능을 제공합니다.
- Gmail 작업(읽기, 검색, 보내기, 수정)
- Google 캘린더 관리(이벤트 생성, 목록, 업데이트, 삭제)
- Google Drive 상호작용(검색, 파일 읽기)
- Google 검색 통합(웹 검색)
목차
필수 조건
- Python : Python 3.12 이상 설치
- Google Cloud Console 설정 :
- Google Cloud Console 로 이동
- 새 프로젝트를 만들거나 기존 프로젝트를 선택하세요
- 서비스 API 활성화:
- "API 및 서비스" > "라이브러리"로 이동하세요.
- "Gmail API"를 검색하여 활성화하세요.
- "Google 캘린더 API"를 검색하여 활성화하세요.
- "Google Drive API"를 검색하여 활성화하세요.
- 검색 양식을 열고 "사용자 정의 검색 API"를 활성화하세요.
- GCP에서 OAuth 2.0 자격 증명을 설정합니다.
- "API 및 서비스" > "자격 증명"으로 이동하세요.
- "자격 증명 만들기" > "OAuth 클라이언트 ID"를 클릭하세요.
- "웹 애플리케이션"을 선택하세요
- 클라이언트 ID와 클라이언트 비밀번호를 기록해 두세요.
- secret json을 다운로드하고 credentials.json으로 이름을 바꾸세요
- API 키 생성
- 사용자 정의 검색 엔진 으로 이동하여 ID를 가져옵니다.
설치
Git 복제
지엑스피1
구성
- UV 패키지 관리자를 설치하세요:
curl -LsSf https://astral.sh/uv/install.sh | sh
- 가상 환경을 만들고 활성화하세요.
uv venv -p 3.12
source .venv/bin/activate # On MacOS/Linux
# or
.venv\Scripts\activate # On Windows
- 종속성 설치:
uv pip install -r requirements.txt
- 새로고침 토큰을 받으세요(토큰이 만료된 경우 실행할 수 있습니다)
uv run get_refresh_token.py
이렇게 하면:
- Google OAuth 인증을 위해 브라우저를 엽니다.
- 다음 권한을 요청합니다.
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/gmail.send
https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
- 자격 증명을
token.json
에 저장합니다. - 콘솔에 새로 고침 토큰 표시
- 환경 변수:
cp env.example .env
vi .env
# change with your key
GOOGLE_API_KEY=your_google_api_key
GOOGLE_CSE_ID=your_custom_search_engine_id
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REFRESH_TOKEN=your_google_refresh_token
- credentials.json을 프로젝트 루트 폴더(py-mcp-google-toolbox)에 복사합니다.
Docker 사용하기
- Docker 이미지를 빌드합니다.
docker build -t py-mcp-google-toolbox .
- 컨테이너를 실행합니다.
docker run py-mcp-google-toolbox
로컬 사용
- 서버를 실행합니다:
MCP 설정 구성
MCP 설정 파일에 서버 구성을 추가합니다.
클로드 데스크톱 앱
- Smithery를 통해 자동으로 설치하려면:
npx -y @smithery/cli install @jikime/py-mcp-google-toolbox --client claude
- 수동으로 설치하려면
~/Library/Application Support/Claude/claude_desktop_config.json
엽니다.
mcpServers
개체에 다음을 추가합니다.
{
"mcpServers": {
"Google Toolbox": {
"command": "/path/to/bin/uv",
"args": [
"--directory",
"/path/to/py-mcp-google-toolbox",
"run",
"server.py"
]
}
}
}
커서 IDE
~/.cursor/mcp.json
엽니다
mcpServers
개체에 다음을 추가합니다.
{
"mcpServers": {
"Google Toolbox": {
"command": "/path/to/bin/uv",
"args": [
"--directory",
"/path/to/py-mcp-google-toolbox",
"run",
"server.py"
]
}
}
}
도커를 위해
{
"mcpServers": {
"Google Toolbox": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"py-mcp-google-toolbox"
]
}
}
}
도구 문서
Gmail 도구
list_emails
: 필터링 옵션을 사용하여 Gmail 받은 편지함의 최근 이메일을 나열합니다.search_emails
: 자세한 이메일 콘텐츠 검색을 통해 고급 Gmail 검색을 수행합니다.send_email
: CC, BCC 수신자를 지원하여 이메일을 작성하고 전송합니다.modify_email
: 라벨을 수정하여 이메일 상태(읽음/읽지 않음, 보관됨, 휴지통)를 변경합니다.
캘린더 도구
list_events
: 지정된 시간 범위 내에서 예정된 캘린더 이벤트를 검색합니다.create_event
: 참석자, 위치, 설명을 포함하여 새로운 캘린더 이벤트를 만듭니다.update_event
: 유연한 매개변수 업데이트를 통해 기존 캘린더 이벤트를 수정합니다.delete_event
: 이벤트 ID로 캘린더 이벤트를 제거합니다.
드라이브 도구
read_gdrive_file
: Google Drive 파일에서 콘텐츠를 읽고 검색합니다.search_gdrive
: 사용자 정의 가능한 쿼리로 Google Drive에서 파일을 검색합니다.
검색 도구
search_google
: Google 검색을 수행하고 형식화된 결과를 반환합니다.
개발
로컬 테스트를 위해 포함된 클라이언트 스크립트를 사용할 수 있습니다.
# Example: List emails
uv run client.py list_emails max_results=5 query="is:unread"
# Example: Search emails
uv run client.py search_emails query="from:test@example.com"
# Example: Send email
uv run client.py send_email to="test@example.com" subject="test mail" body="Hello"
# Example: Modify email
uv run client.py modify_email id=MESSAGE_ID remove_labels=INBOX add_labels=ARCHIVED
# Example: List events
uv run client.py list_events time_min=2025-05-01T00:00:00+09:00 time_max=2025-05-02T23:59:59+09:00 max_results=5
# Example: Create event
uv run client.py create_event summary="new event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com"
# Example: Update event
uv run client.py update_event event_id=EVENT_ID summary="update event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com"
# Example Delete event
uv run client.py delete_event event_id=EVENT_ID
# Example: Search Google
uv run client.py search_google query="what is the MCP?"
# Example: Search Google Drive
uv run client.py search_gdrive query=mcp
# Example: Read file
uv run client.py read_gdrive_file file_id=1234567890
특허
MIT 라이센스