We made this very simple version of the DeepL MCP Server to show how this can be done, in a real-world use case. Like, although this is stripped down, you can totally use it in production.
- You don't need to use uv to install and manage your dependencies, but here we do.
- You'll also need a DeepL API key, which you can get here.
If you don't have uv installed:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or with pip
pip install uvcd workshops/deepl-simple-python# Create a new virtual environment
uv venv
# Activate the virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate# Install all required packages
uv syncOr install packages individually:
uv add fastmcp
uv add deepl
uv add fastmcpCreate a .env file or set your DeepL API key:
# Option 1: Export environment variable
export DEEPL_API_KEY="your-deepl-api-key-here"
# Option 2: Create .env file
echo "DEEPL_API_KEY=your-deepl-api-key-here" > .envYou'll probably want to install this server in your favorite local AI client, like Claude Desktop, ChatGPT for Desktop, Cursor, Windsurf, etc. To do so, you'll want to insert something like this into the client's configuration JSON:
"deepl-simple-python": {
"command": "/Users/sofo/.local/bin/uv",
"args": [
"--directory",
"/Users/sofo/Code/deepl-mcp-server/workshops/deepl-simple-python",
"run",
"fastmcp",
"run",
"deepl-simple.py"
],
"env": {
"DEEPL_API_KEY": "eaa91948-f5af-4e32-ad8f-8de58ae51b73"
}
}The tools progress from very simple to a slightly elaborate:
translate-dude(): takes no arguments, and returns the same text every time. No API calls. Simplicity itself!get-source-languages(): retrieves the list of source languages supported by DeepL.get-target-languages(): retrieves the list of target languages supported by DeepL.translate-text(): translates text into a target language using the DeepL API. This one accepts the text to translate, the target language code, and an optionalformalityvalue.
-
Missing API Key
Error: DEEPL_API_KEY environment variable not setSolution: Set your DeepL API key as described in step 4 above.
-
Python Version Error
Error: Python >=3.10 requiredSolution: Install Python 3.13 or use
uv python install 3.13. -
Import Errors
ModuleNotFoundError: No module named 'fastmcp'Solution: Ensure virtual environment is activated and run
uv sync.
- Review DeepL API documentation
- Check the FastMCP documentation
This project follows the same license as the parent repository.