Skip to main content
Glama
miwidot

translator-mcp

by miwidot
README.md
# Translation MCP Server

A secure MCP server that allows AI to translate database content from English to German directly in your live database.

šŸ“š **[Full Documentation](./DOCUMENTATION.md)** - Complete guide with architecture, security details, and deployment instructions

## Security Features

- **Read-only by default**: Only SELECT and UPDATE permissions on specific columns
- **No DELETE permissions**: Cannot remove any data
- **Column whitelisting**: Only specified German columns can be updated
- **Audit logging**: All translations are logged with timestamps and session IDs
- **Connection pooling**: Limited concurrent connections to prevent overload
- **Input validation**: All inputs are validated with Zod schemas
- **Transaction support**: Bulk updates use transactions for data integrity

## Setup

### 1. Database Setup

Run the SQL script to create a restricted user:

```bash
mysql -u root -p < database-setup.sql
```

### 2. Install Dependencies

```bash
npm install
```

### 3. Configure Environment

Copy `.env.example` to `.env` and update with your database credentials:

```bash
cp .env.example .env
```

### 4. Build the Server

```bash
npm run build
```

### 5. Configure MCP Client

Add to your MCP client settings (e.g., Claude Desktop: `~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "translation-server": {
      "command": "node",
      "args": ["/absolute/path/to/translatemcp/dist/index.js"],
      "env": {
        "DB_HOST": "your-server.com",
        "DB_USER": "mcp_translator",
        "DB_PASSWORD": "secure_password",
        "DB_NAME": "your_database",
        "ALLOWED_TABLES": "{...your config...}"
      }
    }
  }
}
```

## Usage with AI

Once configured, AI can use these tools:

1. **get_translation_items**: Fetch items needing translation
2. **update_translation**: Update a single item's German translations
3. **bulk_update_translations**: Update multiple items in one transaction
4. **get_translation_progress**: Check translation statistics

Example AI conversation:
```
You: "Please translate the first 10 products from English to German"
AI: [Uses get_translation_items to fetch products]
AI: [Translates each item]
AI: [Uses bulk_update_translations to save all translations]
```

## Documentation

- šŸ“– **[Complete Documentation](./DOCUMENTATION.md)** - In-depth technical guide
- šŸ—ļø **[Architecture Overview](./DOCUMENTATION.md#architecture)** - System design and components  
- šŸ”’ **[Security Model](./DOCUMENTATION.md#security-model)** - Security layers and protections
- šŸš€ **[Deployment Guide](./DOCUMENTATION.md#deployment-guide)** - Production setup instructions
- šŸ”§ **[Troubleshooting](./DOCUMENTATION.md#troubleshooting)** - Common issues and solutions


## Monitoring

Check translation audit logs:

```sql
SELECT * FROM translation_audit 
WHERE translated_at > DATE_SUB(NOW(), INTERVAL 1 DAY)
ORDER BY translated_at DESC;
```

Check translation progress:

```sql
SELECT table_name, COUNT(DISTINCT record_id) as records_translated
FROM translation_audit
GROUP BY table_name;
```