Metadata-Version: 2.4
Name: razorpay-i18n-mcp
Version: 1.0.0
Summary: MCP server for Razorpay i18n-code-builder — detect and fix i18n violations in Go/TypeScript using Claude
Project-URL: Repository, https://github.com/razorpay/agent-skills
Author-email: Razorpay Engineering <engineering@razorpay.com>
License: MIT
Keywords: claude,i18n,internationalization,mcp,model-context-protocol,plugin,razorpay
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.11
Requires-Dist: mcp>=1.0.0
Description-Content-Type: text/markdown

# i18n-code-builder MCP

A Claude plugin (MCP server) that embeds the full **i18n-code-builder** skill — including all
14 reference documents — and exposes it as two focused tools for Claude agents:

| Tool | Purpose |
|------|---------|
| `i18n_detect` | Scan a file or directory; return all i18n violations as structured JSON |
| `i18n_fix` | Fix all BASIC + LOW_LEVEL violations in a file; return corrected code |

**Powered by Claude `claude-opus-4-6` with adaptive thinking.** Not regex — Claude reads the
actual code and applies the full Razorpay i18n knowledge: detection rules, i18nify API
reference, anomalies catalog (JPY zero-decimal, DST gaps, etc.), language patterns across
Go/TypeScript/React/Python, and more.

---

## Prerequisites — gcloud auth

Authentication uses Google Application Default Credentials (ADC). No API key needed.

```bash
gcloud auth application-default login
```

Your credentials are stored at `~/.config/gcloud/application_default_credentials.json`
and picked up automatically by the MCP server.

---

## Install

```bash
pip install i18n-code-builder-mcp
```

Or use without installing via `uvx`:

```bash
uvx i18n-code-builder-mcp
```

---

## Configure in Claude Code

Add to `~/.claude/settings.json` — no API key needed:

```json
{
  "mcpServers": {
    "i18n-code-builder": {
      "command": "i18n-code-builder-mcp"
    }
  }
}
```

To override the GCP project or region explicitly:

```json
{
  "mcpServers": {
    "i18n-code-builder": {
      "command": "i18n-code-builder-mcp",
      "env": {
        "VERTEX_PROJECT": "pod-velocity-claude-code",
        "VERTEX_REGION": "us-east5",
        "VERTEX_MODEL": "claude-opus-4-6@20251001"
      }
    }
  }
}
```

Restart Claude Code after saving.

---

## Configure in Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "i18n-code-builder": {
      "command": "i18n-code-builder-mcp"
    }
  }
}
```

---

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `VERTEX_PROJECT` | auto from ADC | GCP project ID |
| `VERTEX_REGION` | `us-east5` | Vertex AI region |
| `VERTEX_MODEL` | `claude-opus-4-6@20251001` | Claude model on Vertex |

---

## Import into Other Claude Agents (Agent SDK)

```python
from claude_agent_sdk import query

async for msg in query(
    prompt="Scan ./internal/payment for i18n violations, then fix the file with the most issues",
    options={
        "mcpServers": {
            "i18n-code-builder": {
                "command": "i18n-code-builder-mcp",
                "env": {
                    "VERTEX_PROJECT": "pod-velocity-claude-code",
                    "VERTEX_REGION": "us-east5"
                }
            }
        }
    }
):
    if "result" in msg:
        print(msg["result"])
```

---

## Usage

### Detect violations in a directory

```
Scan ./internal/payment for i18n violations
```

Returns JSON:
```json
[
  {
    "file": "processor.go",
    "line": 45,
    "level": "BASIC",
    "type": "currency",
    "description": "Hardcoded \"INR\" currency code",
    "snippet": "currency := \"INR\"",
    "fix_summary": "Use country_metadata.GetMetadataInformation(countryCode).DefaultCurrency"
  },
  {
    "file": "scheduler.go",
    "line": 88,
    "level": "BASIC",
    "type": "timezone",
    "description": "Hardcoded Asia/Kolkata timezone",
    "snippet": "loc, _ := time.LoadLocation(\"Asia/Kolkata\")",
    "fix_summary": "Use i18nify.NewCountry(countryCode).GetCountryMetadata().TimezoneOfCapital"
  }
]
```

### Fix a file

```
Fix all i18n violations in ./internal/payment/processor.go
```

Returns the complete corrected file with:
- `"INR"` → `country_metadata.GetMetadataInformation(countryCode).DefaultCurrency`
- `"Asia/Kolkata"` → i18nify country metadata lookup
- `amount * 100` → `currency.ConvertToMinorUnit(currencyCode, amount)`
- Country conditionals → DCS/GeoSDK lookups
- All required imports added

### Typical workflow

```
1. Scan the repo:   "Detect all i18n violations in ./internal"
2. Fix by file:     "Fix i18n violations in ./internal/payment/processor.go"
3. Verify:          "Scan ./internal/payment/processor.go again to confirm no violations remain"
```

---

## What's Detected

| Level | Examples |
|-------|---------|
| **BASIC** (auto-fixable) | `"INR"`, `"Asia/Kolkata"`, `"+91"`, `amount * 100`, `time.Local`, `OrgID == "curlec"`, `float64` for money, hardcoded format constants |
| **LOW_LEVEL** (auto-fixable) | `if country == "MY"`, `switch country { case "IN": }` |
| **HIGH_LEVEL** (needs architecture) | Entire service flow India-specific, cross-team effort > 1 sprint |

---

## Publish to PyPI

```bash
cd development/skills/i18n/i18n-code-builder-mcp-py
pip install build twine
python -m build
twine upload dist/*
```
