Code Refactor MCP Server
by zhouhengchangio.github.zhouhengchang/code-refactorv1.0.4
Refactor legacy code into modern, idiomatic code without changing its behavior.
context tax
~297 tok/turn2 tools
security
97/100
cold start
pending
freshness
Active1d ago
Our reading of Code Refactor, from the data
Code Refactor is an MCP server from zhouhengchang, listed in the official MCP Registry.
Its 2 tools add about 297 tokens to every model turn (measured 2026-10-19).
Maintenance is active: the last public signal was in the last day (2026-10-18).
It runs either locally over stdio or as a hosted endpoint and needs one secret (OPENAI_API_KEY); use a scoped, least-privilege key.
Install Code Refactor MCP server
Install in Claude Code
claude mcp add zhouhengchang -e OPENAI_API_KEY='<openai-api-key>' -- npx -y workbuddy-code-refactor-connectorInstall in Cursor
{
"mcpServers": {
"zhouhengchang": {
"command": "npx",
"args": [
"-y",
"workbuddy-code-refactor-connector"
],
"env": {
"OPENAI_API_KEY": "<openai-api-key>"
}
}
}
}Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project).
Install in Claude Desktop
{
"mcpServers": {
"zhouhengchang": {
"command": "npx",
"args": [
"-y",
"workbuddy-code-refactor-connector"
],
"env": {
"OPENAI_API_KEY": "<openai-api-key>"
}
}
}
}Settings → Developer → Edit Config (claude_desktop_config.json), then restart.
Install in VS Code
{
"servers": {
"zhouhengchang": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"workbuddy-code-refactor-connector"
],
"env": {
"OPENAI_API_KEY": "<openai-api-key>"
}
}
}
}Add to .vscode/mcp.json in your workspace.
Install in Windsurf
{
"mcpServers": {
"zhouhengchang": {
"command": "npx",
"args": [
"-y",
"workbuddy-code-refactor-connector"
],
"env": {
"OPENAI_API_KEY": "<openai-api-key>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json.
Configuration
| Variable | Required | Secret | Description |
|---|---|---|---|
| REFACTOR_BACKEND | — | — | Inference backend: 'ollama' (local, code stays on your machine, default) or 'openai' (any OpenAI-compatible cloud endpoint, e.g. DeepSeek). |
| OPENAI_BASE_URL | — | — | Base URL of the OpenAI-compatible endpoint, e.g. https://api.deepseek.com/v1. Required when REFACTOR_BACKEND=openai. |
| OPENAI_API_KEY | — | yes | API key for the cloud endpoint, e.g. a DeepSeek key. Only needed when REFACTOR_BACKEND=openai. |
| OPENAI_MODEL | — | — | Cloud model name, e.g. deepseek-chat. |
| OLLAMA_HOST | — | — | Ollama server address used when REFACTOR_BACKEND=ollama. |
| OLLAMA_MODEL | — | — | Ollama model name used when REFACTOR_BACKEND=ollama. |
| REFACTOR_TIMEOUT_MS | — | — | Per-call timeout in milliseconds. Raise it for slow local CPU inference. |
Remote endpoints
- streamable-http
https://code-refactor-api.app.workbuddy.host/mcp
Context tax
Connecting this server adds ~297 tokens of tool definitions to every model turn (lean, 2 tools). Measured 2026-10-19 via its hosted endpoint; o200k tokenizer, worst case for clients that load all tools up front. How we measure
| Model | Per 1,000 turns | With prompt caching |
|---|---|---|
| Claude Opus 5.5 | $1.19 | $0.059 |
| Claude Sonnet 5.5 | $0.594 | $0.059 |
| Claude Haiku 5.5 | $0.030 | — |
Input prices as of 2026-10-06. Excludes your own prompt and output.
Tools (2)
refactor_code184 tok把遗留代码重构为现代规范代码,行为保持不变。会做语义化重命名、补全类型标注、生成中文注释、优化结构。适用于 Python / JavaScript / TypeScript / Java / Go / Rust / C / C++。
check_status63 tok检查重构服务与云端模型(DeepSeek)是否可用,返回后端类型、模型名与密钥校验状态。建议在调用 refactor_code 前先调用本工具。
Security signals
97/100 — no known issues found as of 2026-10-19, from the checks below. This is not a guarantee of safety; review what a server can do before connecting it.
Deductions
- No security policy (SECURITY.md)-3
Checks
- ✓Repository hygiene (archived, activity, license, security policy)
- ○Package metadata (install scripts, provenance) — pending
- ○Tool descriptions (prompt-injection and hidden-text heuristics) — pending
- ○Source scan (secrets, CVEs, risky code) by vectra-guard — pending
Scan it yourself before installing with vectra-guard, the open-source agent security CLI. Scoring rules
Freshness
Active — last maintenance signal 1d ago. The newest of the signals below sets the band.
Last commit (default branch)
2026-10-18 · 1d ago · GitHub
Latest release
no data · GitHub
Package published
no data · npm/PyPI
Registry entry updated
2026-10-18 · 1d ago · official registry · v1.0.4
FAQ
›How do I install the Code Refactor MCP server in Claude Code?
Run: claude mcp add zhouhengchang -e OPENAI_API_KEY='<openai-api-key>' -- npx -y workbuddy-code-refactor-connector. For Cursor, VS Code, Claude Desktop and Windsurf, use the install tabs above.
›Does Code Refactor require an API key?
Yes. It expects OPENAI_API_KEY, of which 1 is a secret.
›Can I use Code Refactor as a remote (hosted) MCP server?
Yes — it offers both a hosted endpoint and a local stdio package.
›Is Code Refactor in the official MCP registry?
Yes, as io.github.zhouhengchang/code-refactor.
›How many tokens does Code Refactor add to my context?
Its tool definitions total about 297 tokens, resent on every turn.
Sources and method
- Official MCP Registry entry
- updated 2026-10-18
- GitHub repository
- fetched 2026-10-19
- Package registry (npm / PyPI)
- listed
- Tool list (tools/list), measured by us
- 2026-10-19
- Security signals, computed by us
- 2026-10-19
- Last checked against all sources
- 2026-10-19
The description, packages and links come from the maintainer's own published metadata. Token cost, security signals, freshness and the reading above are MCPSkillHub's own measurements; see the methodology. Spot an error? Request a correction or claim the listing.