Levelang MCP Server

Levelang MCP Server

Integrates the levelang.app translation API with AI assistants to provide translations constrained to specific learner proficiency levels. It supports multiple languages and allows users to control translation styles and moods while dynamically discovering available language configurations.

Category
访问服务器

README

levelang.app MCP Server

CI Python 3.12+ MCP SDK uv

An MCP server that exposes the levelang.app translation API to AI assistants. Unlike standard translators that always produce native-speaker complexity, levelang.app constrains translations to the learner's proficiency level.


Features

  • Level-Aware Translation — Translate text at beginner, intermediate, advanced, or fluent proficiency with grammar constraints enforced per level
  • Multi-Language Support — French, German, Italian, Mandarin Chinese, Cantonese, with transliteration where applicable
  • Mood Control — Casual, polite, and formal translation styles
  • Language Discovery — Query available languages, levels, and moods dynamically from the backend
  • MCP Resourceslevelang://languages and levelang://languages/{code} for pulling language configs into context
  • Stateless Wrapper — No database, no shared state; translates MCP tool calls into backend HTTP requests

Quick Start

You need two things: the MCP server URL and an API key. No local setup required.

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "levelang": {
      "url": "https://your-mcp-server-url/mcp",
      "headers": {
        "Authorization": "Bearer your-api-key"
      }
    }
  }
}

Claude Desktop

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

{
  "mcpServers": {
    "levelang": {
      "url": "https://your-mcp-server-url/mcp",
      "headers": {
        "Authorization": "Bearer your-api-key"
      }
    }
  }
}

Restart Claude Desktop. A hammer icon in the chat input indicates MCP tools are available.

Example Usage

Once connected, ask your AI assistant things like:

Translate "I would like to order a coffee, please" into French at the beginner level.

What languages does Levelang support?

Compare how "I'm worried the new rules might prevent us from finishing on time" translates into German at beginner vs advanced level.

Server Configuration

The settings below are for running the MCP server (local development or self-hosting). End users connecting via URL do not need these.

All configuration is through environment variables. When running locally via stdio, these go in the env block of your MCP client config.

Variable Required Default Description
LEVELANG_API_BASE_URL No http://localhost:8000/api/v1 Levelang backend URL
LEVELANG_API_KEY Depends Service key (sk_xxx) for backend auth
MCP_TRANSPORT No stdio Transport: stdio or streamable-http
MCP_PORT No 8463 Port when using HTTP transport
MCP_API_KEYS No Comma-separated valid API keys for HTTP auth

LEVELANG_API_KEY is required when connecting to a remote backend (staging/production). It may be omitted for local development if the backend has auth disabled.

MCP_API_KEYS controls client authentication for the HTTP transport. When set, clients must send Authorization: Bearer <key> with a key from this list. When empty or unset, auth is disabled (open access). This has no effect on stdio transport.

Local stdio Connection

For local development you can run the MCP server as a subprocess instead of connecting via URL. This requires Python 3.12+, uv, and a running Levelang backend.

git clone https://github.com/beverage/levelang-mcp.git
cd levelang-mcp
uv sync
{
  "mcpServers": {
    "levelang": {
      "command": "uv",
      "args": [
        "run",
        "--directory", "/absolute/path/to/levelang-mcp",
        "python", "-m", "levelang_mcp"
      ],
      "env": {
        "LEVELANG_API_BASE_URL": "http://localhost:8000/api/v1"
      }
    }
  }
}

Development

Setup

uv sync
git config core.hooksPath .githooks

This enables pre-commit (auto-fix lint + format) and pre-push (lint + format check + tests) hooks.

Running Tests

uv run pytest tests/ -v

MCP Inspector

The MCP Inspector provides a web UI for browsing and invoking tools and resources:

npx @modelcontextprotocol/inspector uv run --directory /path/to/levelang-mcp python -m levelang_mcp

Project Structure

src/levelang_mcp/
├── __main__.py       # Entrypoint (python -m levelang_mcp)
├── server.py         # MCP tools and resources
├── auth.py           # API-key auth middleware for HTTP transport
├── client.py         # Async HTTP client for the Levelang API
├── config.py         # Environment variable loading
└── formatting.py     # API response → human-readable text

tests/
├── test_auth.py      # Auth middleware and config tests
├── test_client.py    # HTTP client tests (mocked)
├── test_formatting.py
└── test_tools.py     # Tool integration tests (mocked)

Architecture

MCP Client              levelang-mcp              Levelang Backend
(Claude, Cursor,   ◄── MCP/stdio ──►   (this)   ─── HTTP ──►   (FastAPI)
 Claude Code)                                     POST /translate
                                                  GET /languages/details
                                                  GET /languages/{code}

The MCP server is a stateless wrapper. It translates MCP tool calls into HTTP requests to the Levelang backend and formats responses as human-readable text for the LLM. It does not share code, database connections, or deployment with the backend.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选