ida-pro-mcp-xjoker 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. ida_pro_mcp/__init__.py +0 -0
  2. ida_pro_mcp/__main__.py +6 -0
  3. ida_pro_mcp/ida_mcp/__init__.py +68 -0
  4. ida_pro_mcp/ida_mcp/api_analysis.py +1296 -0
  5. ida_pro_mcp/ida_mcp/api_core.py +337 -0
  6. ida_pro_mcp/ida_mcp/api_debug.py +617 -0
  7. ida_pro_mcp/ida_mcp/api_memory.py +304 -0
  8. ida_pro_mcp/ida_mcp/api_modify.py +406 -0
  9. ida_pro_mcp/ida_mcp/api_python.py +179 -0
  10. ida_pro_mcp/ida_mcp/api_resources.py +295 -0
  11. ida_pro_mcp/ida_mcp/api_stack.py +167 -0
  12. ida_pro_mcp/ida_mcp/api_types.py +480 -0
  13. ida_pro_mcp/ida_mcp/auth.py +166 -0
  14. ida_pro_mcp/ida_mcp/cache.py +232 -0
  15. ida_pro_mcp/ida_mcp/config.py +228 -0
  16. ida_pro_mcp/ida_mcp/framework.py +547 -0
  17. ida_pro_mcp/ida_mcp/http.py +859 -0
  18. ida_pro_mcp/ida_mcp/port_utils.py +104 -0
  19. ida_pro_mcp/ida_mcp/rpc.py +187 -0
  20. ida_pro_mcp/ida_mcp/server_manager.py +339 -0
  21. ida_pro_mcp/ida_mcp/sync.py +233 -0
  22. ida_pro_mcp/ida_mcp/tests/__init__.py +14 -0
  23. ida_pro_mcp/ida_mcp/tests/test_api_analysis.py +336 -0
  24. ida_pro_mcp/ida_mcp/tests/test_api_core.py +237 -0
  25. ida_pro_mcp/ida_mcp/tests/test_api_memory.py +207 -0
  26. ida_pro_mcp/ida_mcp/tests/test_api_modify.py +123 -0
  27. ida_pro_mcp/ida_mcp/tests/test_api_resources.py +199 -0
  28. ida_pro_mcp/ida_mcp/tests/test_api_stack.py +77 -0
  29. ida_pro_mcp/ida_mcp/tests/test_api_types.py +249 -0
  30. ida_pro_mcp/ida_mcp/ui.py +357 -0
  31. ida_pro_mcp/ida_mcp/utils.py +1186 -0
  32. ida_pro_mcp/ida_mcp/zeromcp/__init__.py +5 -0
  33. ida_pro_mcp/ida_mcp/zeromcp/jsonrpc.py +384 -0
  34. ida_pro_mcp/ida_mcp/zeromcp/mcp.py +883 -0
  35. ida_pro_mcp/ida_mcp.py +186 -0
  36. ida_pro_mcp/idalib_server.py +354 -0
  37. ida_pro_mcp/idalib_session_manager.py +259 -0
  38. ida_pro_mcp/server.py +1060 -0
  39. ida_pro_mcp/test.py +170 -0
  40. ida_pro_mcp_xjoker-1.0.1.dist-info/METADATA +405 -0
  41. ida_pro_mcp_xjoker-1.0.1.dist-info/RECORD +45 -0
  42. ida_pro_mcp_xjoker-1.0.1.dist-info/WHEEL +5 -0
  43. ida_pro_mcp_xjoker-1.0.1.dist-info/entry_points.txt +4 -0
  44. ida_pro_mcp_xjoker-1.0.1.dist-info/licenses/LICENSE +21 -0
  45. ida_pro_mcp_xjoker-1.0.1.dist-info/top_level.txt +1 -0
