Metadata-Version: 2.4
Name: razorpay-i18n-mcp
Version: 1.0.1
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

# razorpay-i18n-mcp

An MCP (Model Context Protocol) server that gives Claude agents the ability to detect and fix
internationalization (i18n) violations in Go and TypeScript/JavaScript codebases.

Built on Razorpay's **i18n-code-builder** skill — 14 reference documents covering detection
rules, i18nify API signatures, anomaly catalog (JPY zero-decimal, DST gaps, org-vs-country
logic, etc.), and language-specific patterns across Go/TypeScript/React/Python.

---

## How it works

The MCP exposes two tools. When Claude calls them, it gets back the actual code files **plus**
the relevant skill reference docs — so Claude reasons about violations and writes fixes using the
full i18n knowledge as context, rather than rigid regex matching or hardcoded templates.

```
Claude calls i18n_detect(path)
  → MCP reads code files from disk
  → MCP loads detection-rules.md + language-patterns.md + anomalies.md
  → Returns both to Claude

Claude reasons about violations using the skill patterns as guidance

Claude calls i18n_fix(path, violation_types)
  → MCP reads the file
  → MCP loads targeted reference docs (i18nify-api.md, currency.md, etc.)
  → Returns both to Claude

Claude writes the correct fix informed by the reference docs
```

No internal LLM calls. No API key required. Just file reading and knowledge delivery.

---

## Tools

| Tool | Description |
|------|-------------|
| `i18n_detect` | Read code files + load detection guidance. Claude identifies violations using skill patterns as inspiration. |
| `i18n_fix` | Read a file + load fix reference docs targeted to the violation types. Claude writes the correct fix. |

---

## Install

```bash
pip install razorpay-i18n-mcp
```

---

## Developer Integration Guide

### Option 1 — Claude Code CLI (recommended)

For individual developers using Claude Code in the terminal or IDE.

```bash
pip install razorpay-i18n-mcp
claude mcp add --scope user i18n-code-builder razorpay-i18n-mcp
```

The `--scope user` flag registers it globally — available in every project, not just the current one.

Verify:

```bash
claude mcp list
# i18n-code-builder: razorpay-i18n-mcp  - ✓ Connected
```

Restart Claude Code, then use the tools:

```
Use the i18n_detect tool to scan ./internal/payment
Use the i18n_fix tool to fix ./internal/payment/processor.go
```

---

### Option 2 — Project-level `.mcp.json` (team sharing)

For teams — commit this file so every developer who clones the repo gets the MCP automatically.

Create `.mcp.json` at the repo root:

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

Each developer still needs to run `pip install razorpay-i18n-mcp` once, then Claude Code
picks up the server automatically from `.mcp.json` when they open the project.

---

### Option 3 — Claude Desktop

For developers using the Claude Desktop app (Mac/Windows).

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (Mac) or
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):

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

Restart Claude Desktop. The tools appear automatically in every conversation.

---

### Option 4 — Claude Agent SDK (programmatic / CI)

For building automated agents or running i18n checks in CI pipelines.

```python
import asyncio
from claude_agent_sdk import query

async def check_i18n(service_path: str):
    async for msg in query(
        prompt=f"Use the i18n_detect tool to scan {service_path}",
        options={
            "mcpServers": {
                "i18n-code-builder": {
                    "command": "razorpay-i18n-mcp"
                }
            }
        }
    ):
        if "result" in msg:
            print(msg["result"])

asyncio.run(check_i18n("./internal/payment"))
```

Install the Agent SDK: `pip install claude-agent-sdk`

---

## Usage

Always name the tool explicitly (`i18n_detect` / `i18n_fix`) so Claude routes to the MCP.

### Detect violations

```
Use the i18n_detect tool to scan ./internal/payment
```

Claude receives the file contents alongside the skill's detection rules and language patterns,
then identifies violations such as:

- Hardcoded currency codes — `"INR"`, `"MYR"`, `"SGD"`
- Hardcoded timezones — `"Asia/Kolkata"`, `time.Local`
- Hardcoded dial codes — `"+91"`, `"+60"`
- Currency math — `amount * 100` (breaks JPY/BHD)
- Org-based country logic — `OrgID == "curlec"`
- `float64` for money amounts
- Country conditionals — `if country == "MY"`
- Switch on country — `case "IN":`

### Fix violations

```
Use the i18n_fix tool to fix ./internal/payment/processor.go
```

Pass the violation types from the detect step to load the most targeted reference docs:

```
Use the i18n_fix tool on ./internal/payment/processor.go with violation_types ["currency", "timezone"]
```

Claude receives the file and the relevant i18nify API reference, fix patterns, and anomaly docs,
then writes the corrected file using the exact import paths and function signatures from the skill.

### Typical workflow

```
1. Use the i18n_detect tool to scan ./internal
2. Use the i18n_fix tool to fix ./internal/payment/processor.go
3. Use the i18n_detect tool to scan ./internal/payment/processor.go
```

---

## What gets detected

| Level | Examples |
|-------|---------|
| **BASIC** | `"INR"`, `"Asia/Kolkata"`, `"+91"`, `amount * 100`, `time.Local`, `OrgID == "curlec"`, `float64` for money, hardcoded date format constants |
| **LOW_LEVEL** | `if country == "MY"`, `switch country { case "IN": }` |
| **HIGH_LEVEL** | Architectural violations — entire service flow is country-specific, cross-team effort > 1 sprint |

---

## Requirements

- Python ≥ 3.11
- No API key — no LLM calls inside the MCP

---

## PyPI

`https://pypi.org/project/razorpay-i18n-mcp/`
