Skip to main content
Glama

SuanLinFang MCP Server — Pay-as-you-go AI capabilities

Official website: https://suanlinfang.cn — create an API key at API Key Management (new accounts get a free trial credit).

Remote MCP server with 12 tools in four capability families, Chinese-optimized, pay-as-you-go (failed calls are never billed):

Family

Tools

Highlights

Image Generation

generate_image, get_image_task, list_image_models

text-to-image & image-to-image (edit) in a single call — submit, wait and get the result URL; 1024×1024 PNG, model auto-selected by default, billed per image

Speech-to-Text (STT)

transcribe_audio, submit_transcription_task, get_transcription_task

≤2h audio, hot-word correction, auto detection for Mandarin/English + 22 Chinese dialects

Text-to-Speech (TTS)

synthesize_speech, submit_speech_task, get_speech_task, list_tts_voices

21 voices, ≤200k chars per task, wav/mp3

OCR (documents)

submit_document_task, get_document_task

full scanned PDFs up to 500 pages — whole-document jobs agents can't ingest into their own context; standard/accurate tiers, custom prompt (accurate tier)

Works with any MCP client that supports Streamable HTTP:

{
  "mcpServers": {
    "suanlinfang": {
      "type": "streamableHttp",
      "url": "https://suanlinfang.cn/mcp",
      "headers": {
        "X-SLF-Api-Key": "nk-YOUR_API_KEY"
      }
    }
  }
}

Claude Code one-liner:

claude mcp add --transport http suanlinfang https://suanlinfang.cn/mcp \
  --header "X-SLF-Api-Key: nk-YOUR_API_KEY"

Browse the tool catalog without a key: the endpoint answers initialize and tools/list publicly — tool calls require your key.

Related MCP server: Sairen

Install (local stdio)

Published on PyPI as suanlinfang-mcp:

pip install suanlinfang-mcp
export SUANLINFANG_API_KEY="nk-YOUR_API_KEY"
suanlinfang-mcp        # stdio entry for Claude Desktop / Cursor / etc.

or run without installing: uvx suanlinfang-mcp

Environment variables:

Variable

Purpose

Default

SUANLINFANG_API_KEY

your API key (nk- prefix) for stdio/local use

required for stdio

SUANLINFANG_BASE_URL

API base override

https://suanlinfang.cn/v1

SUANLINFANG_MCP_PORT

listen port for the HTTP entry

8090

The Python SDK lives in packages/suanlinfang-sdk/ — a dependency-free REST client (pip install suanlinfang-sdk) you can use without MCP.

Get an API key

  1. Register at suanlinfang.cn (new accounts get trial credit)

  2. Console → API Key Management → create key (nk- prefix)

  3. Put the key in the X-SLF-Api-Key header (remote) or SUANLINFANG_API_KEY env (stdio)

Reference pricing: image generation billed per image (model-tiered, see list_image_models for live prices), transcription ≈ ¥0.5/hour of audio, TTS ≈ ¥2/10k chars, OCR ≈ ¥0.005–0.015/page. Failed calls are never billed.

Docker

Docker image distribution is planned (mcp/suanlinfang via the Docker MCP Catalog) — see TODO.

Development

cd mcp-server
uv sync                                  # workspace: sdk + mcp packages + dev deps
uv run pytest                            # all tests
uv run fastmcp dev packages/suanlinfang-mcp/suanlinfang_mcp/server.py   # MCP Inspector
uv run python -m suanlinfang_mcp.entry_http   # local HTTP entry (127.0.0.1:8090/mcp)

Repo layout:

  • packages/suanlinfang-sdk/ — REST client SDK (no MCP concepts; reusable by CLIs and other hosts)

  • packages/suanlinfang-mcp/ — MCP protocol shell exposing the 12 tools

  • server.json — official MCP Registry metadata (cn.suanlinfang/stt-tts-ocr-decision)

License

Apache-2.0. The MCP server is open source; the AI inference, billing and scheduling core runs server-side at suanlinfang.cn and is not part of this repo.