ida_pro_mcp/test.py ADDED
@@ -0,0 +1,170 @@
1
+ """Standalone test runner for IDA Pro MCP using idalib.
2
+
3
+ Usage:
4
+ ida-mcp-test tests/crackme03.elf
5
+ ida-mcp-test tests/crackme03.elf --category api_core
6
+ ida-mcp-test tests/crackme03.elf --pattern "*meta*"
7
+
8
+ With coverage:
9
+ uv run coverage run -m ida_pro_mcp.test crackme03.elf
10
+ uv run coverage report
11
+ uv run coverage html
12
+ """
13
+
14
+ import sys
15
+ import argparse
16
+ from pathlib import Path
17
+
18
+ # idapro must go first to initialize idalib
19
+ import idapro
20
+ import ida_auto
21
+
22
+
23
+ def main() -> int:
24
+ """Entry point for ida-mcp-test command."""
25
+ parser = argparse.ArgumentParser(
26
+ description="Run IDA Pro MCP tests using idalib",
27
+ formatter_class=argparse.RawDescriptionHelpFormatter,
28
+ epilog="""
29
+ Examples:
30
+ ida-mcp-test tests/crackme03.elf
31
+ ida-mcp-test tests/crackme03.elf --category api_core
32
+ ida-mcp-test tests/crackme03.elf --pattern "*meta*"
33
+ ida-mcp-test tests/crackme03.elf --stop-on-failure
34
+
35
+ With coverage:
36
+ uv run coverage run -m ida_pro_mcp.test crackme03.elf
37
+ uv run coverage report --show-missing
38
+ uv run coverage html && open htmlcov/index.html
39
+ """,
40
+ )
41
+ parser.add_argument("binary", type=Path, help="Path to binary file to analyze")
42
+ parser.add_argument(
43
+ "--pattern",
44
+ "-p",
45
+ default="*",
46
+ help="Glob pattern to filter test names (default: *)",
47
+ )
48
+ parser.add_argument(
49
+ "--category",
50
+ "-c",
51
+ default="*",
52
+ help="Filter by module category (default: *)",
53
+ )
54
+ parser.add_argument(
55
+ "--stop-on-failure",
56
+ "-x",
57
+ action="store_true",
58
+ help="Stop at first failure",
59
+ )
60
+ parser.add_argument(
61
+ "--quiet",
62
+ "-q",
63
+ action="store_true",
64
+ help="Quiet mode - only show summary",
65
+ )
66
+ parser.add_argument(
67
+ "--list",
68
+ "-l",
69
+ action="store_true",
70
+ help="List available tests without running them",
71
+ )
72
+ parser.add_argument(
73
+ "--verbose",
74
+ "-v",
75
+ action="store_true",
76
+ help="Show IDA console messages",
77
+ )
78
+ parser.add_argument(
79
+ "--sample-size",
80
+ "-n",
81
+ type=int,
82
+ default=5,
83
+ help="Number of items for sampling-based tests (default: 5)",
84
+ )
85
+
86
+ args = parser.parse_args()
87
+
88
+ # Check binary exists
89
+ if not args.binary.exists():
90
+ print(f"Error: Binary not found: {args.binary}", file=sys.stderr)
91
+ return 1
92
+
93
+ # Configure IDA console output
94
+ if args.verbose:
95
+ idapro.enable_console_messages(True)
96
+ else:
97
+ idapro.enable_console_messages(False)
98
+
99
+ # Open database
100
+ print(f"Opening database for: {args.binary}")
101
+ if idapro.open_database(str(args.binary), run_auto_analysis=True):
102
+ print("Error: Failed to open database", file=sys.stderr)
103
+ return 1
104
+
105
+ # Wait for auto-analysis
106
+ print("Waiting for auto-analysis...")
107
+ ida_auto.auto_wait()
108
+ print()
109
+
110
+ try:
111
+ # Import test framework and API modules AFTER idalib is initialized
112
+ # This triggers the @test decorators to register tests
113
+ from ida_pro_mcp.ida_mcp.framework import run_tests, TESTS, set_sample_size
114
+
115
+ # Import all test modules to register the tests
116
+
117
+ # Configure sample size for deterministic sampling helpers
118
+ set_sample_size(args.sample_size)
119
+
120
+ # Handle --list
121
+ if args.list:
122
+ print("Available tests:")
123
+ by_category: dict[str, list[str]] = {}
124
+ for name, info in sorted(TESTS.items()):
125
+ if info.module not in by_category:
126
+ by_category[info.module] = []
127
+ by_category[info.module].append(name)
128
+
129
+ for cat in sorted(by_category.keys()):
130
+ print(f"\n[{cat}]")
131
+ for name in by_category[cat]:
132
+ info = TESTS[name]
133
+ skip_marker = " (skip)" if info.skip else ""
134
+ print(f" {name}{skip_marker}")
135
+ return 0
136
+
137
+ # Run tests
138
+ results = run_tests(
139
+ pattern=args.pattern,
140
+ category=args.category,
141
+ verbose=not args.quiet,
142
+ stop_on_failure=args.stop_on_failure,
143
+ )
144
+
145
+ # In quiet mode, print summary
146
+ if args.quiet:
147
+ status_parts = []
148
+ if results.passed:
149
+ status_parts.append(f"{results.passed} passed")
150
+ if results.failed:
151
+ status_parts.append(f"{results.failed} failed")
152
+ if results.skipped:
153
+ status_parts.append(f"{results.skipped} skipped")
154
+ print(f"Results: {', '.join(status_parts)} ({results.total_time:.2f}s)")
155
+
156
+ if results.failed:
157
+ print("\nFailed tests:")
158
+ for r in results.results:
159
+ if r.status == "failed":
160
+ print(f" {r.name}: {r.error}")
161
+
162
+ return 1 if results.failed > 0 else 0
163
+
164
+ finally:
165
+ # Close database
166
+ idapro.close_database()
167
+
168
+
169
+ if __name__ == "__main__":
170
+ sys.exit(main())
@@ -0,0 +1,405 @@
1
+ Metadata-Version: 2.4
2
+ Name: ida-pro-mcp-xjoker
3
+ Version: 1.0.1
4
+ Summary: Vibe reversing with IDA Pro (enhanced fork)
5
+ Author: mrexodia, can1357, IDA Pro MCP Contributors
6
+ Project-URL: Repository, https://github.com/xjoker/ida-pro-mcp
7
+ Project-URL: Issues, https://github.com/xjoker/ida-pro-mcp/issues
8
+ Keywords: ida,mcp,llm,plugin
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: idapro>=0.0.7
19
+ Requires-Dist: tomli-w>=1.0.0
20
+ Dynamic: license-file
21
+
22
+ # IDA Pro MCP
23
+
24
+ [中文文档](README_zh.md) | English
25
+
26
+ Simple [MCP Server](https://modelcontextprotocol.io/introduction) to allow vibe reversing in IDA Pro.
27
+
28
+ ## Fork Version Updates
29
+
30
+ > This is a fork of [mrexodia/ida-pro-mcp](https://github.com/mrexodia/ida-pro-mcp) with the following enhancements:
31
+
32
+ ### New Features
33
+
34
+ - **Web Configuration Interface** - Access `http://localhost:13337/config.html` for bilingual (English/中文) settings
35
+ - **Server Configuration** - Configure host, port, and API Key authentication via web UI
36
+ - **Auto-start on IDA Launch** - MCP server starts automatically when IDA loads a database
37
+ - **No Keyboard Shortcut Occupation** - Removed all hotkey bindings, menu-only activation
38
+ - **Menu Name Changed** - Plugin menu renamed from "MCP" to "MCP Server"
39
+ - **Server Restart on Config Change** - Server automatically restarts after saving configuration
40
+
41
+ ### API Key Authentication
42
+
43
+ To enable API Key authentication:
44
+
45
+ 1. Open the web configuration at `http://localhost:13337/config.html`
46
+ 2. Check "Enable API Key Authentication"
47
+ 3. Enter your API Key (or use `${ENV_VAR}` to reference an environment variable)
48
+ 4. Save and restart the server
49
+
50
+ **Client Configuration Examples:**
51
+
52
+ ```bash
53
+ # Claude Code - Add MCP server with Bearer token authentication
54
+ claude mcp add --transport http ida-pro-mcp http://192.168.1.100:13337/mcp \
55
+ --header "Authorization: Bearer your-api-key-here"
56
+
57
+ # Or configure in ~/.claude.json manually:
58
+ {
59
+ "mcpServers": {
60
+ "ida-pro-mcp": {
61
+ "type": "http",
62
+ "url": "http://192.168.1.100:13337/mcp",
63
+ "headers": {
64
+ "Authorization": "Bearer your-api-key-here"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### Bug Fixes
72
+
73
+ - Fixed IDA main thread crash when restarting server
74
+ - Fixed walrus operator logic error in type parsing
75
+ - Added regex compilation exception handling
76
+ - Fixed bare `except:` statements
77
+ - Unified default pagination count values
78
+
79
+ ---
80
+
81
+ https://github.com/user-attachments/assets/6ebeaa92-a9db-43fa-b756-eececce2aca0
82
+
83
+ The binaries and prompt for the video are available in the [mcp-reversing-dataset](https://github.com/mrexodia/mcp-reversing-dataset) repository.
84
+
85
+ ## Prerequisites
86
+
87
+ - [Python](https://www.python.org/downloads/) (**3.11 or higher**)
88
+ - Use `idapyswitch` to switch to the newest Python version
89
+ - [IDA Pro](https://hex-rays.com/ida-pro) (8.3 or higher, 9 recommended), **IDA Free is not supported**
90
+ - Supported MCP Client (pick one you like)
91
+ - [Amazon Q Developer CLI](https://aws.amazon.com/q/developer/)
92
+ - [Augment Code](https://www.augmentcode.com/)
93
+ - [Claude](https://claude.ai/download)
94
+ - [Claude Code](https://www.anthropic.com/code)
95
+ - [Cline](https://cline.bot)
96
+ - [Codex](https://github.com/openai/codex)
97
+ - [Copilot CLI](https://docs.github.com/en/copilot)
98
+ - [Crush](https://github.com/charmbracelet/crush)
99
+ - [Cursor](https://cursor.com)
100
+ - [Gemini CLI](https://google-gemini.github.io/gemini-cli/)
101
+ - [Kilo Code](https://www.kilocode.com/)
102
+ - [Kiro](https://kiro.dev/)
103
+ - [LM Studio](https://lmstudio.ai/)
104
+ - [Opencode](https://opencode.ai/)
105
+ - [Qodo Gen](https://www.qodo.ai/)
106
+ - [Qwen Coder](https://qwenlm.github.io/qwen-code-docs/)
107
+ - [Roo Code](https://roocode.com)
108
+ - [Trae](https://trae.ai/)
109
+ - [VS Code](https://code.visualstudio.com/)
110
+ - [VS Code Insiders](https://code.visualstudio.com/insiders)
111
+ - [Warp](https://www.warp.dev/)
112
+ - [Windsurf](https://windsurf.com)
113
+ - [Zed](https://zed.dev/)
114
+ - [Other MCP Clients](https://modelcontextprotocol.io/clients#example-clients): Run `ida-pro-mcp --config` to get the JSON config for your client.
115
+
116
+ ## Installation
117
+
118
+ Install the latest version of the IDA Pro MCP package:
119
+
120
+ ```sh
121
+ pip uninstall ida-pro-mcp
122
+ pip install https://github.com/xjoker/ida-pro-mcp/archive/refs/heads/main.zip
123
+ ```
124
+
125
+ Configure the MCP servers and install the IDA Plugin:
126
+
127
+ ```
128
+ ida-pro-mcp --install
129
+ ```
130
+
131
+ **Important**: Make sure you completely restart IDA and your MCP client for the installation to take effect. Some clients (like Claude) run in the background and need to be quit from the tray icon.
132
+
133
+ https://github.com/user-attachments/assets/65ed3373-a187-4dd5-a807-425dca1d8ee9
134
+
135
+ _Note_: You need to load a binary in IDA before the plugin menu will show up.
136
+
137
+ ## Prompt Engineering
138
+
139
+ LLMs are prone to hallucinations and you need to be specific with your prompting. For reverse engineering the conversion between integers and bytes are especially problematic. Below is a minimal example prompt, feel free to start a discussion or open an issue if you have good results with a different prompt:
140
+
141
+ ```md
142
+ Your task is to analyze a crackme in IDA Pro. You can use the MCP tools to retrieve information. In general use the following strategy:
143
+
144
+ - Inspect the decompilation and add comments with your findings
145
+ - Rename variables to more sensible names
146
+ - Change the variable and argument types if necessary (especially pointer and array types)
147
+ - Change function names to be more descriptive
148
+ - If more details are necessary, disassemble the function and add comments with your findings
149
+ - NEVER convert number bases yourself. Use the `int_convert` MCP tool if needed!
150
+ - Do not attempt brute forcing, derive any solutions purely from the disassembly and simple python scripts
151
+ - Create a report.md with your findings and steps taken at the end
152
+ - When you find a solution, prompt to user for feedback with the password you found
153
+ ```
154
+
155
+ This prompt was just the first experiment, please share if you found ways to improve the output!
156
+
157
+ Another prompt by [@can1357](https://github.com/can1357):
158
+
159
+ ```md
160
+ Your task is to create a complete and comprehensive reverse engineering analysis. Reference AGENTS.md to understand the project goals and ensure the analysis serves our purposes.
161
+
162
+ Use the following systematic methodology:
163
+
164
+ 1. **Decompilation Analysis**
165
+ - Thoroughly inspect the decompiler output
166
+ - Add detailed comments documenting your findings
167
+ - Focus on understanding the actual functionality and purpose of each component (do not rely on old, incorrect comments)
168
+
169
+ 2. **Improve Readability in the Database**
170
+ - Rename variables to sensible, descriptive names
171
+ - Correct variable and argument types where necessary (especially pointers and array types)
172
+ - Update function names to be descriptive of their actual purpose
173
+
174
+ 3. **Deep Dive When Needed**
175
+ - If more details are necessary, examine the disassembly and add comments with findings
176
+ - Document any low-level behaviors that aren't clear from the decompilation alone
177
+ - Use sub-agents to perform detailed analysis
178
+
179
+ 4. **Important Constraints**
180
+ - NEVER convert number bases yourself - use the int_convert MCP tool if needed
181
+ - Use MCP tools to retrieve information as necessary
182
+ - Derive all conclusions from actual analysis, not assumptions
183
+
184
+ 5. **Documentation**
185
+ - Produce comprehensive RE/*.md files with your findings
186
+ - Document the steps taken and methodology used
187
+ - When asked by the user, ensure accuracy over previous analysis file
188
+ - Organize findings in a way that serves the project goals outlined in AGENTS.md or CLAUDE.md
189
+ ```
190
+
191
+ Live stream discussing prompting and showing some real-world malware analysis:
192
+
193
+ [![](https://img.youtube.com/vi/iFxNuk3kxhk/0.jpg)](https://www.youtube.com/watch?v=iFxNuk3kxhk)
194
+
195
+ ## Tips for Enhancing LLM Accuracy
196
+
197
+ Large Language Models (LLMs) are powerful tools, but they can sometimes struggle with complex mathematical calculations or exhibit "hallucinations" (making up facts). Make sure to tell the LLM to use the `int_convert` MCP tool and you might also need [math-mcp](https://github.com/EthanHenrickson/math-mcp) for certain operations.
198
+
199
+ Another thing to keep in mind is that LLMs will not perform well on obfuscated code. Before trying to use an LLM to solve the problem, take a look around the binary and spend some time (automatically) removing the following things:
200
+
201
+ - String encryption
202
+ - Import hashing
203
+ - Control flow flattening
204
+ - Code encryption
205
+ - Anti-decompilation tricks
206
+
207
+ You should also use a tool like Lumina or FLIRT to try and resolve all the open source library code and the C++ STL, this will further improve the accuracy.
208
+
209
+ ## SSE Transport & Headless MCP
210
+
211
+ You can run an SSE server to connect to the user interface like this:
212
+
213
+ ```sh
214
+ uv run ida-pro-mcp --transport http://127.0.0.1:8744/sse
215
+ ```
216
+
217
+ After installing [`idalib`](https://docs.hex-rays.com/user-guide/idalib) you can also run a headless SSE server:
218
+
219
+ ```sh
220
+ uv run idalib-mcp --host 127.0.0.1 --port 8745 path/to/executable
221
+ ```
222
+
223
+ _Note_: The `idalib` feature was contributed by [Willi Ballenthin](https://github.com/williballenthin).
224
+
225
+
226
+ ## MCP Resources
227
+
228
+ **Resources** represent browsable state (read-only data) following MCP's philosophy.
229
+
230
+ **Core IDB State:**
231
+ - `ida://idb/metadata` - IDB file info (path, arch, base, size, hashes)
232
+ - `ida://idb/segments` - Memory segments with permissions
233
+ - `ida://idb/entrypoints` - Entry points (main, TLS callbacks, etc.)
234
+
235
+ **UI State:**
236
+ - `ida://cursor` - Current cursor position and function
237
+ - `ida://selection` - Current selection range
238
+
239
+ **Type Information:**
240
+ - `ida://types` - All local types
241
+ - `ida://structs` - All structures/unions
242
+ - `ida://struct/{name}` - Structure definition with fields
243
+
244
+ **Lookups:**
245
+ - `ida://import/{name}` - Import details by name
246
+ - `ida://export/{name}` - Export details by name
247
+ - `ida://xrefs/from/{addr}` - Cross-references from address
248
+
249
+ ## Core Functions
250
+
251
+ - `lookup_funcs(queries)`: Get function(s) by address or name (auto-detects, accepts list or comma-separated string).
252
+ - `int_convert(inputs)`: Convert numbers to different formats (decimal, hex, bytes, ASCII, binary).
253
+ - `list_funcs(queries)`: List functions (paginated, filtered).
254
+ - `list_globals(queries)`: List global variables (paginated, filtered).
255
+ - `imports(offset, count)`: List all imported symbols with module names (paginated).
256
+ - `decompile(addr)`: Decompile function at the given address.
257
+ - `disasm(addr)`: Disassemble function with full details (arguments, stack frame, etc).
258
+ - `xrefs_to(addrs)`: Get all cross-references to address(es).
259
+ - `xrefs_to_field(queries)`: Get cross-references to specific struct field(s).
260
+ - `callees(addrs)`: Get functions called by function(s) at address(es).
261
+
262
+ ## Modification Operations
263
+
264
+ - `set_comments(items)`: Set comments at address(es) in both disassembly and decompiler views.
265
+ - `patch_asm(items)`: Patch assembly instructions at address(es).
266
+ - `declare_type(decls)`: Declare C type(s) in the local type library.
267
+
268
+ ## Memory Reading Operations
269
+
270
+ - `get_bytes(addrs)`: Read raw bytes at address(es).
271
+ - `get_int(queries)`: Read integer values using ty (i8/u64/i16le/i16be/etc).
272
+ - `get_string(addrs)`: Read null-terminated string(s).
273
+ - `get_global_value(queries)`: Read global variable value(s) by address or name (auto-detects, compile-time values).
274
+
275
+ ## Stack Frame Operations
276
+
277
+ - `stack_frame(addrs)`: Get stack frame variables for function(s).
278
+ - `declare_stack(items)`: Create stack variable(s) at specified offset(s).
279
+ - `delete_stack(items)`: Delete stack variable(s) by name.
280
+
281
+ ## Structure Operations
282
+
283
+ - `read_struct(queries)`: Read structure field values at specific address(es).
284
+ - `search_structs(filter)`: Search structures by name pattern.
285
+
286
+ ## Debugger Operations (Extension)
287
+
288
+ Debugger tools are hidden by default. Enable with `?ext=dbg` query parameter:
289
+
290
+ ```
291
+ http://127.0.0.1:13337/mcp?ext=dbg
292
+ ```
293
+
294
+ **Control:**
295
+ - `dbg_start()`: Start debugger process.
296
+ - `dbg_exit()`: Exit debugger process.
297
+ - `dbg_continue()`: Continue execution.
298
+ - `dbg_run_to(addr)`: Run to address.
299
+ - `dbg_step_into()`: Step into instruction.
300
+ - `dbg_step_over()`: Step over instruction.
301
+
302
+ **Breakpoints:**
303
+ - `dbg_bps()`: List all breakpoints.
304
+ - `dbg_add_bp(addrs)`: Add breakpoint(s).
305
+ - `dbg_delete_bp(addrs)`: Delete breakpoint(s).
306
+ - `dbg_toggle_bp(items)`: Enable/disable breakpoint(s).
307
+
308
+ **Registers:**
309
+ - `dbg_regs()`: All registers, current thread.
310
+ - `dbg_regs_all()`: All registers, all threads.
311
+ - `dbg_regs_remote(tids)`: All registers, specific thread(s).
312
+ - `dbg_gpregs()`: GP registers, current thread.
313
+ - `dbg_gpregs_remote(tids)`: GP registers, specific thread(s).
314
+ - `dbg_regs_named(names)`: Named registers, current thread.
315
+ - `dbg_regs_named_remote(tid, names)`: Named registers, specific thread.
316
+
317
+ **Stack & Memory:**
318
+ - `dbg_stacktrace()`: Call stack with module/symbol info.
319
+ - `dbg_read(regions)`: Read memory from debugged process.
320
+ - `dbg_write(regions)`: Write memory to debugged process.
321
+
322
+ ## Advanced Analysis Operations
323
+
324
+ - `py_eval(code)`: Execute arbitrary Python code in IDA context (returns dict with result/stdout/stderr, supports Jupyter-style evaluation).
325
+ - `analyze_funcs(addrs)`: Comprehensive function analysis (decompilation, assembly, xrefs, callees, callers, strings, constants, basic blocks).
326
+
327
+ ## Pattern Matching & Search
328
+
329
+ - `find_regex(queries)`: Search strings with case-insensitive regex (paginated).
330
+ - `find_bytes(patterns, limit=1000, offset=0)`: Find byte pattern(s) in binary (e.g., "48 8B ?? ??"). Max limit: 10000.
331
+ - `find_insns(sequences, limit=1000, offset=0)`: Find instruction sequence(s) in code. Max limit: 10000.
332
+ - `find(type, targets, limit=1000, offset=0)`: Advanced search (immediate values, strings, data/code references). Max limit: 10000.
333
+
334
+ ## Control Flow Analysis
335
+
336
+ - `basic_blocks(addrs)`: Get basic blocks with successors and predecessors.
337
+
338
+ ## Type Operations
339
+
340
+ - `set_type(edits)`: Apply type(s) to functions, globals, locals, or stack variables.
341
+ - `infer_types(addrs)`: Infer types at address(es) using Hex-Rays or heuristics.
342
+
343
+ ## Export Operations
344
+
345
+ - `export_funcs(addrs, format)`: Export function(s) in specified format (json, c_header, or prototypes).
346
+
347
+ ## Graph Operations
348
+
349
+ - `callgraph(roots, max_depth)`: Build call graph from root function(s) with configurable depth.
350
+
351
+ ## Batch Operations
352
+
353
+ - `rename(batch)`: Unified batch rename operation for functions, globals, locals, and stack variables (accepts dict with optional `func`, `data`, `local`, `stack` keys).
354
+ - `patch(patches)`: Patch multiple byte sequences at once.
355
+ - `put_int(items)`: Write integer values using ty (i8/u64/i16le/i16be/etc).
356
+
357
+ **Key Features:**
358
+
359
+ - **Type-safe API**: All functions use strongly-typed parameters with TypedDict schemas for better IDE support and LLM structured outputs
360
+ - **Batch-first design**: Most operations accept both single items and lists
361
+ - **Consistent error handling**: All batch operations return `[{..., error: null|string}, ...]`
362
+ - **Cursor-based pagination**: Search functions return `cursor: {next: offset}` or `{done: true}` (default limit: 1000, enforced max: 10000 to prevent token overflow)
363
+ - **Performance**: Strings are cached with MD5-based invalidation to avoid repeated `build_strlist` calls in large projects
364
+
365
+ ## Comparison with other MCP servers
366
+
367
+ There are a few IDA Pro MCP servers floating around, but I created my own for a few reasons:
368
+
369
+ 1. Installation should be fully automated.
370
+ 2. The architecture of other plugins make it difficult to add new functionality quickly (too much boilerplate of unnecessary dependencies).
371
+ 3. Learning new technologies is fun!
372
+
373
+ If you want to check them out, here is a list (in the order I discovered them):
374
+
375
+ - https://github.com/taida957789/ida-mcp-server-plugin (SSE protocol only, requires installing dependencies in IDAPython).
376
+ - https://github.com/fdrechsler/mcp-server-idapro (MCP Server in TypeScript, excessive boilerplate required to add new functionality).
377
+ - https://github.com/MxIris-Reverse-Engineering/ida-mcp-server (custom socket protocol, boilerplate).
378
+
379
+ Feel free to open a PR to add your IDA Pro MCP server here.
380
+
381
+ ## Development
382
+
383
+ Adding new features is a super easy and streamlined process. All you have to do is add a new `@tool` function to the modular API files in `src/ida_pro_mcp/ida_mcp/api_*.py` and your function will be available in the MCP server without any additional boilerplate! Below is a video where I add the `get_metadata` function in less than 2 minutes (including testing):
384
+
385
+ https://github.com/user-attachments/assets/951de823-88ea-4235-adcb-9257e316ae64
386
+
387
+ To test the MCP server itself:
388
+
389
+ ```sh
390
+ npx -y @modelcontextprotocol/inspector
391
+ ```
392
+
393
+ This will open a web interface at http://localhost:5173 and allow you to interact with the MCP tools for testing.
394
+
395
+ For testing I create a symbolic link to the IDA plugin and then POST a JSON-RPC request directly to `http://localhost:13337/mcp`. After [enabling symbolic links](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) you can run the following command:
396
+
397
+ ```sh
398
+ uv run ida-pro-mcp --install
399
+ ```
400
+
401
+ Generate the changelog of direct commits to `main`:
402
+
403
+ ```sh
404
+ git log --first-parent --no-merges 1.2.0..main "--pretty=- %s"
405
+ ```
@@ -0,0 +1,45 @@
1
+ ida_pro_mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ ida_pro_mcp/__main__.py,sha256=OgGb-aPI4F2DJSaU1I-R-OpN_rZfs0hSnMgTo0CPg0o,124
3
+ ida_pro_mcp/ida_mcp.py,sha256=-yUE4Ss8jVg1tKZjmXsWLhrQVJsFUpZ5Mc6KxOeOyyM,6982
4
+ ida_pro_mcp/idalib_server.py,sha256=fuWVMjooZegKSl87Ldjg1zsRdDETyGLaSEy1rOoHfhY,11375
5
+ ida_pro_mcp/idalib_session_manager.py,sha256=UEs0aZODEUOcWDiSRsUx8s9QfdJ-5p8PiTPpBitQUrc,8518
6
+ ida_pro_mcp/server.py,sha256=AmpktGyT6yEZK03YoUkUHePshWslSoCpTwYRuGLhKoY,35849
7
+ ida_pro_mcp/test.py,sha256=qqBnhhUkRYrL6cYdlGAMa6oN7wTvVrwzYLxzNez6jno,5023
8
+ ida_pro_mcp/ida_mcp/__init__.py,sha256=92N8Ksbj7fDp5Z06M_bvdNw2BWaawmv-dyH52HBAxw0,1809
9
+ ida_pro_mcp/ida_mcp/api_analysis.py,sha256=vx3hpLIpldALao3fyJYrjYVTR0rdFnG1IXg_XXLkjcw,42328
10
+ ida_pro_mcp/ida_mcp/api_core.py,sha256=7j-98-8YTjrmQhtWCAFcR-f5h9g4GJM39DsRY7Il6mI,9291
11
+ ida_pro_mcp/ida_mcp/api_debug.py,sha256=WJKyizs06VQahFM4VWyoa6DXal-9f5JfkMj5Ji46UKw,16027
12
+ ida_pro_mcp/ida_mcp/api_memory.py,sha256=HJ0Ut4jYQXKJJK9_h4ZL0yN-Mg1fCH9Blhn_gABoe8E,8968
13
+ ida_pro_mcp/ida_mcp/api_modify.py,sha256=NEokHC_ZLvtYTtx1CSi0ZjSr9O75OlHzSWkEEwqTw_o,14390
14
+ ida_pro_mcp/ida_mcp/api_python.py,sha256=44PEMHNhJMdU4vK6yZ4CPAJbHkR5V-tNlDoTb2r7xcY,6487
15
+ ida_pro_mcp/ida_mcp/api_resources.py,sha256=3vhLHNvv3poT1vneNaAfXco7x8xJnS2a8BMS7F2CfG0,8559
16
+ ida_pro_mcp/ida_mcp/api_stack.py,sha256=HfspQ9HnrjnWqWWIlwTT-aiti2FyKOUtD6zRCULo6Q0,5050
17
+ ida_pro_mcp/ida_mcp/api_types.py,sha256=Dz5O0S8uDhrOf0eoOUtbd_BMzPRZqORrWwonWil0saM,16426
18
+ ida_pro_mcp/ida_mcp/auth.py,sha256=ghpnbMAMOahvbpu33PDoxlyC_zQlU6iPR78HVGmyHXE,4553
19
+ ida_pro_mcp/ida_mcp/cache.py,sha256=t6DJEydv60dXAHkcCqdfAuD4a7kPrif9KZw3pLIle9Q,6837
20
+ ida_pro_mcp/ida_mcp/config.py,sha256=WTLcKTo7Wi2Ll6uwzyWq7hPV8Sj9MnaQjtEnltAmmFk,6636
21
+ ida_pro_mcp/ida_mcp/framework.py,sha256=k88c366JS4lQ7uIkVXPmlCMIWH7O9sr0Iw43aWJ9P5M,15976
22
+ ida_pro_mcp/ida_mcp/http.py,sha256=PNFC31TCu19_WWUMJS2h-bY2Oxb1qh-fl5T0Bag0uis,27064
23
+ ida_pro_mcp/ida_mcp/port_utils.py,sha256=zn3TNSdRsEzmsqOEnC4dOt8ZDUD85D1lXTVKOXzsbqs,3053
24
+ ida_pro_mcp/ida_mcp/rpc.py,sha256=G0xRdmKehWq5JKlyE0gT7xmzdZ5YyfkEMH5cK9DNhrk,5079
25
+ ida_pro_mcp/ida_mcp/server_manager.py,sha256=4hbTu_FmUNl_8oTcvoPUKKxpWaHYfew96rVl9sD2zk0,10835
26
+ ida_pro_mcp/ida_mcp/sync.py,sha256=11EHzmALHwFIMo46tMtxpGyE0KIFyAf4WO49KjJPjzE,6823
27
+ ida_pro_mcp/ida_mcp/ui.py,sha256=_L0vVPC-yyffBdtWNfndmSGkUNt6_83GhUPFYX-n41U,11204
28
+ ida_pro_mcp/ida_mcp/utils.py,sha256=k2fkCtJAn9kQnfAaxcgxqtINHxiGTRDLbO3eN6oD_iA,34413
29
+ ida_pro_mcp/ida_mcp/tests/__init__.py,sha256=-it_7Hb45krMiA5wTrylCA5vuOaTFoqY1Z4Y9jXAN7U,447
30
+ ida_pro_mcp/ida_mcp/tests/test_api_analysis.py,sha256=5pe1qO8crvdYYuN7Tw8UEiH_FIc9pcC3rgRvSCqUqpc,8751
31
+ ida_pro_mcp/ida_mcp/tests/test_api_core.py,sha256=uOh6C-UHIgrf_ZmK-lbmz5V_cXv5LsX0VDe7rgufMZM,7078
32
+ ida_pro_mcp/ida_mcp/tests/test_api_memory.py,sha256=hNp986HaPISJK5GldRGYYk6KZj01in3SLOJ_YX981z0,5376
33
+ ida_pro_mcp/ida_mcp/tests/test_api_modify.py,sha256=oV3XPzf_0E5_krDhCL7nyX7uW55ZEhYP3d5Yj4261c8,3403
34
+ ida_pro_mcp/ida_mcp/tests/test_api_resources.py,sha256=ePkAuyrIhT6xHHP25lLZ2JlchEzHWMPMmiHFRBCyAt8,5749
35
+ ida_pro_mcp/ida_mcp/tests/test_api_stack.py,sha256=8RHMQ0oNoVK5-i0Qo7_8iQ1HGok51g9H9STkRl0jgrs,2081
36
+ ida_pro_mcp/ida_mcp/tests/test_api_types.py,sha256=LvXwfEc7P-ujWNO7LuNeVvNCbw6YJU-94xbEtpo94l0,7359
37
+ ida_pro_mcp/ida_mcp/zeromcp/__init__.py,sha256=0wEXEn4fm9TtrM5saxTJ2ZORdvTRCQSXtN4GXBvhwCw,201
38
+ ida_pro_mcp/ida_mcp/zeromcp/jsonrpc.py,sha256=U4klLVBp_mEh-lnRq5QWPkSxqtKc2J0C-i1hbxQgtIo,14836
39
+ ida_pro_mcp/ida_mcp/zeromcp/mcp.py,sha256=7l4DT0ONcDOnSK78Mi5mKMF1_FOiVzj2TiOKvTTBy_k,31215
40
+ ida_pro_mcp_xjoker-1.0.1.dist-info/licenses/LICENSE,sha256=7n59GIbEpWe6O3oNiKuqrFfnv-7kQCokhy7_p4ora24,1071
41
+ ida_pro_mcp_xjoker-1.0.1.dist-info/METADATA,sha256=YDWlDVVax5I6DsrqIdattsvRO5UnPlwbgkRf-5wHTRw,17424
42
+ ida_pro_mcp_xjoker-1.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
43
+ ida_pro_mcp_xjoker-1.0.1.dist-info/entry_points.txt,sha256=pJ_B_cB3hROec234fBV1ypw1kIz4edLRrk3OLOZbjug,137
44
+ ida_pro_mcp_xjoker-1.0.1.dist-info/top_level.txt,sha256=EN_FyE128OksP65oLV_fL3VU618sjUD9yLSMaOES0Ug,12
45
+ ida_pro_mcp_xjoker-1.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ ida-mcp-test = ida_pro_mcp.test:main
3
+ ida-pro-mcp = ida_pro_mcp.server:main
4
+ idalib-mcp = ida_pro_mcp.idalib_server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Duncan Ogilvie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ ida_pro_mcp