Skip to main content
Glama
RichGom84

exchange_rate_MCP

by RichGom84
README.md
# USD/KRW Exchange Rate MCP Server

This project is a small Python FastMCP server that answers questions about the USD/KRW exchange rate.

It uses this Frankfurter API endpoint:

```text
https://api.frankfurter.dev/v2/rate/USD/KRW
```

When a user asks things like "USD/KRW rate?", "dollar-won exchange rate?", or "How many Korean won is 1 dollar?", an MCP client can call this server's tools and return the live result.

## Files

```text
server.py         FastMCP server
requirements.txt Python dependencies
render.yaml      Render Blueprint configuration
README.md        Setup and deployment guide
READM.md         Short pointer to README.md
```

## MCP Tools

### `get_usd_krw_exchange_rate`

Returns the latest USD/KRW exchange rate as structured data.

Example result:

```json
{
  "date": "2026-06-20",
  "base": "USD",
  "quote": "KRW",
  "rate": 1532.78,
  "source": "https://api.frankfurter.dev/v2/rate/USD/KRW"
}
```

### `answer_usd_krw_exchange_rate`

Returns a user-friendly Korean sentence generated from the live API result.

The source code stores the Korean sentence template with Unicode escape sequences. This keeps `server.py` safe across Windows terminals, GitHub, and Render deployments.

## Run Locally

### 1. Create a virtual environment

Windows PowerShell:

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
```

macOS/Linux:

```bash
python -m venv .venv
source .venv/bin/activate
```

### 2. Install dependencies

```bash
pip install -r requirements.txt
```

### 3. Start the MCP server

```bash
python server.py
```

Default local MCP endpoint:

```text
http://localhost:8000/mcp
```

Health check endpoint:

```text
http://localhost:8000/health
```

To use another port:

Windows PowerShell:

```powershell
$env:PORT=9000
python server.py
```

macOS/Linux:

```bash
PORT=9000 python server.py
```

## Deploy to Render

This repository includes `render.yaml`, so the easiest option is Render Blueprint deployment.

### Option 1. Deploy with `render.yaml`

1. Push this project to a GitHub repository.
2. Open the Render dashboard.
3. Click `New +`.
4. Choose `Blueprint`.
5. Connect the GitHub repository.
6. Render will read `render.yaml` and create the web service.

After deployment, your MCP endpoint will look like this:

```text
https://YOUR-RENDER-SERVICE.onrender.com/mcp
```

The health check endpoint will be:

```text
https://YOUR-RENDER-SERVICE.onrender.com/health
```

### Option 2. Create a Render Web Service manually

Use these settings:

```text
Runtime: Python
Build Command: pip install -r requirements.txt
Start Command: python server.py
Health Check Path: /health
```

Render automatically provides the `PORT` environment variable. `server.py` reads that value and starts the server on the correct port.

## MCP Client Setup

If your MCP client supports remote HTTP MCP servers, register this URL:

```text
https://YOUR-RENDER-SERVICE.onrender.com/mcp
```

The exact client configuration depends on the MCP client you use. The important details are:

```text
Transport: HTTP
Endpoint path: /mcp
```

## API Source

- Frankfurter docs: https://frankfurter.dev/
- USD/KRW endpoint: https://api.frankfurter.dev/v2/rate/USD/KRW

No API key is required.