Skip to main content

mcp-chinese-counter

MCP 服务:统计一段话里的中文字数。只数汉字,标点、空格、英文字母、数字都不计入。

工具

count_chinese_chars(text: str) -> int

参数 text 是要统计的原文,返回汉字个数。

示例:输入「今天天气真好,我们去散步!」→ 返回 11(逗号和感叹号不计)。

依赖

Python 3.11+,以及 mcp>=2.0。

本地运行

uvx mcp-chinese-counter

装到当前环境后也可以直接:

pip install mcp-chinese-counter
mcp-chinese-counter

想跑成远程服务(监听 8000 端口,按 URL 接入):

mcp-chinese-counter --http

客户端配置

{
  "mcpServers": {
    "chinese-counter": {
      "command": "uvx",
      "args": ["mcp-chinese-counter"]
    }
  }
}

托管部署配置

魔搭 MCP 广场创建服务时,托管类型选「可托管部署」,来源填 PyPI 包名 mcp-chinese-counter,config 填:

{
  "mcpServers": {
    "chinese-counter": {
      "command": "uvx",
      "args": ["mcp-chinese-counter"]
    }
  }
}

环境变量无需配置。

Metadata

Release files for mcp-chinese-counter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-chinese-counter 0.1.0
File Size Uploaded
mcp_chinese_counter-0.1.0.tar.gz 1.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-chinese-counter 0.1.0
File Interpreter ABI Platform
mcp_chinese_counter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.3 kB

Release files / mcp_chinese_counter-0.1.0.tar.gz

Download URL mcp_chinese_counter-0.1.0.tar.gz
Size 1.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1bde0e0729b00df89a112deb87fa7c2069792a2455fdfd9db22bd0c78806f1fd
BLAKE2b-256 checksum
How to use checksums
e438f9b2630571e7f378161359b7d48318d78f03a62658ff409b8007c1e606e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / mcp_chinese_counter-0.1.0-py3-none-any.whl

Download URL mcp_chinese_counter-0.1.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82f48d31d3dcddb01d318f2a6f500422fcd19acc8a7e6e4a139e47c338ff3f6f
BLAKE2b-256 checksum
How to use checksums
9ff83fe3c511d4aed1376c9915a5ff87adf9d4c9dd551c1a230d85959c71c185
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page