Get the FREE Ultimate OpenClaw Setup Guide →

mcp -demo

MCP Server demo code in Python

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio manishh-mcp-server-demo uv run currency.py \
  --env CURRENCY_API_KEY="<your-API-key>"

How to use

This MCP server provides two AI-callable tools for working with currencies: convert_currency and list_currencies. The convert_currency tool takes an amount, a source currency code, and a target currency code to return the converted value. The list_currencies tool fetches and returns the supported currencies from an external Currency API. You can test and interact with these tools through standard MCP JSON-RPC requests, or by using the included test_mcp.py script to see the available tools and their expected payloads. When integrated with Claude Desktop, you can connect to the server by configuring the mcpServers.currency entry in claude_desktop_config.json, pointing to the UV runner that executes currency.py and optionally providing your Currency API key via the CURRENCY_API_KEY environment variable. This setup enables Claude to call the two tools directly from your local MCP server.

How to install

Prerequisites:

  • Python 3.10+
  • UV installed (for dependency management and running the MCP server)
  • Access to a Currency API key

Installation steps:

  1. Clone the repository: git clone https://github.com/manishh/mcp-server-demo cd <project-directory>

  2. Create and activate a Python virtual environment (optional but recommended):

    if using Python venv

    python3 -m venv .venv source .venv/bin/activate # macOS/Linux .venv\Scripts\activate # Windows

  3. Install dependencies and set up the environment: uv sync

  4. Export your Currency API key (required by the server): export CURRENCY_API_KEY=your_api_key_here # macOS/Linux set CURRENCY_API_KEY=your_api_key_here # Windows

  5. Start the MCP server: uv run currency.py

  6. (Optional) Test available tools locally: python test_mcp.py

Notes:

  • Ensure the CURRENCY_API_KEY environment variable is set before starting the server.
  • The server uses stdio transport for integration with local AI agents like Claude Desktop.

Additional notes

Tips and troubleshooting:

  • If you encounter authentication or key issues, verify that CURRENCY_API_KEY is correctly exported and accessible to the process running currency.py.
  • For Claude Desktop integration, ensure the absolute path to the UV executable and the project directory are correctly configured in claude_desktop_config.json as shown in the README example.
  • The server is educational and uses an external Currency API; rate limits or API changes may affect tool responses.
  • The two available tools are:
    • convert_currency: converts a given amount from one currency to another.
    • list_currencies: returns a list of supported currencies from the external API.
  • If you modify currency.py or related files, re-test with python test_mcp.py to verify tool availability and RPC formats.

Related MCP Servers

Sponsor this space

Reach thousands of developers