Get the FREE Ultimate OpenClaw Setup Guide →

tkinter

A Model Context Protocol (MCP) server that enables AI agents (like Claude) to view, introspect, and control Tkinter GUIs. Features widget-tree extraction and window-specific screenshots.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio tctibbs-tkinter-mcp-server python -m tkinter_mcp_server

How to use

The tkinter MCP server enables AI agents to launch, inspect, and automate Tkinter GUI applications. It injects an inspection agent via monkey-patching so you can remotely query the widget tree, capture screenshots, interact with widgets (clicks, text input, focus changes), and retrieve or modify values from various Tkinter controls. Tools available include: launch_app to start a Tkinter app with inspection enabled, get_ui_layout to retrieve the full widget hierarchy as JSON, view_application to capture high-quality screenshots, click_widget to simulate mouse interactions on specific widgets, type_text to input text into Entry or Text widgets, and get_widget_value / set_widget_value to read or modify widget state. The server communicates over a local socket to keep interactions thread-safe, enabling reliable automation of GUI tasks.

How to install

Prerequisites:

  • Python 3.10 or newer
  • Access to a shell/terminal

Install the Tkinter MCP server package from PyPI and register the MCP server:

# Install the server package
pip install tkinter-mcp-server

(Optional) If you plan to use Claude or another controller, add the MCP server to Claude's configuration as shown in the README:

claude mcp add tkinter-mcp-server -- tkinter-mcp-server

If you prefer UVX (Python/uv) for running the server in certain environments, you can adapt to your setup using the UVX flow and environment as needed:

# Example UVX usage if you use uvx to run Python packages
uvx tkinter-mcp-server

Verify installation by starting the server locally (adjust command as needed by your environment) and ensure the server is reachable by the MCP client.

Additional notes

Notes:

  • Some PIL/ImageTk-based Tkinter apps may have compatibility caveats with certain runtimes; if you encounter image-related issues, consider using the recommended PIL-related options or running under a compatible Python environment.
  • The server patches Tkinter at runtime to inject an inspection agent; ensure you’re using trusted apps to avoid security risks associated with monkey-patching.
  • If you’re on macOS, Windows, or Linux, ensure your environment supports socket-based IPC used by the MCP server for reliable communication.
  • If you encounter networking or socket binding problems, verify that no other process is occupying the local IPC port used by the MCP server.
  • Environment variables can be used to customize behavior (e.g., enabling verbose logs). If you need guidance on specific env vars, consult the project docs or source for supported options.

Related MCP Servers

Sponsor this space

Reach thousands of developers