推断器管理MCP服务器
  ](https://github.com/DBSS/inferencer-admin-mcp)
MCP(模型上下文协议)服务器 推理机 -macOS上本地AI模型的深度控制。
关于本项目
👋 嘿!我是Dmitri K DigitalKredit.
我创建了这个MCP服务器,以实现Claude和Inferencer之间的深度集成,Inferencer是一款功能强大的macOS本地AI推理应用程序。
我建造的东西:
- 🔧 完成MCP集成 Inferencer的独特功能(令牌检查、预填充、MoE分析)
- 🏗️ 干净的模块化架构 拥有23+个专业模块
- 📈 107个功能齐全的工具 涵盖本地人工智能管理的各个方面
- ✅ 综合测试 (100+测试通过)
- 🚀 主要特点:混合AI编排、模型校准、PII检测、即时A/B测试、HuggingFace集成、上下文管理、模型管道、质量保证、护栏和微调工具
该项目正在积极维护,并针对Inferencer的最新版本进行测试。
将Claude转变为Inferencer的智能系统管理员,实现人工智能辅助模型管理、聊天完成、令牌检查、性能基准测试等。
🎯 这是什么?
此MCP服务器将Claude Desktop连接到您的本地Inferencer安装,允许您:
- 与当地模特聊天 直接通过克劳德
- 检查令牌概率 并查看模型置信水平
- 控制发电参数 (温度、top_p、top_k等)
- 分析教育部专家激活情况 适用于DeepSeek-V3、Qwen、Kimi等型号
- 基准绩效 并比较模型
- 智能模型路由 根据你的任务
- 混合AI编排 -在本地模型和Claude之间路由任务
- 模型校准 -测试和配置文件模型功能
- PII检测和隐私保护 -保护敏感数据
- 快速A/B测试 -优化您的提示
- 模型更新监视器 -跟踪拥抱脸部更新
- 上下文管理 -压缩、内存、对话分叉(v5.0中的新功能)
- 管道模型 -多步骤工作流、链接、辩论模式(v5.0中的新功能)
- 质量保证 -幻觉检测、事实核查、评分(v5.0中的新功能)
- 性能优化 -延迟预测、批处理、令牌预算(v5.0中的新功能)
- 护栏 -内容过滤、越狱检测、验证(v5.0中的新功能)
- 微调工具 -数据集准备、LoRA管理、模型合并(v5.0中的新功能)
✨ 功能(107工具)
🔍 安装与健康(4个工具)
| 工具 | 说明 |
|---|
detect_inferencer_installation | 查找Inferencer安装和数据路径 |
get_server_status | 检查Inferencer服务器是否正在运行 |
analyse_inferencer_health | 综合健康分析及建议 |
get_mcp_server_info | 服务器信息和可用工具 |
📦 模型管理(5个工具)
| 工具 | 说明 |
|---|
list_available_models | 列出所有带有标签和功能的型号 |
get_model_details | 详细型号信息 |
list_model_tags | 用于智能过滤的可用标签类别 |
find_model_by_tag | 按能力(编码、视觉、推理等)搜索模型 |
recommend_model | 基于任务的人工智能模型推荐 |
💬 聊天与推理(3个工具)
| 工具 | 说明 |
|---|
chat_with_model | 向本地模特发送聊天信息 |
generate_completion | 文本完成生成 |
create_embeddings | 创建文本嵌入 |
⚡ 基准测试(2个工具)
| 工具 | 说明 |
|---|
benchmark_model | 使用令牌/秒进行性能基准测试 |
compare_models | 比较多个模型的响应 |
🧠 智能功能(2个工具)
| 工具 | 说明 |
|---|
smart_model_router | 基于任务描述的自动模型选择 |
get_system_resources | CPU、内存和磁盘使用情况 |
🗄️ 缓存和文件(4个工具)
| 工具 | 说明 |
|---|
get_cache_stats | 缓存命中/未命中统计数据 |
clear_cache | 强制获取新数据 |
scan_data_locations | 查找Inferencer数据文件 |
list_local_model_files | 列出磁盘上的MLX和GGUF模型文件 |
🔬 高级推理功能(6个工具)
| 工具 | 说明 |
|---|
inspect_tokens | 🔍 查看令牌概率、熵和替代选择 |
chat_with_prefill | 📝 通过预填充助手的响应控制输出 |
get_generation_config | ⚙️ 查看可用的发电参数 |
generate_with_config | 🎛️ 完全控制:温度、top_p、top_k、重复惩罚 |
get_model_memory_usage | 💾 估计您的模型的RAM使用情况 |
get_expert_stats | 🧠 教育部DeepSeek、Qwen、Kimi等专家分析。 |
📚 对话历史(4个工具)
| 工具 | 说明 |
|---|
save_conversation | 💾 使用元数据和标签保存聊天会话 |
load_conversation | 📂 按ID加载以前的对话 |
list_conversations | 📋 使用筛选器列出所有已保存的对话 |
search_conversations | 🔎 通过对话历史记录进行全文搜索 |
⚖️ 模型比较(3个工具)
| 工具 | 说明 |
|---|
compare_model_responses | ⚖️ 向多个模型发送相同的提示,比较输出 |
list_saved_comparisons | 📋 列出历史比较结果 |
get_comparison | 📊 按ID获取详细比较 |
🤗 HuggingFace集成(4个工具)
| 工具 | 说明 |
|---|
search_huggingface_models | 🔍 在HuggingFace Hub中搜索模特 |
get_huggingface_model_info | 📋 获取详细的型号卡信息 |
search_mlx_models | 🍎 专门搜索MLX型号(Apple Silicon) |
get_model_download_command | 📥 为任何HF型号生成下载命令 |
📊 使用分析(4个工具)
| 工具 | 说明 |
|---|
get_usage_stats | 📊 令牌计数、响应时间、模型使用统计 |
get_model_leaderboard | 🏆 按速度、使用率或其他指标对模型进行排名 |
export_usage_analytics | 📤 将分析导出为JSON或CSV格式 |
clear_usage_analytics | 🗑️ 清晰的分析数据 |
🛠️ 自定义工具生成器(5个工具)
| 工具 | 说明 |
|---|
create_custom_tool | 🛠️ 使用提示模板创建新工具 |
list_custom_tools | 📋 列出所有自定义工具 |
run_custom_tool | ▶️ 使用参数执行自定义工具 |
delete_custom_tool | 🗑️ 删除自定义工具 |
get_tool_templates | 📚 获取内置模板(摘要、翻译、代码查看) |
🆕 混合AI桥(5个工具)-v4.0中的新功能
| 工具 | 说明 |
|---|
bridge_select_model | 🎯 基于任务类型的智能模型选择 |
bridge_delegate | 📤 将任务委托给最优局部模型 |
bridge_consensus | 🗳️ 从多个模型中获得共识 |
bridge_draft_refine | ✍️ 本地草稿→ 克劳德精炼管道 |
bridge_parallel_tasks | ⚡ 并行处理多个任务 |
🆕 模型校准(4个工具)-v4.0中的新功能
| 工具 | 说明 |
|---|
run_calibration_test | 🧪 在模型上运行标准化测试 |
get_calibration_history | 📈 查看历史测试结果 |
get_model_profile | 📊 获取模型能力概况(优势/劣势) |
compare_model_calibrations | ⚖️ 比较不同模型的校准结果 |
🆕 隐私工具(3个工具)-v4.0中的新功能
| 工具 | 说明 |
|---|
pii_scan | 🔍 扫描文本以查找个人身份信息 |
pii_scrub | 🧹 从文本中删除或屏蔽PII |
privacy_check | ✅ 检查文本对于外部API是否安全 |
🆕 Prompt Lab(4个工具)-v4.0中的新功能
| 工具 | 说明 |
|---|
create_prompt_experiment | 🧪 为提示创建A/B测试 |
run_prompt_experiment | ▶️ 跨变体运行实验 |
analyze_prompt_experiment | 📊 分析结果并找到赢家 |
get_prompt_suggestions | 💡 获取人工智能建议以迅速改进 |
🆕 模型观察者(6个工具)
| 工具 | 说明 |
|---|
watch_model | 👁️ 将HuggingFace模型添加到观察列表 |
unwatch_model | ❌ 从观察列表中删除模型 |
check_model_updates | 🔄 检查所有观看的模特以获取更新 |
get_model_alerts | 🔔 获取发现的新型号的警报 |
get_model_update_report | 📋 生成全面的更新报告 |
get_recommended_watches | 💡 获取要观看的推荐型号 |
🆕 上下文管理(7个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
context_compress | 📦 压缩对话上下文,同时保留意义 |
context_optimize | ⚡ 优化上下文窗口以获得更好的性能 |
memory_store | 💾 将重要信息存储在持久内存中 |
memory_recall | 🔍 从内存中回忆信息 |
memory_list | 📋 列出所有存储的内存 |
conversation_fork | 🔀 从当前对话创建分支 |
conversation_forks_list | 📂 列出所有对话分叉 |
🆕 模型管道(5个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
pipeline_create | 🔧 创建多步骤模型管道 |
pipeline_list | 📋 列出可用的管道模板 |
pipeline_run | ▶️ 使用输入数据运行管道 |
model_chain | 🔗 链接多个模型(输出A→ 输入B) |
model_debate | 💬 让模型辩论一个主题(赞成/反对综合) |
🆕 质量保证(6个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
qa_detect_hallucination | 🔍 检测反应中的潜在幻觉 |
qa_fact_check | ✅ 根据知识库检查索赔 |
qa_check_consistency | 🔄 检查与之前回复的一致性 |
qa_score_quality | 📊 多维质量评分 |
qa_critique | 📝 获取基于模型的响应评论 |
qa_trends | 📈 查看随时间变化的质量趋势 |
🆕 性能优化(6个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
perf_predict_latency | ⏱️ 生成前预测响应延迟 |
perf_token_budget | 💰 计划代币预算分配 |
perf_batch_create | 📦 创建批处理推理作业 |
perf_batch_list | 📋 列出所有批处理作业 |
perf_batch_results | 📊 获取批处理作业结果 |
perf_profile_history | 📈 查看性能配置文件历史记录 |
🆕 护栏和安全(7个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
guard_filter_content | 🛡️ 过滤敏感主题的内容 |
guard_redact | ✂️ 从文本中删除敏感信息 |
guard_detect_jailbreak | 🚨 检测越狱/提示注入尝试 |
guard_validate_output | ✅ 验证输出格式(JSON、代码等) |
guard_rate_limit | 🚦 对请求应用速率限制 |
guard_audit_log | 📝 记录事件以供审核 |
guard_audit_summary | 📊 获取审核日志摘要 |
🆕 微调工具(8个工具)-v5.0中的新功能
| 工具 | 说明 |
|---|
ft_prepare_dataset | 📦 准备数据集进行微调 |
ft_list_datasets | 📋 列出准备好的数据集 |
ft_dataset_info | ℹ️ 获取数据集信息和统计数据 |
ft_register_adapter | 🔧 注册LoRA适配器 |
ft_list_adapters | 📋 列出所有已注册的适配器 |
ft_plan_merge | 🔀 计划模型合并策略 |
ft_quantization_recommend | 💡 获取量化建议 |
ft_list_quant_formats | 📋 列出可用的量化格式 |
🚀 安装
先决条件
- Python 3.10或更高版本
- 推理机 已安装 服务 功能已启用
- Claude Desktop或其他MCP客户端
快速开始
# Clone the repository
git clone https://github.com/DBSS/inferencer-admin-mcp.git
cd inferencer-admin-mcp
# Create virtual environment and install
python3 -m venv .venv
source .venv/bin/activate
pip install mcp psutil httpx
Claude桌面配置
增添 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"inferencer-admin": {
"command": "/path/to/inferencer-admin-mcp/run_inferencer_server.sh"
}
}
}
📖 使用示例
混合AI桥(v4.0)
User: Delegate this coding task to my local model
Claude: [Calls bridge_delegate] → Routes to best coding model
User: Get consensus on this question from 3 models
Claude: [Calls bridge_consensus] → Returns aggregated answer with agreement score
User: Draft with local model, then refine with Claude
Claude: [Calls bridge_draft_refine] → Fast local draft + refinement prompt
模型校准(v4.0)
User: Test my Qwen model's capabilities
Claude: [Calls run_calibration_test] → Runs coding, reasoning, creative tests
User: What are my model's strengths?
Claude: [Calls get_model_profile] → Shows capability scores and recommendations
隐私卫士(v4.0)
User: Check this text for sensitive data
Claude: [Calls pii_scan] → Detects emails, SSNs, API keys, etc.
User: Is this safe to send to an external API?
Claude: [Calls privacy_check] → Returns safety assessment
快速A/B测试(v4.0)
User: Create an experiment comparing two prompt styles
Claude: [Calls create_prompt_experiment] → Sets up A/B test
User: Which prompt performs better?
Claude: [Calls analyze_prompt_experiment] → Statistical analysis with winner
模型监视器(v4.0)
User: Watch mlx-community/Qwen3-30B for updates
Claude: [Calls watch_model] → Added to watchlist
User: Any updates to my watched models?
Claude: [Calls check_model_updates] → Shows available updates
上下文管理(v5.0)
User: Compress our conversation to save context space
Claude: [Calls context_compress] → Summarizes old messages, preserves recent
User: Remember that I prefer Python over JavaScript
Claude: [Calls memory_store] → Stored in persistent memory
User: Fork this conversation to try a different approach
Claude: [Calls conversation_fork] → Creates branch point
管道模型(v5.0)
User: Run a code review pipeline on my function
Claude: [Calls pipeline_run] → Multi-step analysis: style → bugs → optimization
User: Have two models debate whether AI will replace developers
Claude: [Calls model_debate] → Pro/con arguments with synthesis
质量保证(v5.0)
User: Check this response for hallucinations
Claude: [Calls qa_detect_hallucination] → Confidence scores and risk areas
User: Score the quality of my model's response
Claude: [Calls qa_score_quality] → Multi-dimensional scoring
护栏(v5.0)
User: Check if this prompt is a jailbreak attempt
Claude: [Calls guard_detect_jailbreak] → Detection with confidence score
User: Validate this output is proper JSON
Claude: [Calls guard_validate_output] → Format validation with errors
微调工具(v5.0)
User: Prepare my data for fine-tuning in chat format
Claude: [Calls ft_prepare_dataset] → Converts to training format
User: What merge strategy should I use for my adapters?
Claude: [Calls ft_plan_merge] → Recommends linear, slerp, ties, or dare
🏷️ 型号标签
服务器会自动标记模型以便于发现:
| 类别 | 标签 |
|---|
| 尺寸 | tiny, small, medium, large, xlarge |
| 能力 | coding, reasoning, vision, chat, multilingual |
| 建筑 | moe (专家混合) |
| 速度 | fast, long_context |
| 质量 | quality, rag |
| 量化 | 3bit, 4bit, 5bit, 6bit, 8bit, fp16, bf16 |
| 格式 | mlx, apple_silicon |
📁 存储(v3.0+)
用于对话、比较、分析、校准等的持久存储:
~/.inferencer-mcp/
├── conversations/ # Saved chat sessions
├── comparisons/ # Model comparison results
├── analytics/ # Usage tracking (JSONL)
├── tools/ # Custom tool definitions
├── calibration/ # Test results and model profiles
├── prompt_lab/ # A/B test experiments
├── watcher/ # Watchlist and alerts
├── bridge/ # Routing statistics
├── context/ # Compressed contexts (NEW v5.0)
├── memory/ # Persistent memory store (NEW v5.0)
├── forks/ # Conversation forks (NEW v5.0)
├── pipelines/ # Custom pipeline definitions (NEW v5.0)
├── quality/ # QA results and trends (NEW v5.0)
├── batches/ # Batch inference jobs (NEW v5.0)
├── guardrails/ # Audit logs (NEW v5.0)
├── datasets/ # Prepared training datasets (NEW v5.0)
└── adapters/ # LoRA adapter registry (NEW v5.0)
🔧 环境变量
| 变量 | 默认值 | 描述 |
|---|
INFERENCER_HOST | 127.0.0.1 | 推断服务器主机 |
INFERENCER_PORT | 54321 | 推断服务器端口 |
INFERENCER_TIMEOUT | 30 | 请求超时(秒) |
📁 项目结构
inferencer-admin-mcp/
├── src/
│ ├── __init__.py # Package exports
│ ├── server.py # Main MCP server (107 tools)
│ ├── constants.py # Configuration and tagging patterns
│ ├── models.py # Data classes
│ ├── errors.py # Error handling
│ ├── network.py # HTTP client for Inferencer API
│ ├── cache.py # Response caching
│ ├── tagging.py # Smart model tagging system
│ ├── paths.py # Path utilities
│ ├── storage.py # Persistent JSON storage
│ ├── history.py # Conversation history
│ ├── comparison.py # Model comparison
│ ├── analytics.py # Usage tracking
│ ├── huggingface.py # HuggingFace integration
│ ├── tool_builder.py # Custom tool creation
│ ├── bridge.py # Hybrid AI orchestration
│ ├── calibration.py # Model testing
│ ├── privacy.py # PII detection
│ ├── prompt_lab.py # A/B testing
│ ├── model_watcher.py # Update monitoring
│ ├── context.py # Context management (NEW v5.0)
│ ├── pipelines.py # Model pipelines (NEW v5.0)
│ ├── quality.py # Quality assurance (NEW v5.0)
│ ├── performance.py # Performance optimization (NEW v5.0)
│ ├── guardrails.py # Safety guardrails (NEW v5.0)
│ └── finetuning.py # Fine-tuning tools (NEW v5.0)
├── tests/ # Unit tests
├── docs/ # Documentation
├── run_inferencer_server.sh # Launch script
├── pyproject.toml # Project configuration
└── README.md # This file
🔗 相关项目
📄 许可证
MIT许可证-请参阅 许可证 了解详情。
👤 作者
DigitalKredit -
______________________________________________________________________
更新日志
v5.0.0 -高级AI工作流发布:
- 新增39个工具(68→107个)
- 上下文管理:压缩、内存持久化、会话分叉
- 模型管道:多步骤工作流、链接、辩论模式
- 质量保证:幻觉检测、事实核查、质量评分
- 性能优化:延迟预测、批处理、令牌预算
- 护栏:内容过滤、越狱检测、输出验证
- 微调工具:数据集准备、LoRA管理、模型合并
- 6个新模块:context.py、pipelines.py、quality.py、performance.py、guardails.py、finetuning.py
v4.0.0 -混合人工智能和智能发布:
- 新增22个工具(46→68个)
- 混合AI桥:本地模型与Claude之间的智能路由
- 模型校准:测试和剖面模型功能
- 隐私卫士:PII检测和内容净化
- Prompt Lab:用于快速优化的A/B测试
- 模型监视器:HuggingFace更新监控
- 5个新模块:bridge.py、calibration.py、privacy.py、prompt_lab.py、model_watcher.py
v3.0.0 -主要功能发布:
- 新增20个工具(26→46个)
- 保存/加载/搜索对话历史记录
- 与持久存储的模型比较
- HuggingFace Hub集成用于模型发现
- 使用情况分析,导出为JSON/CSV
- 带有提示模板的自定义工具生成器
- JSON持久存储
~/.inferencer-mcp/
v2.0.0版本 -添加了6个高级工具:令牌检查、提示预填充、生成配置、内存使用和MoE专家分析。
v1.0.0 -初始版本包含20个用于模型管理、聊天和基准测试的核心工具。