Logo Apex Log MCP Server

Apex Log MCP Server

Tổ chức
certinia

Apex Log MCP Server - AI-powered Salesforce Apex debug log analysis. Find performance bottlenecks, slow methods, SOQL bottlenecks, and governor limit issues.

Nhà phát hànhcertinia
Kho mãdebug-log-analyzer-mcp
Ngôn ngữTypeScript
Bản fork
6
Sao
32
Công cụ có sẵn
3
Phương thức truyền tảistdio
Danh mục
Giấy phépBSD-3-Clause
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Apex Log MCP Server cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 3 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    32 sao và 6 bản fork từ kho mã được liên kết.

Apex Log MCP Server

npm version CI License Node.js

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.

Instead of scrolling thousands of log lines, ask what's slow and why. Uses the same 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):

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

Then ask your assistant to analyze a log. apexlog_execute_anonymous also needs 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?"
  • "Run this Apex against my scratch org and analyze the performance"

Keeping the server connected costs ~1,232 tokens, 0.6% of a 200K context. See Token Cost.

Tools Reference

The analysis tools take an absolute path to a .log file.

Every tool returns one flat table, encoded as TOON. Nothing is repeated, and nothing is dropped to save space.

A 0 means none, not "not measured". Only what did not happen is left out: fatal errors, lost log content, query plans. Durations are in milliseconds to 3 decimal places, percentages to 1.

The server runs as a local process started by your client over stdio, no network calls and no API keys. Each log is parsed once, so follow up questions are faster.

apexlog_list_slow_operations

Ranks what a log spent its time on by self time - code units, methods, queries, searches, DML, flows and workflows in one table.

A default response returns:

  • capturedAt - {debugCategory, level}
  • operations - {debugCategory, type, name, namespace, callCount, durationTotalMs, durationSelfMs, durationSelfMaxMs, selfPercentage, soqlCount, dmlCount, soslCount, rowCount, thrownCount}
  • queryPlans - {operationRow, leadingOperationType, relativeCost, cardinality, sObjectCardinality}

Each response also gives durationTotalMs for the whole transaction, returnedSelfPercentage for the share these rows account for, and matchedCount for the rows that matched before paging.

durationSelfMaxMs is the slowest single call in a grouped row. Read it against durationSelfMs to tell one bad call from many small ones. It is absent when the row is already one call.

Two columns say what a row is, both taken straight from the log:

  • debugCategory - what Salesforce stamped on the event. It decided whether the event was logged at all, and it is the spelling apexlog_execute_anonymous takes.
  • type - the event type. The category cannot imply it: SOQL_EXECUTE_BEGIN, SOSL_EXECUTE_BEGIN and DML_BEGIN all sit under database.

Watch for ENTERING_MANAGED_PKG. It is time a package spent where the log shows nothing, and it is often most of a transaction.

sortBy: "heapSelfNetBytes" ranks by retained heap instead of time, adding that column and returnedHeapPercentage. Both are absent otherwise. The figure is signed, so a row that released more than it took reads below zero. Heap is logged only at apexCode FINER and above, so check the apexCode row of capturedAt before trusting a zero.

capturedAt gives the level each category in the returned rows was logged at.

queryPlans is what the query optimizer decided about the queries behind those rows. A relativeCost above 1 means it will not treat the query as selective. Plans are absent when the log explained none, because explain lines need database FINEST.

operationRow points at a row of operations, counting from 1. Under a namespace, callerNamespace or debugCategory grouping a row is not one query, so the plan carries the query text in name instead.