Available Tools

12 tools
generate_imageGenerate ImageA

AI 生图(1024×1024 PNG,按张计费,失败不计费):传 prompt 即文生图;再传 init_image_url(参考图公网 URL,png/jpg/jpeg ≤10MB)即图生图(换装/换景/改背景等编辑指令写在 prompt 里)。 本工具一次调用内完成「提交→等待→出结果」,默认最多等 120 秒(wait_seconds 可调 10~300); 出图成功返回 resultUrl(现签下载链接,1 小时内有效,请提醒用户及时下载转存)。 model 留空自动选:文生图=flux2-klein(快而省),图生图=qwen-image-edit-2511;要更高质量可传 z-image-turbo,在线模型与实时牌价先用 list_image_models 查询。 seed(非负整数)可复现同图:同 prompt + 同 seed 生成一致结果。 若等待超时仍未完成,返回 taskNo(任务不丢失、不计排队费),调用 get_image_task 继续查询。

Inputs: prompt (required), seed, model, wait_seconds, +1 more. Returns: object

get_document_taskGet Document TaskB
Read-only

查询 PDF 文档识别任务状态。status:queued/running(看 doneUnits/totalUnits 进度)、 success(resultUrl 为聚合结果下载链接)、failed(errorMsg)。任务终态保留 72 小时。

Inputs: task_no (required). Returns: object

get_image_taskGet Image TaskA
Read-only

查询生图任务状态。status:queued/running(进行中,快档常在数十秒内出图,慢档可能数分钟——视模型档位与当前空闲算力)、 success(resultUrl 为图片现签下载链接,1 小时内有效;链接过期后重新查询即换新链)、 failed(errorMsg 为失败原因,不扣费)、expired(结果已过保留期)。 建议每 5~10 秒查询一次。generate_image 等待超时降级后用本工具续查。

Inputs: task_no (required). Returns: object

get_speech_taskGet Speech TaskA
Read-only

查询长文本语音合成任务状态。status:queued/running(看 doneUnits/totalUnits)、 success(resultUrl 为完整音频下载链接,1 小时内有效,过期重查即换新链)、failed(errorMsg)。 任务终态保留 72 小时。

Inputs: task_no (required). Returns: object

get_transcription_taskGet Transcription TaskA
Read-only

查询长音频转写任务状态。status:queued/running(进行中,看 doneUnits/totalUnits 进度)、 success(text 为全文转写)、failed(errorMsg 为失败原因)。任务终态保留 72 小时。

Inputs: task_no (required). Returns: object

list_image_modelsList Image ModelsA
Read-only

查询生图当前在线模型与实时牌价(id + pricing,按张计费)。选 model 前先看这个。

Inputs: no named parameters. Returns: result

list_tts_voicesList Tts VoicesA
Read-only

查询语音合成当前可用音色清单(code/name/gender/styleTag)。合成前先看这个选 speaker。

Inputs: no named parameters. Returns: result

submit_document_taskSubmit Document TaskA

提交 PDF 文档识别任务(≤200MB、≤500 页,逐页识别整本)。适合扫描合同/书籍/报告。 提交后用 get_document_task 轮询结果。prompt 仅精准档生效。计费按页。

Inputs: tier (required), document_url (required), prompt, file_name. Returns: object

submit_speech_taskSubmit Speech TaskA

提交长文本语音合成任务(≤20 万字):平台按 500 字切块合成并拼接为完整音频。 提交后用 get_speech_task 轮询结果。计费约 2 元/万字符。

Inputs: text (required), speaker, audio_format. Returns: object

submit_transcription_taskSubmit Transcription TaskA

提交长音频转写任务(会议录音/播客/网课,最长 2 小时、≤500MB,wav/mp3/flac/m4a/ogg/aac)。 平台自动按 180 秒切段逐段转写并拼接全文(纯文本,不含时间戳)。提交后用 get_transcription_task 轮询结果。 language 留空自动检测,指定时用语种代码(如 zh、en);hotwords 可传热词(人名、术语、品牌,逗号分隔),对全部音频段生效。 计费按实际时长(约 0.5 元/小时),余额不足会在提交时被拒绝。

