This guide explains how to install and run the TechWord Translator MCP Server using Docker.
-
Docker Desktop or Docker Engine
- Windows/Mac: Install Docker Desktop
- Linux: Install Docker Engine
-
Docker Compose (optional, but recommended)
- Included with Docker Desktop
- Linux users: Follow installation guide
Check that Docker is installed correctly:
docker --version
docker-compose --versionYou should see version numbers for both commands.
The MCP server requires the following environment variables to connect to the TechWordTranslator API:
| Variable | Required | Description | Example |
|---|---|---|---|
TECHWORD_TRANSLATOR_API_URL |
Yes | Base URL of the API | https://api.techwordtranslator.com |
*Note: Email and password are optional if the API allows unauthenticated access to public endpoints.
Create a .env file in the project root:
# Copy the example file
cp .env.example .envEdit the .env file with your credentials:
TECHWORD_TRANSLATOR_API_URL=https://your-api-url.comImportant: Never commit the .env file to version control!
This is the easiest method for local development and testing.
Ensure the docker-compose.yml file exists in your project root:
services:
techword-mcp:
build:
context: .
dockerfile: .docker/dev/Dockerfile
args:
UID: "${UID:-1000}"
GID: "${GID:-1000}"
container_name: techword-translator-mcp
volumes:
- ./src:/app/src:ro
- ./tests:/app/tests:ro
environment:
- TECHWORD_TRANSLATOR_API_URL=${TECHWORD_TRANSLATOR_API_URL}
- MCP_SERVER_NAME=TechWord Translator
- MCP_SERVER_VERSION=0.3.0
restart: unless-stopped
stdin_open: true
tty: true# Build the Docker image
docker compose build --no-cache
# Start the container
docker compose up -d
# View logs
docker compose logs -f
# Stop the container
docker compose downdocker compose psYou should see the techword-translator-mcp container running.
If you prefer to use Docker commands directly:
docker build -t techword-mcp .This creates a Docker image named techword-mcp.
Option A: Using environment variables directly
docker run -d \
--name techword-translator-mcp \
-e TECHWORD_TRANSLATOR_API_URL=https://your-api-url.com \
-e MCP_SERVER_NAME="TechWord Translator" \
-e MCP_SERVER_VERSION="0.3.0" \
techword-mcpOption B: Using .env file
docker run -d \
--name techword-translator-mcp \
--env-file .env \
techword-mcp# List running containers
docker ps
# View logs
docker logs -f techword-translator-mcp
# Check container status
docker inspect techword-translator-mcp# Docker Compose
docker-compose logs -f
# Docker CLI
docker logs -f techword-translator-mcp# Docker Compose
docker-compose stop
# Docker CLI
docker stop techword-translator-mcp# Docker Compose
docker-compose start
# Docker CLI
docker start techword-translator-mcp# Docker Compose
docker-compose restart
# Docker CLI
docker restart techword-translator-mcp# Docker Compose (stops and removes)
docker-compose down
# Docker CLI
docker stop techword-translator-mcp
docker rm techword-translator-mcpdocker rmi techword-mcpCheck logs:
docker-compose logs
# or
docker logs techword-translator-mcpCommon issues:
- Missing environment variables
- Invalid API credentials
- API endpoint not accessible
# Docker Compose
docker-compose down
docker-compose build --no-cache
docker-compose up -d
# Docker CLI
docker stop techword-translator-mcp
docker rm techword-translator-mcp
docker build --no-cache -t techword-mcp .
docker run -d --name techword-translator-mcp --env-file .env techword-mcpdocker stats techword-translator-mcp# Docker Compose
docker-compose exec techword-mcp /bin/sh
# Docker CLI
docker exec -it techword-translator-mcp /bin/shFrom inside the container:
docker exec -it techword-translator-mcp python -c "
from techword_translator.services.api_client import APIClient
import asyncio
async def test():
async with APIClient() as client:
words = await client.get_words(per_page=5)
print(f'Connected! Found {len(words.data)} words')
asyncio.run(test())
"- Use a Non-Root User (add to Dockerfile):
RUN adduser -D mcp
USER mcp- Scan for Vulnerabilities:
docker scan techword-mcpAdd resource constraints to docker-compose.yml:
services:
techword-mcp:
# ... other config ...
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256MOr with Docker CLI:
docker run -d \
--name techword-translator-mcp \
--memory="512m" \
--cpus="0.5" \
--env-file .env \
techword-mcpAdd to docker-compose.yml:
services:
techword-mcp:
# ... other config ...
healthcheck:
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40sThe container is configured to restart automatically:
restart: unless-stoppedThis ensures the container restarts after crashes or system reboots.
Since this is an MCP server using stdio (standard input/output), you cannot directly connect to it over HTTP. Instead:
Run the container locally and configure your MCP client to use it:
{
"mcpServers": {
"techword-translator": {
"command": "docker",
"args": ["exec", "-i", "techword-translator-mcp", "python", "-m", "techword_translator"]
}
}
}For Claude Desktop and other MCP clients, it's better to install locally:
pip install -e .Then configure:
{
"mcpServers": {
"techword-translator": {
"command": "python",
"args": ["-m", "techword_translator"],
"env": {
"TECHWORD_TRANSLATOR_API_URL": "https://your-api-url.com"
}
}
}
}If you want to share your image:
# Login to Docker Hub
docker login
# Tag the image
docker tag techword-mcp your-dockerhub-username/techword-mcp:latest
# Push to Docker Hub
docker push your-dockerhub-username/techword-mcp:latestOthers can then use:
docker pull your-dockerhub-username/techword-mcp:latest
docker run -d --name techword-translator-mcp --env-file .env your-dockerhub-username/techword-mcp:latest- Docker Documentation
- Docker Compose Documentation
- Best practices for writing Dockerfiles
- MCP Server Documentation
If you encounter issues:
- Check the Troubleshooting section
- Review container logs
- Verify environment variables are set correctly
- Ensure the API endpoint is accessible
- Open an issue on GitHub with logs and configuration