ParameterTypeRequiredDescription
logFilePathstringYesAbsolute path
debugCategorystring[]NoRank only these debug log categories
typestring[]NoRank only these log event types, e.g. SOQL_EXECUTE_BEGIN, DML_BEGIN, METHOD_ENTRY
namespacestring[]NoRank only these namespaces
minSelfMsnumberNoDrop operations below this self time (default: 0), whichever sortBy is used
limitnumberNoPage size (default: 10); fewer if the page would be too large
offsetnumberNoRanked rows to skip (default: 0). Advance it by the rows you got, which can be fewer than limit.
groupBystringNoFold repeats into one row; default name. callerNamespace attributes platform DML to the package that drove it. debugCategory folds a namespace's event types together and so states no type or name. none ranks each call on its own. A grouped durationTotalMs is what the transaction takes back if the group never runs - never sum it across rows.
sortBystringNoDefault durationSelfMs. heapSelfNetBytes adds that column.

apexlog_get_summary

How long the transaction ran, where the time went, what it consumed, and whether the log is complete. Start here.

  • fatalErrors - {message, frames}
  • governorLimits - {limit, used, max}
  • limitsByNamespace - {namespace, limit, used}
  • categories - {debugCategory, level, operationCount, durationSelfMs, selfPercentage}

All thirteen governor limits are listed, zeros included.

limitsByNamespace shows what each namespace consumed. This is how you see a managed package spending your CPU time. It has no ceiling column, because a ceiling is per limit for the whole transaction and already sits in governorLimits.

categories covers all eleven, each with the level it was captured at, because the level is what a zero means:

  • database,NONE,0 - the queries were not logged.
  • database,FINEST,0 - no queries ran.
  • dataAccess,"",0 - the log's header declared no level for it, which most logs do not.

dataAccess, wave and validation are always zero. No timed event carries them.

truncated says whether the log is complete. In a partial log, every figure is a floor. Where the platform cut it, truncatedBy says how - skipped-lines for a hole, max-size for a missing tail - and skippedBytes says how much went. Both are absent when a log merely stops mid-frame.

thrownCount counts the exceptions thrown, zero included.

fatalErrors appears once per failure that ended the transaction, with the innermost three frames and a trailing … where there were more. It is the only field that says a transaction did not finish, because a fatal error need not breach any limit.

ParameterTypeRequiredDescription
logFilePathstringYesAbsolute path

apexlog_list_limit_risks

The governor limits nearest their ceiling, worst first.

  • capturedAt - {debugCategory, level}
  • atRisk - {limit, used, max, usedPercentage}

threshold is reported beside the rows, so an empty table means nothing reached it rather than that the answer is missing.

capturedAt gives the level that gated each returned limit. Every limit but heap comes from apexProfiling; heapSize comes from apexCode.

ParameterTypeRequiredDescription
logFilePathstringYesAbsolute path
thresholdnumberNoReport a limit once it is this percentage consumed (default: 80)

apexlog_execute_anonymous

Runs anonymous Apex against an authenticated org, saves the debug log locally, and returns the path. Pass that path to any analysis tool.

The response also gives the org username, its alias if set, the org type, and a summary of the run. Logs go to .apex-log-mcp/ by default - add it to your .gitignore. Production orgs are gated: see Production safety.

ParameterTypeRequiredDescription
apexstringYesThe anonymous Apex to be executed
targetOrgstringNoAlias or username of the target Salesforce org. Uses the project default if not specified.
outputDirstringNoDirectory to save the debug log file. Defaults to .apex-log-mcp/ in the project root.
debugLevelstring | objectNoTrace flag log levels. "default" restores the defaults; a bare level sets every category to it; an object sets only the categories named and leaves the rest unchanged. Defaults: apexCode, apexProfiling, visualforce, workflow FINE; callout, system, validation DEBUG; database FINEST; nba, wave INFO.

An object debugLevel looks like this:

json
{ "database": "FINEST", "apexCode": "FINE" }

Levels are NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST.

Example prompts:

  • "Execute this Apex and show me the log: System.debug('Hello');"
  • "Run a query for all Accounts and analyze the performance"
  • "Execute this Apex with all debug levels set to FINEST"
  • "Run this Apex against my QA org with database logging set to FINEST"

Token Cost

Every request carries all four tool definitions, whether you call them or not. Each figure below is a whole definition: name, title, description, input schema and annotations.

