24K Labs MCP Server
AI code analysis tools that plug into Claude Code, Cursor, VS Code, and any MCP client.
6 professional code analysis tools powered by Claude (Haiku / Sonnet / Opus).
Pay per request via x402 or Stripe (coming soon). Free dev mode included.
______________________________________________________________________
这是什么?
24K Labs MCP服务器允许任何AI助手访问 六种专门的代码分析工具 通过 模型上下文协议.每个工具都调用24K Labs API,它将您的请求路由到工作的正确Claude模型——Haiku代表速度,Sonnet代表深度,Opus代表硬东西。
它适用于MCP工作的任何地方:
- 克劳德代码 (CLI)
- 光标
- VS Code (通过Copilot Chat MCP支持)
- 任何兼容MCP的客户端
一 pip install一个配置块。六个工具准备就绪。
______________________________________________________________________
特性
explain_code--对任何代码的功能进行清晰、结构化的分解。由克劳德·海库提供技术支持。debug_assist--粘贴有错误的代码和错误消息。找出根本原因、严重程度和修复方法。由克劳德·索内特提供技术支持。code_review--全面的代码审查,涵盖安全性、性能和架构,并给出质量分数。由克劳德·索内特提供技术支持。security_audit--基于OWASP的漏洞评估,包括CVSS评分和补救步骤。由Claude Opus提供技术支持。automation_script--用简单的英语描述你需要什么,得到一个完整的工作脚本。由克劳德·索内特提供技术支持。mcp_blueprint--使用工具、模式和部署指南设计一个完整的MCP服务器架构。由Claude Opus提供技术支持。
每个工具支持三个分析层(quick, standard, pro)所以你可以控制深度和成本。
______________________________________________________________________
快速开始
安装
pip install 24klabs-mcp或者从源代码安装:
git clone https://github.com/Haustorium12/24klabs-mcp.git
cd 24klabs-mcp
pip install -e .在Claude代码中配置
添加到您的项目 .mcp.json (或 ~/.claude/.mcp.json 全球):
{
"mcpServers": {
"24klabs": {
"command": "python",
"args": ["-m", "server"],
"cwd": "/path/to/24klabs-mcp",
"env": {
"TWENTYFOURK_API_KEY": "your-api-key"
}
}
}
}在游标中配置
添加 ~/.cursor/mcp.json:
{
"mcpServers": {
"24klabs": {
"command": "python",
"args": ["/path/to/24klabs-mcp/server.py"],
"env": {
"TWENTYFOURK_API_KEY": "your-api-key"
}
}
}
}在VS代码中配置
添加到您的VS代码 settings.json:
{
"mcpServers": {
"24klabs": {
"command": "python",
"args": ["/path/to/24klabs-mcp/server.py"],
"env": {
"TWENTYFOURK_API_KEY": "your-api-key"
}
}
}
}就是这样。你的人工智能助手现在有六个新工具。
______________________________________________________________________
工具参考
explain_code
对代码的功能进行清晰、结构化的解释。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·海库 |
| 价格 | 0.01美元/快速--0.02美元/标准--0.05美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | 要解释的代码 |
language | string | 否 | 编程语言(如果省略,则自动检测) |
context | string | 否 | 关于代码的其他上下文 |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Use explain_code to explain this Python function:
def memoize(func):
cache = {}
def wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrapper示例输出(缩写):
This is a memoization decorator that caches function results.
Purpose: Avoids redundant computation by storing previously computed
results in a dictionary keyed by the function arguments.
How it works:
1. Creates a closure with a `cache` dict
2. On each call, checks if args are already cached
3. If not cached, calls the original function and stores the result
4. Returns the cached result
Edge cases to watch:
- Only works with hashable arguments (no lists/dicts as args)
- Cache grows unbounded -- no eviction policy
- Not thread-safe______________________________________________________________________
debug_assist
查找错误,解释错误,并提出修复建议。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·索内特 |
| 价格 | 0.02美元/快速--0.05美元/标准--0.10美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | 有缺陷的代码或引发错误的代码 |
error_message | string | 否 | 错误消息或回溯 |
language | string | 否 | 编程语言(如果省略,则自动检测) |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Use debug_assist to find the bug in this code. The error is "TypeError: unhashable type: 'list'"
def count_items(items):
seen = {}
for item in items:
seen[item] = seen.get(item, 0) + 1
return seen
count_items([[1, 2], [3, 4], [1, 2]])______________________________________________________________________
code_review
全面的代码审查,涵盖安全性、性能和架构。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·索内特 |
| 价格 | 0.02美元/快速--0.05美元/标准--0.10美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | 要查看的代码 |
focus | string | 否 | 需要关注的具体领域(例如。 security, performance, architecture) |
language | string | 否 | 编程语言(如果省略,则自动检测) |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Use code_review on my Express.js auth middleware, focus on security______________________________________________________________________
security_audit
基于OWASP的安全漏洞评估。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·奥普斯 |
| 价格 | 0.05美元/快速--0.10美元/标准--0.25美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | 用于审计安全漏洞的代码 |
context | string | 否 | 其他上下文(例如。 web app, API endpoint, auth system) |
language | string | 否 | 编程语言(如果省略,则自动检测) |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Run security_audit on my login endpoint, context is "Express.js API with JWT auth"示例输出(缩写):
SECURITY AUDIT REPORT
=====================
Severity: HIGH
Vulnerabilities Found:
1. [CRITICAL] SQL Injection in user lookup (OWASP A03:2021)
CVSS: 9.8 -- Line 14: raw string interpolation in query
Fix: Use parameterized queries
2. [HIGH] Missing rate limiting (OWASP A07:2021)
CVSS: 7.5 -- No throttle on login attempts
Fix: Add express-rate-limit middleware
3. [MEDIUM] JWT secret from env without validation
CVSS: 5.3 -- Falls back to empty string if env var missing
Fix: Fail hard if JWT_SECRET is not set______________________________________________________________________
automation_script
根据自然语言要求生成一个完整的、可工作的自动化脚本。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·索内特 |
| 价格 | 0.02美元/快速--0.05美元/标准--0.10美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
requirements | string | 是 | 脚本应该做什么(自然语言) |
language | string | 否 | 目标语言(默认: python) |
context | string | 否 | 其他约束或上下文 |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Use automation_script: "Watch a directory for new CSV files, validate headers match a schema, and upload valid ones to S3"______________________________________________________________________
mcp_blueprint
设计一个完整的MCP服务器架构和实现指南。
| 细节 | 价值 |
|---|---|
| 模型 | 克劳德·奥普斯 |
| 价格 | 0.05美元/快速--0.10美元/标准--0.25美元/专业 |
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
requirements | string | 是 | MCP服务器应该做什么(自然语言) |
language | string | 否 | 实现语言(默认: python) |
context | string | 否 | 其他上下文(例如。 for Claude Code, for Cursor) |
tier | string | 没有 | quick, standard (默认),或 pro |
Claude Code中的示例用法:
> Use mcp_blueprint: "MCP server that wraps the Stripe API -- tools for creating customers, charges, subscriptions, and listing invoices"______________________________________________________________________
层次解释
每个工具都接受 tier 控制分析深度的参数:
| 级别 | 深度 | 速度 | 最适合 |
|---|---|---|---|
quick | 表面级扫描 | ~2-5s | 快速健全性检查,简单问题 |
standard | 彻底分析 | ~5-15s | 日常代码审查和调试(默认) |
pro | 详尽的深入探讨 | ~15-45s | 生产发布、安全签核、架构决策 |
这 pro 该层使用更多的令牌,并产生更长、更详细的输出。当赌注很高时使用它。
______________________________________________________________________
支付
x402的工作原理
24K Labs使用 x402协议 用于机器对机器支付。当请求需要付款时,API返回 402 Payment Required 以L2为基础,以美元为单位的价格进行响应。
开发模式(免费)
默认情况下,服务器在 开发者模式 --请求无需付款即可通过,因此您可以测试所有内容。这 X-Payment: dev-mode 标头会自动发送。
若要切换到生产,请设置API密钥:
export TWENTYFOURK_API_KEY="your-api-key"定价表
| 工具 | 快速 | 标准 | 专业 |
|---|---|---|---|
explain_code | $0.01 | $0.02 | $0.05 |
debug_assist | $0.02 | $0.05 | $0.10 |
code_review | $0.02 | $0.05 | $0.10 |
security_audit | $0.05 | $0.10 | $0.25 |
automation_script | $0.02 | $0.05 | $0.10 |
mcp_blueprint | $0.05 | $0.10 | $0.25 |
所有价格均以美元计。条纹计费即将到来。
______________________________________________________________________
配置选项
| 环境变量 | 默认值 | 描述 |
|---|---|---|
TWENTYFOURK_API_KEY | (none) | 您的24K Labs API密钥用于验证/付费请求 |
TWENTYFOURK_API_URL | https://api.24klabs.ai | API基本URL(重写自托管或分段) |
______________________________________________________________________
用例
PR审核自动化
跑 code_review 在每个pull请求上,在安全问题、性能回归和架构问题到达main之前捕获它们。
部署前的安全审计
跑 security_audit 在 pro 在每次生产部署之前,对身份验证端点、支付处理程序和数据访问层进行分层。
加入新的代码库
使用 explain_code 快速理解不熟悉的模块。粘贴一个文件,获得它的功能和原因的结构化分解。
缺陷分拣
将堆栈跟踪和失败代码粘贴到 debug_assist。获取根本原因、严重性和修复方法,而无需切换到浏览器。
脚本生成
需要一次性迁移脚本、数据管道或CI/CD助手吗?用英语描述 automation_script 并取回一份工作脚本。
MCP服务器原型
设计新的MCP集成?使用 mcp_blueprint 获取包含工具定义、模式、实现代码和部署指南的完整架构。
______________________________________________________________________
API 参考
24K Labs REST API的完整文档记录在:
所有六个端点都接受相同的基本有效载荷:
{
"code": "string",
"tier": "quick | standard | pro",
"context": "string (optional)",
"language": "string (optional)"
}______________________________________________________________________
常见问题解答
我需要API密钥来尝试它吗? 否。默认情况下,服务器在开发模式下运行,该模式发送请求而不付款。集 TWENTYFOURK_API_KEY 当你准备好投入生产使用时。
使用了哪些模型? explain_code 使用克劳德·海库来提高速度。 debug_assist, code_review,以及 automation_script 使用克劳德·十四行诗的深度。 security_audit 和 mcp_blueprint 使用Claude Opus进行最高质量的分析。
我的代码是否发送给第三方? 您的代码被发送到24K实验室API(api.24klabs.ai),将其发送到Anthropic的Claude API。没有代码被存储、记录或用于培训。请参阅 隐私政策 了解详情。
支持哪些语言? 他们所有人。这些工具会自动从您提供的代码中检测编程语言。你也可以通过 language 为了获得更好的结果。
请求超时是多少? 120秒。如果你的代码片段非常大,可以考虑将其分解为更小的部分或使用 quick 层。
______________________________________________________________________
贡献
欢迎捐款。方法如下:
- 分叉存储库
- 创建要素分支(
git checkout -b feature/your-feature) - 进行更改
- 如果适用,添加测试
- 提交拉取请求
对于较大的更改,请先打开一个问题,以便我们讨论方法。
______________________________________________________________________
许可证
麻省理工学院——见 许可证 了解详情。
______________________________________________________________________
链接
- 网站: https://24klabs.ai
- API文件: https://api.24klabs.ai/docs
- GitHub:
- PyPI: https://pypi.org/project/24klabs-mcp/
- npm:
______________________________________________________________________
Built by 24K Labs
