Skip to main content
Glama
Andrei-Blagov

currency-bot-db

Currency MCP Bot (学習プロジェクト)

Telegram Bot + 公開API + Docker/PostgreSQL + MCP + Cursor のシンプルな連携例です。

構成

Telegram
   ↓
Python Bot
   ↓
API курса валют

Python Bot
   ↓
PostgreSQL
   ↑
   MCP
   ↑
Cursor

Related MCP server: postgres-mcp

Telegram Bot の役割

/start/usd/eur/cny コマンドを受け付け、通貨のルーブルに対するレートを返します。

API の役割

ボットは無料の公開API(open.er-api.com)から最新レートを取得します。キー不要・登録不要です。

Docker の役割

docker compose が PostgreSQL をコンテナで起動します。ボット自体はローカルでPythonとして実行されます。

MCP の役割

MCPサーバーは Cursor に同じデータベースへの2つのツールを提供します:

  1. get_recent_requests — ユーザーの最近のリクエスト

  2. get_currency_stats — USD / EUR / CNY が何回尋ねられたか

ファイル

ファイル

説明

bot.py

Telegram ボット (aiogram)

db.py

ORMなしのPostgreSQL

mcp_server.py

Cursor用のMCPサーバー

docker-compose.yml

Docker内のPostgreSQL

.cursor/mcp.json

このプロジェクトでのMCP接続

.env

シークレットと設定(Gitには含めない)

クイックスタート

1. Python の依存関係

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

2. 環境変数

サンプルをコピーしてボットのトークンを貼り付けます:

copy .env.example .env

.env に次の内容を入力します:

TELEGRAM_BOT_TOKEN=ваш_токен_от_BotFather

3. Docker で PostgreSQL を起動

docker compose up -d

確認:

docker compose ps

4. ボットの起動

python bot.py

Telegram でボットに /start を送信し、次に /usd/eur/cny を送信します。

5. Cursor での MCP

プロジェクトには .cursor/mcp.json があります。Windows では、サーバーが Connected リストに確実に表示されるよう、ユーザー用の ~/.cursor/mcp.json にも追加されています。

  1. 最初に venv を作成し、依存関係をインストールします(上記ステップ1)

  2. Ctrl+Shift+PDeveloper: Reload Window

  3. Settings → MCP を開きます

  4. currency-bot-db を見つけます — ステータスが緑色で、tools: get_recent_requestsget_currency_stats となっているはずです。

サーバーがない場合やステータスが赤い場合は、PostgreSQL(docker compose ps)と .venv がインストールされていることを確認してください。

Telegram Bot Token の入手方法

  1. Telegram を開いて @BotFather を探します

  2. /newbot を送信します

  3. ボットの名前と username を決めます

  4. BotFather から 123456:ABC... のようなトークンが送られてきます

  5. それを .envTELEGRAM_BOT_TOKEN=... として貼り付けます

トークンを Git にコミットしないでください。.env ファイルはすでに .gitignore に含まれています。

Cursor での MCP へのテストリクエスト

ボットにいくつかコマンドを送信した後、Cursor のチャットに次のように書いてください:

  • 「ユーザーの最近のリクエストを表示して」

  • 「ユーザーが最もよくリクエストした通貨はどれ?」

  • 「get_recent_requests を limit=5 で呼び出して」

  • 「get_currency_stats を呼び出して」

Cursor は MCP ツールの get_recent_requestsget_currency_stats を使用します。

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    Enables 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.
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for PostgreSQL that enables Cursor and other MCP clients to execute SQL queries, list tables, and explore database schemas via HTTP.
    2,422
    MIT
  • F
    license
    Not graded
    quality
    F
    maintenance
    Provides read-only SQL query access to Postgres and DuckDB databases via MCP tools, with extensive security hardening for public endpoints.
    1
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables querying and interacting with PostgreSQL databases using natural language through MCP. Supports configuration via environment variables and Cursor IDE integration.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Andrei-Blagov/MCP_HW'

If you have feedback or need assistance with the MCP directory API, please join our Discord server