ToolTokens
apexlog_list_slow_operations~530
apexlog_execute_anonymous~407
apexlog_list_limit_risks~150
apexlog_get_summary~145
Total~1,232 (0.6% of a 200K context), -19% vs 1.x ~1,529

Only the total compares with 1.x: per tool it would compare different tools, since apexlog_list_slow_operations replaced one that took three selection parameters and ranked methods where this one takes eight and ranks every timed event.

A call itself is about 15 tokens - a tool name and a log path - so what a call costs is what it returns.

Cost does not grow with the log size. The figures below are measured against a 40 KB slice of the Apex Log Analyzer sample log. On the full 19.7 MB original, apexlog_get_summary returns ~374 tokens instead of ~364, and apexlog_list_limit_risks the same ~35.

ToolResponse1.xChange
apexlog_get_summary~325~293+11%
apexlog_list_slow_operations~396~408-3%
apexlog_list_limit_risks~35~84-58%

Configuration

The Quick Start config gives you all four tools.

Production safety

apexlog_execute_anonymous runs arbitrary Apex, so the server identifies the org before running anything:

Org typeIdentified byBehaviour
sandboxIsSandbox, no trial expiryRuns
scratchIsSandbox with a trial expiryRuns
trialNot a sandbox, has a trial expiryRuns
developerDeveloper EditionRuns
productionAnything elseConfirmation required
unknownThe org could not be queriedConfirmation required

For a production org, --allow-production-orgs runs it anyway. Otherwise the server asks you to confirm, naming the org and showing the Apex. That needs a client that supports elicitation; without one the call is refused, and the message names both ways to proceed. Each confirmation authorizes one run.

An org that cannot be identified is treated as production, so a network or permissions problem can never quietly downgrade one.

Server flags

FlagDescription
--allow-production-orgsTreat production orgs like any other - no confirmation, no refusal. Only set this if production targets are intentional.
--no-apex-executionRefuse every Apex execution. The tool stays visible so agents know it exists. The three analysis tools are unaffected.

For an analysis-only deployment:

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

Documentation

Contributing

See the Contributing Guide, Developing to set up your environment, and the Code of Conduct.

License

BSD 3-Clause. Copyright © Certinia Inc. All rights reserved.

Cài đặt

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

Công cụ có sẵn

  • analyze_apex_log_performance

    Rank methods in an Apex debug log by self-execution time. Returns method names, durations (in ms), SOQL/DML counts, and optimization recommendations. Best for finding which specific methods to optimize.

  • get_apex_log_summary

    Get a high-level summary of an Apex debug log including total execution time (in ms), method count, SOQL/DML totals, governor limits, and active namespaces. Best for a quick overview before deeper analysis.

  • find_performance_bottlenecks

    Check whether an Apex log transaction is approaching governor limits (flags usage above 80%). Analyzes CPU time, SOQL/DML limits, query rows, and method execution patterns by namespace. Best for checking if a transaction is at risk of hitting governor limits.

Dùng MCP Apex Log MCP Server với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Apex Log MCP Server, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Apex Log MCP Server làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Apex Log MCP Server.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "debug-log-analyzer-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@certinia/apex-log-mcp"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Apex Log MCP Server, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Apex Log MCP Server.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Apex Log MCP Server giúp tôi làm việc này không?
Apex Log MCP Server
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Apex Log MCP Server.

Câu hỏi thường gặp

Máy chủ MCP Apex Log MCP Server dùng để làm gì?

Apex Log MCP Server là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Apex Log MCP Server với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Apex Log MCP Server với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Apex Log MCP Server với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Apex Log MCP Server, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Apex Log MCP Server với TypingMind?

Apex Log MCP Server hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Apex Log MCP Server cung cấp những công cụ nào trong TypingMind?

Apex Log MCP Server cung cấp 3 công cụ MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Apex Log MCP Server không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Apex Log MCP Server yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