Skip to content

feat: Add MCP Server for AI Agent integration#1647

Open
lxcxjxhx wants to merge 1 commit into
qilingframework:masterfrom
lxcxjxhx:add-mcp-server
Open

feat: Add MCP Server for AI Agent integration#1647
lxcxjxhx wants to merge 1 commit into
qilingframework:masterfrom
lxcxjxhx:add-mcp-server

Conversation

@lxcxjxhx

@lxcxjxhx lxcxjxhx commented Jul 8, 2026

Copy link
Copy Markdown

Summary

This PR adds a Model Context Protocol (MCP) Server implementation for Qiling Framework, enabling AI Agents to programmatically interact with the binary emulation framework.

Changes

New Files

  • qiling/mcp/init.py: Module entry point
  • qiling/mcp/models.py: Data models for structured JSON output
  • qiling/mcp/tools.py: 12 MCP tool implementations
  • qiling/mcp/server.py: MCP server with stdio/SSE/HTTP transport support
  • qiling/mcp/test_server.py: Comprehensive test suite
  • qiling/mcp/README.md: Complete documentation

MCP Tools (12 total)

Binary Management:

  • load_binary: Load and initialize binary for emulation
  • get_state: Get current emulation state

Memory Operations:

  • read_memory: Read memory contents
  • write_memory: Write to memory
  • get_memory_map: Query memory map

Register Operations:

  • get_registers: Get all register values
  • set_registers: Set register values

Execution Control:

  • start_emulation: Start binary emulation
  • stop_emulation: Stop emulation

Hook Management:

  • set_hook: Set execution hooks
  • list_hooks: List active hooks
  • remove_hook: Remove hooks

Features

  • Multiple Transport Support: stdio, SSE, HTTP
  • Structured JSON Output: All tools return well-defined JSON responses
  • Context Management: Global state management for emulation sessions
  • Test Coverage: Complete test suite with mocks
  • Documentation: Comprehensive README with examples

Use Cases

  1. CTF Challenge Analysis: AI Agents can load and analyze CTF binaries
  2. Malware Analysis: Safe emulation of suspicious binaries
  3. Exploit Development: Test and debug exploits in controlled environment
  4. Binary Reverse Engineering: Automated analysis of binary behavior
  5. Security Research: Programmatic binary analysis at scale

Testing

All tools have been tested with comprehensive test suite:

pytest qiling/mcp/test_server.py -v

Implementation Details

  • Based on real Qiling Framework API analysis
  • Uses actual Qiling internal APIs (Qiling, QlMemoryManager, etc.)
  • Follows MCP specification (JSON-RPC 2.0)
  • Compatible with Qiling 2.0+

Related Issues

This implementation addresses the need for AI Agent integration with Qiling Framework, enabling programmatic binary analysis and emulation control.

- Implement 12 MCP tools for binary emulation control
- Support stdio/SSE/HTTP transport
- Add comprehensive test suite
- Include detailed documentation
@wtdcode

wtdcode commented Jul 8, 2026

Copy link
Copy Markdown
Member

I would prefer to leave this outside the main repo of Qiling, like: https://github.com/drvcvt/emulation-mcp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants