Skip to content

[mlir-python-mcp] Add MCP server for programmatic MLIR manipulation#443

Open
makslevental wants to merge 1 commit into
mainfrom
users/makslevental/mlir-python-mcp
Open

[mlir-python-mcp] Add MCP server for programmatic MLIR manipulation#443
makslevental wants to merge 1 commit into
mainfrom
users/makslevental/mlir-python-mcp

Conversation

@makslevental

Copy link
Copy Markdown
Contributor

A pip-installable MCP server that provides Claude with programmatic access to the MLIR Python bindings via a persistent REPL.

Tools (29 total):

  • Core REPL: execute_python, list_variables, session management
  • Pipeline workflow: run_pipeline, chain_pipeline, rewind, history
  • Discovery: list_dialects, list_ops, list_ir_apis, list_rewrite_apis, list_passes
  • IR manipulation: parse_mlir, walk_operations, inspect_op, get_op_info, create_func, symbol_lookup, verify_module, clone_module, replace_all_uses, erase_op, load/save_mlir_file

Key features:

  • Pre-loaded namespace with all dialect builders (arith, func, scf, linalg, etc.)
  • Pipeline fluent builder with auto-generated methods for every registered pass
  • help()/dir() discovery for ops, types, and passes
  • 114 tests, 100% branch coverage via pytest-cov
  • CI integration in build_mlir_python_bindings_wheel.yml

Also updates eudsl-python-extras passes.py (regenerated).

This is the spicier version of the upstream RFC because it lets the agent execute_python to construct and manipulate the MLIR module. See README.md for more info.

A pip-installable MCP server (mlir-python-mcp) that provides Claude with
programmatic access to the MLIR Python bindings via a persistent REPL.

Tools (29 total):
- Core REPL: execute_python, list_variables, session management
- Pipeline workflow: run_pipeline, chain_pipeline, rewind, history
- Discovery: list_dialects, list_ops, list_ir_apis, list_rewrite_apis, list_passes
- IR manipulation: parse_mlir, walk_operations, inspect_op, get_op_info,
  create_func, symbol_lookup, verify_module, clone_module, replace_all_uses,
  erase_op, load/save_mlir_file

Key features:
- Pre-loaded namespace with all dialect builders (arith, func, scf, linalg, etc.)
- Pipeline fluent builder with auto-generated methods for every registered pass
- help()/dir() discovery for ops, types, and passes
- 114 tests, 100% branch coverage via pytest-cov
- CI integration in build_mlir_python_bindings_wheel.yml

Also updates eudsl-python-extras passes.py (regenerated).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@makslevental makslevental force-pushed the users/makslevental/mlir-python-mcp branch from 9d3f5eb to fc83873 Compare June 15, 2026 07:14
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