CD

certinia/debug-log-analyzer-mcp

开发工具官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

36 stars 6 forks 质量 75 趋势 32BSD-3-Clause

Apex 日志 MCP 服务器——由人工智能驱动的 Salesforce Apex 调试日志分析。找出性能瓶颈、慢方法、SOQL 瓶颈和治理器限制问题。

概览

不要滚动成千上万的日志行,而是问问什么慢,为什么慢。使用与Apex Log Analyzer VS Code扩展相同的解析器。 需要Node.js 22或以后。把这些添加到你的MCP客户端配置中(claude_desktop_config.json、VS Code mcp.json等): 然后让你的助理分析日志。apexlog_execute_anonymous还需要一个用Salesforce CLI认证的组织。 - “给我一份调试日志的摘要” - “给我看默认命名空间中最慢的5种方法” - “我们这次事务是否接近任何治理极限?”- “用我的临时组织运行这个Apex并分析性能” 保持服务器连接成本为 ~1,232 token,占 200K 上下文的 0.6%。参见 token 成本。 分析工具会选择绝对路径到.log文件。 每个工具返回一个平坦的桌面,编码为TOON。不会重复,也不会丢弃任何以节省空间。 0表示无,不代表“未测量”。只有未发生的部分被排除:致命错误、日志内容丢失、查询计划。

概述(AI 翻译)

MCP 服务器分析 AI 助手提供的 Salesforce Apex 调试日志。查找慢速方法、管理风险限制及交易时间所在。在你的组织中,运行匿名 Apex,获取日志并设置跟踪标志。

与其滚动成千上万的日志行,不如问清楚什么慢,为什么慢。使用与Apex日志分析器VS Code扩展相同的Apex日志解析器。

快速启动

需要Node.js 22或更高版本。将此添加到你的MCP客户端配置中(claude_desktop_config.json,VS代码mcp.json等):

然后让你的助理分析日志。组织工具还需要组织通过 Salesforce CLI 认证。

示例提示

  • “给我一份调试日志的摘要”
  • “给我展示默认命名空间中最慢的5种方法”
  • “我们是否接近任何调子限制?”
  • “我的 System.debug 调用打印了什么?”
  • “用这个Apex对比我的临时组织,分析性能”
  • “查找 [email protected] 的最新调试日志并进行总结”
  • “为什么没有该用户的日志?”

保持服务器连接需要花费 ~2,435 个代币,占 20 万上下文的 1.2%。参见代币成本。

工具参考

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Apex Log MCP Server

MCP Server to Analyze Salesforce Apex debug logs from your AI assistant. Finds slow methods, governor limit risks, and where a transaction spent its time. In your org, runs anonymous Apex, fetches logs, and sets trace flags.

Instead of scrolling thousands of log lines, ask what’s slow and why. Uses the same Apex log parser as the Apex Log Analyzer VS Code extension.

Quick Start

Requires Node.js 22 or later. Add this to your MCP client config (claude_desktop_config.json, VS Code mcp.json, and so on):

{
  "mcpServers": {
    "apex-log-mcp": {
      "command": "npx",
      "args": ["-y", "@certinia/apex-log-mcp"]
    }
  }
}

In VS Code mcp.json, use "servers" in place of "mcpServers".

Then ask your assistant to analyze a log. The org tools - apexlog_execute_anonymous, apexlog_list_org_logs, apexlog_get_org_logs and apexlog_create_trace_flag - also need an org authenticated with the Salesforce CLI.

Example Prompts

  • “Give me a summary of this debug log”
  • “Show me the 5 slowest methods in the default namespace”
  • “Are we approaching any governor limits in this transaction?”
  • “What did my System.debug calls print?”
  • “Run this Apex against my scratch org and analyze the performance”
  • “Run it again with database logging at FINEST”
  • “Find the latest debug log for [email protected] and summarize it”
  • “Why are there no logs for this user?”

Keeping the server connected costs ~2,445 tokens, 1.2% of a 200K context. See Token Cost.

Tools Reference

在 GitHub 查看完整 README

安装

npx -y @certinia/apex-log-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "apex-log-mcp": { "command": "npx", "args": ["-y", "@certinia/apex-log-mcp"] } } }