![]() |
Adding a run_jeb_script tool to JEB's MCP server
1 Attachment(s)
Hi yall. I was needing to integrate jeb more deeply with the powerful AI tools and I found that i needed to have an extra tool that JEB still dosnt provide run_jeb_script
Disclaimer: this whole project was vibe coded Im not gonna lie to you. I just cared about the result and how to improve my rev eng workflow. Let me know if you find issues or proposals and I will be happy to help. I hope you can get some value out of this at least the idea. JEB 5.40 ships with an MCP server (File → Start/Stop the MCP Server). It works, but it exposes a fixed list of 20 tools and provides no way to run arbitrary code. If the model needs something not on that list, you're stuck. This small autorun script (JebMcpRunScript.py) goes into: < JebHome >\scripts\ It registers a 21st tool, named run_jeb_script, directly on JEB’s MCP server. The model gets full access to JEB’s Python API — no bridge, no sidecar, same SSE endpoint, just one extra tool. ------------------------------------------------------------ The 20 Built‑In Tools (Reference) Code:
get_project_information project name, artifacts, unitsUseless the moment you want something like: find every call to Cipher.getInstance("DES") and dump them as JSON That’s not a tool — that’s a script. ------------------------------------------------------------ What `run_jeb_script` Does Input: Code:
{ "code": "string" }Code:
ctx IClientContextIf it’s a block, assign to result. print() output is captured. Example: find all callsites of System.exit Code:
from com.pnfsoftware.jeb.core import RuntimeProjectUtilSetup Copy the script: Code:
copy JebMcpRunScript.py C:\JEB\scripts\Code:
JEB MCP server: http://localhost:8425/mcpCode:
claude mcp add --transport sse --scope user jeb http://localhost:8425/mcpCode:
{------------------------------------------------------------ Optional: Feed Claude the JEB API Docs JEB ships: Code:
C:\JEB\doc\apidoc_md.zipCode:
mkdir .jeb-docsCode:
The JEB Python API reference is in .jeb-docs/.How the Tool Is Attached (The Interesting Part) McpSyncServer.addTool(SyncToolSpecification) exists in the embedded SDK. We just need to locate the live instance — but it’s private, obfuscated, and renamed every release. The script tries 5 strategies (fallback order): 1. Public getters (getMcpServer, getServer, …) 2. Declared field by type io.modelcontextprotocol.server.McpSyncServer 3. Same, but for McpAsyncServer, wrapped into a sync server 4. Bounded BFS through reachable fields/collections (depth ≤ 4, ≤ 20k visits, skipping JDK/Jetty) 5. Static‑field scan on JebMcpServerInstance Each candidate is validated via: - isInstance using the classloader - presence of addTool(SyncToolSpecification) The winning strategy is logged; failures are logged too for debugging future JEB changes. ------------------------------------------------------------ Caveats Code:
- Toggling MCP via menu spawns a new server → re-run the script.CPython 3 Note JEB 5.40 adds Java Embedded Python (CPython 3.x). Jython 2.7 remains default and is what runs at autorun stage. This plugin stays on Jython for now; CPython dispatch could be added later. ------------------------------------------------------------ Troubleshooting Code:
Autorun doesn't fire:Uninstall Code:
del C:\JEB\scripts\JebMcpRunScript.py------------------------------------------------------------ Folder Contents Code:
JebMcpRunScript.py ← drop into <JebHome>\scripts\ |
| All times are GMT +8. The time now is 04:33. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX