currency-bot-db
Currency MCP Bot (학습 프로젝트)
Telegram Bot + 공개 API + Docker/PostgreSQL + MCP + Cursor 연동의 간단한 예제입니다.
구성도
Telegram
↓
Python Bot
↓
API курса валют
Python Bot
↓
PostgreSQL
↑
MCP
↑
CursorRelated MCP server: postgres-mcp
여기서 Telegram Bot이 하는 일
/start, /usd, /eur, /cny 명령을 받아 루블 대비 환율로 응답합니다.
여기서 API가 하는 일
봇은 무료 공개 API(open.er-api.com)에서 최신 환율을 요청합니다. 키나 등록이 필요 없습니다.
여기서 Docker가 하는 일
docker compose가 컨테이너에 PostgreSQL을 띄웁니다. 봇 자체는 Python으로 로컬에서 실행됩니다.
여기서 MCP가 하는 일
MCP 서버는 Cursor에 동일한 데이터베이스에 대한 두 가지 도구를 제공합니다:
get_recent_requests— 사용자들의 최근 요청get_currency_stats— USD / EUR / CNY를 물어본 횟수
파일
파일 | 용도 |
| Telegram 봇 (aiogram) |
| ORM 없는 PostgreSQL |
| Cursor용 MCP 서버 |
| Docker의 PostgreSQL |
| 이 프로젝트의 MCP 연결 |
| 시크릿 및 설정 (Git 미포함) |
빠른 시작
1. Python 의존성
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt2. 환경 변수
예시를 복사해 봇 토큰을 붙여넣으세요:
copy .env.example .env.env에 다음을 입력하세요:
TELEGRAM_BOT_TOKEN=ваш_токен_от_BotFather3. Docker로 PostgreSQL 실행
docker compose up -d확인:
docker compose ps4. 봇 실행
python bot.pyTelegram에서 봇에게 /start를 보낸 다음 /usd, /eur, /cny를 보내세요.
5. Cursor에서 MCP
프로젝트에 .cursor/mcp.json이 있습니다. Windows에서는 서버가 사용자 ~/.cursor/mcp.json에도 추가되어, Connected 목록에 반드시 표시됩니다.
먼저 venv를 만들고 의존성을 설치하세요(위 1단계).
Ctrl+Shift+P→ Developer: Reload WindowSettings → MCP를 여세요.
currency-bot-db를 찾으세요 — 상태가 초록색이어야 하며, 도구:get_recent_requests,get_currency_stats입니다.
서버가 없거나 상태가 빨간색이면 PostgreSQL(docker compose ps) 및 .venv 설치 여부를 확인하세요.
Telegram Bot Token 얻는 방법
Telegram을 열고 @BotFather를 찾으세요.
/newbot을 보내세요.봇의 이름과 username을 정하세요.
BotFather가
123456:ABC...형식의 토큰을 보내줍니다..env에TELEGRAM_BOT_TOKEN=...으로 붙여넣으세요.
토큰을 Git에 커밋하지 마세요 — .env 파일은 이미 .gitignore에 있습니다.
Cursor에서 MCP 테스트 요청
봇에게 여러 명령을 보낸 후 Cursor 채팅에 다음과 같이 입력하세요:
«사용자들의 최근 요청을 보여줘»
«사용자들이 가장 자주 요청한 통화는 뭐예요?»
«get_recent_requests를 limit=5로 호출해줘»
«get_currency_stats를 호출해줘»
Cursor는 MCP 도구 get_recent_requests와 get_currency_stats를 사용해야 합니다.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Query your real net worth, spending, transactions, budgets and portfolio from any MCP client.
Analytics for MCP servers. Query your tool calls, first-call success, retries and schema cost.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables querying PostgreSQL database metadata including table lists and schema information through the MCP protocol. Supports stdio transport for Cursor/IDE integration as well as HTTP transport with health check endpoints.2MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for PostgreSQL that enables Cursor and other MCP clients to execute SQL queries, list tables, and explore database schemas via HTTP.1,195 npmMIT
- FlicenseNot gradedqualityFmaintenanceProvides read-only SQL query access to Postgres and DuckDB databases via MCP tools, with extensive security hardening for public endpoints.1-
- AlicenseAqualityDmaintenanceEnables querying and interacting with PostgreSQL databases using natural language through MCP. Supports configuration via environment variables and Cursor IDE integration.3MIT