feat: add built-in MCP server (kuronuri serve --mcp)#1
Open
sgtao wants to merge 8 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrates a Model Context Protocol (MCP) server
directly into kuronuri, so users can expose PII masking as AI tools without a separate
package.
Changes
New:
kuronuri serve --mcpStarts an MCP server over stdio transport, registering two tools for MCP clients such as
Claude Code and Claude Desktop:
mask_textlist_ner_tagsClaude Code registration example:
{ "mcpServers": { "kuronuri": { "command": "kuronuri", "args": ["serve", "--mcp"] } } }Dependency
mcp[cli]>=1.0.0is added as a regular dependency, sopip install kuronurigivesyou the MCP functionality without any extra steps.
Backward compatibility
The existing
kuronuri <INPUT>interface is fully preserved via a default-commandrouting group (
_DefaultMaskGroup). No changes are required for existing users.Checklist
mise run fixpasses (ruff + ty)mise run test-allpasses on Python 3.10–3.14 with 100% coveragepyproject.toml: version bumped0.2.0→0.3.0Modified files
src/kuronuri/_mcp.py— new MCP server module (FastMCP-based)src/kuronuri/_cli.py— addedservesubcommand and_DefaultMaskGroupfor backward-compatible routingpyproject.toml— addedmcp[cli]dependency, bumped version to 0.3.0tests/test_mcp.py— new tests for MCP toolstests/test_cli.py— addedTestServeCommand; existing tests updated for new routingREADME.md/CHANGELOG.md— updated docs(On May 18th, Appended Follows)
Testing MCP in Development
To verify the MCP server works before installing from PyPI, register it directly from
your local branch using Claude Code:
setup and check connect
Usage
Then launch Claude Code and send a masking request:
Example prompt (Japanese):
Expected behavior:
mask_textMCP tool automatically