반응형
2026년 4월 27일 | 제주 AI 아키랩
📋 목표
Python MCP 서버를 클라우드에 배포해서 어디서든 Claude Desktop과 연결하여 사용하기
⚙️ 환경 설정
GCP 설정 완료
- 계정: woogim@gmail.com
- 프로젝트: gen-lang-client-########## (Google AI Studio 자동 생성)
- 리전: asia-northeast3 (서울)
- 존: asia-northeast3-a
로컬 파일 구조 (C:\\Users\\[사용자]\\Desktop\\mcp_test)
mcp_test/
├── server.py # MCP 서버 메인 파일
├── Dockerfile # 컨테이너 설정
├── requirements.txt # 패키지 목록
├── server.js
└── client.js
server.py 최종 버전
import os
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("add-mcp-http")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
port = int(os.environ.get("PORT", 8080))
mcp.run(transport="sse")
requirements.txt
mcp[cli]
uvicorn
❌ GCP Cloud Run 배포 실패
시도한 것들
- API 활성화: run.googleapis.com, cloudbuild.googleapis.com, artifactregistry.googleapis.com ✅
- IAM 권한 추가: artifactregistry.reader 역할 부여 ✅
- 새 프로젝트 생성: jeju-mcp-server-2026 생성 후 시도 ✅
- 이미지 직접 지정 배포 시도 ✅
- 다른 리전(us-central1) 시도 ✅
실패 원인
ERROR: Container import failed.
reason: ContainerImageImportFailed
결론: gen-lang-client-* 프로젝트는 Google AI Studio 자동 생성 프로젝트로 Cloud Run 컨테이너 실행에 내부 제한이 있음. 새 프로젝트도 동일 계정 레벨 제한으로 실패.
✅ Railway 배포 성공!
배포 과정
- GitHub repo 생성: woogim-afk/mcp-test
- 코드 push (폴더 구조: Desktop/mcp_test/)
- Railway 접속 → GitHub 연동 → 자동 배포
배포 결과
항목 값
| 플랫폼 | Railway |
| 상태 | 🟢 Online |
| URL | https://mcp-test-production-f362.up.railway.app |
| SSE 엔드포인트 | https://mcp-test-production-f362.up.railway.app/sse |
🔌 Claude Desktop 연결 방법
설정 파일 위치
C:\\Users\\[사용자]\\AppData\\Roaming\\Claude\\claude_desktop_config.json
설정 내용
{
"mcpServers": {
"my-server": {
"url": "<https://mcp-test-production-f362.up.railway.app/sse>",
"transport": "sse"
}
}
}
연결 후 테스트
Claude Desktop에서 add(3, 5) 입력 → 결과: 8
📝 배운 점
- Google AI Studio 자동 생성 프로젝트(gen-lang-client-*)는 Cloud Run 사용 불가
- Railway는 GitHub 연동만으로 Dockerfile 자동 감지 후 배포 가능
- FastMCP의 run() 메서드는 버전에 따라 host, port 파라미터 지원 여부가 다름
- Cloud Run 배포 시 0.0.0.0:8080 바인딩 필수
🔜 다음 단계
- Claude Desktop 앱 설치 및 MCP 연결 테스트
- MCP 서버에 더 많은 도구(tool) 추가
- 제주 AI 아키랩 프로젝트에 활용
'클로드(claude) > 클로드코드 사용일지' 카테고리의 다른 글
| 제주도지역 옥상 우수량 산출기 — 개발 과정 및 산정 방법론 (0) | 2026.05.27 |
|---|---|
| 🎙️ 시리로 Claude 음성 비서 만들기 (0) | 2026.05.18 |
| Claude Code + ECC 환경 설정 정리 (2026-04-29) (0) | 2026.04.29 |
| MCP 배포하기 (0) | 2026.04.27 |
| 2026-04-24 작업 일지 — AgentShield 보안 스캔 및 수정 (0) | 2026.04.25 |