Inputs: audio_url (required), hotwords, language, file_name. Returns: object

synthesize_speechSynthesize SpeechA

把文本合成为语音(≤1000 字符),同步返回现签下载链接(url,GET 即得音频,1 小时内有效)。 请提醒用户及时下载转存——链接过期后只能重新合成(重复计费)。 更长的文本请改用 submit_speech_task(异步任务)。speaker 音色代码先用 list_tts_voices 查询。 计费约 2 元/万字符,失败不计费。

Inputs: text (required), speaker, audio_format. Returns: object

transcribe_audioTranscribe AudioA

把一段短音频(公网 URL)转成文字。适用于 ≤3 分钟、≤20MB 的录音/语音消息,同步秒级返回。 更长的音频请改用 submit_transcription_task(异步任务)。 language 留空自动检测(支持普通话、英语及 22 种中文方言);指定时用语种代码(如 zh、en)。 hotwords 可传热词(人名、术语、品牌,逗号分隔),专有名词按所列写法优先转写——会议转写建议填与会人名。 返回全文纯文本(不含时间戳/分句时间轴)。计费按音频实际时长(约 0.5 元/小时,精确到秒),失败不计费。

Inputs: audio_url (required), hotwords, language. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 12 tools

    Disambiguation4/5

    Each tool maps to a distinct resource+action, and the four domains (image, transcription, TTS, document OCR) are cleanly separated. The main overlap risk is the sync/async pairs (transcribe_audio vs submit_transcription_task, synthesize_speech vs submit_speech_task), but the descriptions sharply bound them by size limits (≤3 min/20MB vs ≤2 h/500MB; ≤1000 chars vs ≤200k), so an agent can choose correctly. generate_image's built-in wait plus get_image_task as a timeout fallback is documented but is the one place where a newcomer might double-poll.

    Naming Consistency4/5

    All names are snake_case verb_noun with a coherent scheme: sync operations use a bare verb (generate_image, transcribe_audio, synthesize_speech), async ones use submit_*_task plus a matching get_*_task, and lookups use list_*. Minor deviations: generate_image has no submit_image_task counterpart yet still has get_image_task, and the two list tools name the resource differently (list_image_models vs list_tts_voices).

    Tool Count5/5

    Twelve tools for four sub-services is well-proportioned: roughly three per domain (submit/sync, poll, and a catalog lookup). No tool is redundant, and the async-poll trio repeats only because the underlying platform genuinely requires it.

    Completeness4/5

    Each domain has a workable lifecycle: submit/sync, poll for status, and model-or-voice discovery for image and TTS. Gaps are real but survivable — document OCR has no equivalent catalog lookup or sync path despite the prompt mentioning quality tiers, and there is no task-cancel tool. Most notably, billing is emphasized everywhere ('余额不足会在提交时被拒绝', per-page/per-character pricing) yet no balance or quota query tool exists, forcing agents to discover insufficient funds by failure.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Provides remote SSE-based computational infrastructure with 40+ deterministic tools, including free utilities like JSON repair and context trimming, plus pay-per-call web3 and network oracles for autonomous AI agents.
      64
      Apache 2.0
    • A
      license
      A
      quality
      A
      maintenance
      One remote MCP server with about 260 tools (also split into 11 focused servers, below) for AI agents: https://tanod.dev/mcp. Connection: streamable HTTP and stateless, with no API key, no account and no OAuth. Setup for 20 clients: https://tanod.dev/connect/?src=gh_mcp Docs for agents: https://tanod.dev/llms.txt OpenAPI: https://tanod.dev/openapi.json
      270
      393 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to extract template-shaped JSON from text, images, and PDFs with calibrated per-field confidence, make typed decisions with probabilities, identify languages among 608, restore diacritics, and generate passage-grounded questions.
      6
      Apache 2.0