Get startedGet started for free

Building a Currency Converter MCP Server

Time to begin building your first MCP server! Here, you'll define an MCP server called 'Currency Converter' that consists of a single tool called convert_currency() to convert monetary values between different currencies.

This tool should take amount, from_currency, and to_currency parameters, and return a string containing the amount converted into the desired currency, along with the exchange rate used.

For example, 100 EUR = 88.04 GBP (Rate: 0.8804).

This exercise is part of the course

Introduction to Model Context Protocol (MCP)

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create an MCP server instance
mcp = ____("____")
Edit and Run Code