home / mcp / mcp jieba server

MCP Jieba Server

Provides fast Chinese word segmentation, POS tagging, and keyword extraction via an MCP server built on rjieba.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kagajiankui-mcp-jieba": {
      "command": "python",
      "args": [
        "-m",
        "mcp_jieba.server"
      ]
    }
  }
}

You run a fast, Rust-backed MCP server that provides Chinese word segmentation, part-of-speech tagging, and keyword extraction. It supports exact and search modes, can process single strings or arrays, and is designed for both local development and remote deployment. This guide shows you how to install, run, and use the Jieba MCP server effectively.

How to use

You interact with the Jieba MCP server through a client that speaks the MCP protocol. Use it to tokenize Chinese text, assign part-of-speech tags, and extract keywords from one or more strings. For local development, you typically connect via STDIO; for remote deployments or cloud integration, you connect via Streamable-HTTP.

Key capabilities you can leverage: tokenize text with either exact segmentation or search-oriented segmentation; obtain ICTCLAS-compatible part-of-speech tags; extract keywords using a BM25-based method; and process multiple inputs in a single call. Use multi-input support to batch-process strings efficiently.

Practical usage patterns you’ll implement in your client: send a single string or an array of strings to tokenize and pick the desired mode, request POS tagging for each token, and request keyword extraction with a top_k limit to control verbosity. The server returns per-input results indexed by the input array position.

How to install

# Prerequisites
# Ensure you have Python installed (3.x recommended)

# Install the MCP Jieba package locally
pip install .

# Or install with uv if you prefer the uv runtime helper
uv pip install .
````},{

Run the server locally (STDIO) to test and develop with MCP clients such as Claude Context, Cherry Studio, or VS Code MCP integration. Start the STDIO server with the following command.

python -m mcp_jieba.server
````},{

If you need remote access via HTTP (Streamable-HTTP), start the web-enabled MCP server with these options.

python -m mcp_jieba.server --transport http --host 0.0.0.0 --port 8000
````},{

After starting, you can access the Server-Sent Events endpoint at SSE: http://localhost:8000/sse. This is suitable for remote deployments and integrating with ModelScope or other hosting environments.

Configuration and deployment notes

This MCP server ships with a straightforward local STDIO mode for development and a Streamable-HTTP mode for remote deployments. Choose STDIO for local IDE integrations and quick tests, or HTTP for remote hosting with your MCP client that supports HTTP transport.

If you plan to deploy to a service like ModelScope, run the same HTTP start command in the service environment so the server binds to the public interface and port you specify. The default port in examples is 8000, but you can customize it with --port.

Examples and quick references

Usage with a local client often involves a simple configuration that points to the STDIO or HTTP endpoint. For a local test, you’ll connect a client to the STDIO session opened by python -m mcp_jieba.server. For remote testing, configure the client to call http://0.0.0.0:8000 and subscribe to the /sse stream for updates.

If you want to batch multiple inputs, send an array of strings to the tokenize, tag, or extract_keywords tools. The server responds with a mapping from input index to the corresponding results.

Security and maintenance notes

Run the HTTP transport behind appropriate network access controls if exposing the server publicly. Use standard security practices to manage access, monitor usage, and rotate any API keys or credentials used by MCP clients.

Troubleshooting tips

If the server fails to start, verify that the Python environment is available and that port 8000 (or your chosen port) is not in use. Check console output for binding errors and ensure the required Python packages are installed.

Available tools

tokenize

Performs tokenization on input text. Supports modes exact and search. Accepts a single string or an array of strings and returns the tokenized results indexed by input position.

tag

Performs word segmentation with part-of-speech tagging conforming to ICTCLAS standards. Accepts a single string or an array of strings and returns word/flag pairs for each input.

extract_keywords

Extracts keywords using a BM25-based algorithm. Accepts text input and top_k specifying how many keywords to return per input string.