Skip to main content
Glama
README.md
# lingual-mcp

Model Context Protocol server for [`pi-lingual`](https://github.com/3ZEROS12/pi-lingual): the same mode engine, reachable from any MCP client.

Works with **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, **Cline**, and anything else that speaks MCP. Two run modes: **template mode** (no API key — the client's own model executes the compiled prompt) and **endpoint mode** (the server calls an OpenAI-compatible endpoint).

## Install

```bash
npm install -g lingual-mcp     # or: npx -y lingual-mcp
```

Point the client at it:

```json
{
  "mcpServers": {
    "lingual": {
      "command": "npx",
      "args": ["-y", "lingual-mcp"]
    }
  }
}
```

From a checkout instead:

```json
{
  "mcpServers": {
    "lingual": {
      "command": "node",
      "args": ["D:/Workspace/projects/active/lingual-mcp/bin/lingual-mcp.js"]
    }
  }
}
```

## Tools

| Tool | Arguments | Purpose |
| :--- | :--- | :--- |
| `lingual_transform_spec` | `text`, `loadout`, `sourceLang?`, `targetLang?`, `reasoning?`, `context?`, `includeVocab?` | Compiles a draft into a preset's product: `spec`, `commit`, `oss`, `yap`, `direct`, or any custom mode id. Code fences and stack traces stay untouched. |
| `lingual_bilingual_companion` | `text`, `sourceLang?`, `targetLang?`, `reasoning?`, `includeVocab?` | Dual-register phrasing (spoken vs. written), native nuance, and vocabulary callouts, using the companion slots from your `lingual.json`. |
| `lingual_prompt_template` | `loadout`, `sourceLang?`, `targetLang?`, `includeVocab?` | Returns the compiled system prompt and slot schema so the host agent can run it with its own model. |

Shared argument semantics:

- `loadout` accepts the five presets (`spec`, `commit`, `oss`, `yap`, `direct`), `companion` where it applies, and **any mode id declared in `~/.pi/agent/lingual.json`**. Custom ids are resolved at request time and offered in the tool schema.
- `reasoning` is one of `off`, `minimal`, `low`, `medium`, `high`. An explicit value overrides the level the mode pins (`spec` pins `low`, the rest pin `off`).
- `context` injects extra material for context-aware modes: a staged diff for `commit`, the previous turn for a review mode.
- `includeVocab: false` drops the vocabulary slot from both the prompt and the response.
- `sourceLang` is auto-detected from the script when omitted; `targetLang` defaults to `en`.

## Prompts

| Prompt | Arguments | Purpose |
| :--- | :--- | :--- |
| `spec_prompt` | `raw_idea`, `source_lang?`, `target_lang?` | Reusable prompt that structures a raw idea into a specification. |
| `conventional_commit` | `changes_summary`, `source_lang?`, `target_lang?` | Reusable prompt that turns a change summary into a Conventional Commit. |

Both are compiled through the same mode resolution, so a custom `spec` or `commit` mode in `lingual.json` changes what the prompts emit.

## Endpoint mode

Set any of these to let the server call a model itself:

| Variable | Description |
| :--- | :--- |
| `LINGUAL_ENDPOINT` / `OPENAI_BASE_URL` | OpenAI-compatible base URL (e.g. `https://api.openai.com/v1` or `http://127.0.0.1:3425/v1`) |
| `LINGUAL_API_KEY` / `OPENAI_API_KEY` | API key; loopback endpoints default to `"local"` when omitted |
| `LINGUAL_MODEL` / `OPENAI_MODEL` | Model id (default: `gpt-4o-mini`) |

`~/.pi/agent/lingual.json` is also read, so `endpoint`, `apiKey`, `model`, `explainLang`, `globalKillList`, and `modes` carry over from your Pi setup.

Without credentials, the transform and companion tools return `unconfigured_zero_key_fallback` with a `compiledSystemPrompt` field; `lingual_prompt_template` and the MCP prompts work with no key at all.

## Notes

- The server reports its `package.json` version in the MCP handshake.
- Requires `pi-lingual` `^0.9.0` for the core engine.
- `lingual-mcp` is not a Pi extension: it runs beside your editor's agent, not inside Pi.

MIT © [Jason Song](https://github.com/3ZEROS12)

TDQS

B3.3/5.0

Scored across 3 tools

Disambiguation3/5

lingual_prompt_template is clearly a meta/extraction tool, but lingual_transform_spec and lingual_bilingual_companion both take a free-form technical thought and return rewritten language output, so an agent may hesitate over which one to call for a plain 'rephrase this' request. The descriptions do differentiate (specs/commits vs. dual-register phrasing + nuance + vocab), which keeps it workable, but the boundary is soft.

Naming Consistency3/5

All three share the 'lingual_' prefix, which is good, but the suffixes mix structures: verb_noun (transform_spec), adjective_noun (bilingual_companion), and noun_noun (prompt_template). None of the names use a consistent action verb, so the pattern is readable but not predictable.

Tool Count4/5

Three tools is on the thin side, but each covers a genuinely distinct capability (transform, companion phrasing, prompt extraction) rather than padding. The scope is narrow enough that a larger set would likely be redundant.

Completeness3/5

The surface assumes modes/presets from ~/.pi/agent/lingual.json yet offers no tool to list, validate, or inspect available modes, forcing the agent to guess ids. There is also no reverse direction (explaining English engineering jargon back into native language), which is an obvious counterpart for a 'lingual' server.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues