agentleFS
crosstech-solutions-bvcrosstech-solutions-bv/swing-mcp/skills/troubleshooting/SKILL.md

troubleshooting

Skill4 starsChanged 17 days agoMITView on GitHub

Uses Swing MCP and its documentation to troubleshoot server, agent, and session issues on Swing or JavaFX targets. Trigger this skill when launch_app or attach_to_app fail, when tools report no active session, or when the server initialization fails.

29 other projects use a version of this, 3 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use task-breakdown and architecture.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ttmouseSkill

    task-breakdown

    专业的任务拆解器,将复杂需求拆分成"独立可运行与可演示"的最小闭环任务卡。严格按照纵向切片、单一数据变化、单一入口原则,确保每张任务卡都能在单回合实现并验证。当用户说"帮我拆解一下任务"、"用任务拆解器分析"、"按规范拆分"或需要将一个大的开发需求拆分成可执行的小任务时使用。输出格式严格按照[src/renderer/TODO.md]标准存储。

    Also in 3 projects that use this

  • AnthropicSkill

    architecture

    Create or evaluate an architecture decision record (ADR). Use when choosing between technologies (e.g., Kafka vs SQS), documenting a design decision with trade-offs and consequences, reviewing a system design proposal, or designing a new component from requirements and constraints.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 7 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 26 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you find a configuration file, read and interpret it to identify potential issues such as:

    line 14
  2. Distinctive:

    If you cannot find any of these files, only then should you ask the user to provide their configuration file content.

    line 20
  3. Distinctive:

    Before reading documentation or suggesting configuration changes, check if the failure matches one of the following common patterns.

    line 24
  4. Very specific:

    Verify the Java version: java -version (must be 21 or newer).

    line 30
  5. Very specific:

    If multiple JDKs are installed, use an absolute path to the JDK 21+ java binary in the MCP configuration instead of relying on PATH.

    line 31
  6. Very specific:

    Check that SWING_MCP_AGENT_JAR (or the swing.mcp.agent-jar property) is set in the MCP server configuration's env block.

    line 38
  7. Distinctive:

    Ask the user to restart the MCP server (or their AI client) after fixing the configuration.

    line 40
  8. Very specific:

    Verify the PID belongs to a Java process running a Swing or JavaFX UI (jps -l lists candidate JVMs).

    line 44
  9. Very specific:

    If take_snapshot reports no window on an application you can see, the toolkit may not have started yet — JavaFX windows only exist once …

    line 45
  10. Very specific:

    Call app_status and list_sessions — the session may have died (alive: false) or another session may be active.

    line 52
  11. Very specific:

    If the target application blocks its UI thread (the Event Dispatch Thread for Swing, the JavaFX Application Thread for JavaFX — e.g.

    line 55
  12. Distinctive:

    Read docs/installation.md (per-client setup and the Troubleshooting section) and docs/tools/README.md (server configuration properties) to …

    line 69
  13. Distinctive:

    After updating, the user must restart the MCP server (or their AI client) for the change to take effect.

    line 89
  14. Distinctive:

    If the issue is still unclear, run diagnostic commands to test the setup directly:

    line 93
  15. Very specific:

    Test against the bundled demo app: launch_app with java -jar /path/to/swing-mcp-demo-1.4.0.jar, then take_snapshot.

    line 99
  16. Very specific:

    If the documentation does not cover the specific error, check if the gh (GitHub CLI) tool is available in the environment.

    line 103

“Common” is measured: kept by at least 6 in 10 of the 26 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Troubleshooting Wizard

You are acting as a troubleshooting wizard to help the user configure and fix their Swing MCP server setup. When this skill is triggered (e.g., because launch_app or attach_to_app failed, tools report that no session is connected, or the server wouldn't start), follow this step-by-step diagnostic process:

Step 1: Find and Read Configuration

Your first action should be to locate and read the MCP configuration file. Search for the following files in the user's workspace: .mcp.json, .vscode/mcp.json, .claude/settings.json, .cursor/mcp.json, or the client's global MCP settings.

If you find a configuration file, read and interpret it to identify potential issues such as:

  • A relative or wrong path to the swing-mcp-server jar.
  • A missing or wrong SWING_MCP_AGENT_JAR environment variable (must be an absolute path to the shaded swing-mcp-agent jar).
  • A java command that resolves to an old JDK.

If you cannot find any of these files, only then should you ask the user to provide their configuration file content.

Step 2: Triage Common Errors

Before reading documentation or suggesting configuration changes, check if the failure matches one of the following common patterns.

Symptom: Server doesn't start / no tools listed

The server requires JDK 21+. Some GUI clients don't inherit the shell PATH.

  1. Verify the Java version: java -version (must be 21 or newer).
  2. If multiple JDKs are installed, use an absolute path to the JDK 21+ java binary in the MCP configuration instead of relying on PATH.
  3. Remember that the server logs to ${java.io.tmpdir}/swing-mcp-server.log (e.g. /tmp/swing-mcp-server.log) — console logging is disabled because stdout is reserved for the MCP stdio transport. Read this log for startup errors.

Error: launch_app / attach_to_app fails with a missing agent jar

The server needs the agent jar to preload (launch_app) or dynamically attach (attach_to_app) it.

  1. Check that SWING_MCP_AGENT_JAR (or the swing.mcp.agent-jar property) is set in the MCP server configuration's env block.
  2. Confirm the path is absolute and the file exists (e.g. /path/to/swing-mcp/swing-mcp-agent/target/swing-mcp-agent-1.4.0.jar after mvn verify).
  3. Ask the user to restart the MCP server (or their AI client) after fixing the configuration.

Symptom: attach_to_app fails against a running JVM

  1. Verify the PID belongs to a Java process running a Swing or JavaFX UI (jps -l lists candidate JVMs). If take_snapshot reports no window on an application you can see, the toolkit may not have started yet — JavaFX windows only exist once Application.start has run.
  2. JVMs started with -XX:+DisableAttachMechanism cannot be attached to — relaunch the app via launch_app instead.
  3. The target JVM and the MCP server should run as the same OS user; attaching across users fails.

Symptom: Session connects but tools time out or report no session

  1. Call app_status and list_sessions — the session may have died (alive: false) or another session may be active; use select_session to switch.
  2. The agent binds a loopback-only port in the swing.mcp.agent-port-min..max range (default 40000–40100). Check that a local firewall or sandbox does not block localhost connections in this range, or change the range.
  3. Long-running UI operations may exceed the round-trip timeout — increase swing.mcp.tool-timeout-ms (default 30000).
  4. If the target application blocks its UI thread (the Event Dispatch Thread for Swing, the JavaFX Application Thread for JavaFX — e.g. a long computation running on it), commands cannot execute; use wait_for with EDT_IDLE or fix the application.

Symptom: a JavaFX application snapshots as empty, or uids are comp- only

  1. The toolkit loads reflectively — JavaFX must be on the target app's class/module path (the agent bundles no JavaFX runtime of its own). Check list_windows: each window carries a toolkit field, so a toolkit: "swing"-only (or empty) result on a JavaFX app points here.
  2. Attach (or launch) only after Application.start has run — JavaFX windows don't exist before that, so an early snapshot legitimately finds none.
  3. drag and evaluate_java are Swing-only; their error message says so when called against a JavaFX-only target.

Symptom: evaluate_java returns "disabled"

evaluate_java (arbitrary code execution in the target JVM) is disabled by default for security. Enable it explicitly with swing.mcp.evaluate.enabled=true in the server configuration, and only when the user understands the implications.

Step 3: Read the Documentation

Read docs/installation.md (per-client setup and the Troubleshooting section) and docs/tools/README.md (server configuration properties) to map the error to a known issue.

Step 4: Formulate a Configuration

Based on the exact error and the user's environment (OS, MCP client), formulate the correct MCP configuration snippet, for example:

{
  "mcpServers": {
    "swing": {
      "command": "java",
      "args": ["-jar", "/absolute/path/to/swing-mcp-server-1.4.0.jar"],
      "env": {
        "SWING_MCP_AGENT_JAR": "/absolute/path/to/swing-mcp-agent-1.4.0.jar"
      }
    }
  }
}

After updating, the user must restart the MCP server (or their AI client) for the change to take effect.

Step 5: Run Diagnostic Commands

If the issue is still unclear, run diagnostic commands to test the setup directly:

  • java -version to verify the JDK is 21+.
  • java -jar /path/to/swing-mcp-server-*.jar from a terminal to see startup errors directly.
  • Inspect ${java.io.tmpdir}/swing-mcp-server.log for stack traces of the server itself.
  • For the launched application's own stdout/stderr (its stack traces and log lines), call get_app_output.
  • Test against the bundled demo app: launch_app with java -jar /path/to/swing-mcp-demo-1.4.0.jar, then take_snapshot.

Step 6: Check GitHub for Existing Issues

If the documentation does not cover the specific error, check if the gh (GitHub CLI) tool is available in the environment. If so, search the repository for similar issues: gh issue list --repo crosstech-solutions-bv/swing-mcp --search "<error snippet>" --state all

Alternatively, recommend that the user checks https://github.com/crosstech-solutions-bv/swing-mcp/issues for help.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.