sublime-mcp
This MCP server lets an AI agent inspect and control a running Sublime Text instance through typed MCP tools, including arbitrary Python execution.
Read active/open files, view content and character ranges, selections, cursor context, symbols, output panels, bookmarks, encodings, and syntaxes.
Edit files and views: replace selections/lines, insert snippets, duplicate/sort/comment/fold/select lines, undo/redo, save/revert/close files.
Navigate and search: open files, go to line, find in the active file or across project folders, and look up symbols across open files.
Work with projects: inspect project data/folders, add/remove folders, read build variables, and inspect/set window layout.
Run Sublime Text commands and builds, inspect command palette entries, menus, and runnable commands, and manage settings, status, syntax, encoding, panels, and sidebar.
Send text to open views (including Terminus terminals) and inspect view phantoms.
Execute arbitrary Python in Sublime Text's main thread via
eval_pythonfor anything not covered by the typed tools.
Controls a running Sublime Text 4 instance, providing tools for reading and editing files, navigating, searching, building, managing settings and layout, and executing Python scripts through a local HTTP bridge.
Sublime-MCP: Universal AI Agent Connector for Sublime Text
Gives any MCP-speaking AI agent real control over a running Sublime Text 4
instance: run registered ST commands, read/write views and selections, inspect
tabs and project state, and eval_python in Sublime's plugin host for anything
the typed tools don't cover.
Controlling another installed Sublime package (a debugger, a language server,
anything else) doesn't need its own dedicated MCP server — get_package_mcp_info
plus eval_python/run_command covers it directly. See skills/package-skill-generator
to turn a one-time investigation into a small, reusable skill file instead.
Toolset
Eight workflow tools are advertised by default (discover_tools, batch,
get_help, get_active_file, project_search, save_file,
str_replace_based_edit_tool, ui_screenshot). discover_tools lists a tree of
categories (category=) or searches (query=) the
complete internal catalog of 379 typed Sublime capabilities, and batch invokes
discovered capabilities without flooding the model's initial tool context.
Since 1.9.0, 160 of those tools are generated wrappers named after Sublime Text's
own commands (tools/generate_st_command_tools.py, data in
tools/st_commands_metadata.json); what each was observed to do on a bare
Sublime Text 4215 is in tools/st_commands_behavior.json, and the hand-written
tools' behaviour is in tools/st_hand_written_behavior.json. Since 1.10.0,
list_native_windows and dismiss_native_window (Windows) list and dismiss a
native dialog or menu while it blocks Sublime's main thread. See
AGENT_GUIDE.md.
What it can do now (1.10 to 1.13)
See and operate Sublime's own windows (Windows only, 1.13).
ui_screenshotreturns a real image of any Sublime window, also one behind others, an open dialog or menu (kind,window_title), a not-front tab (tab), cropped or zoomed (region,scale,max_width); it is one of the eight default tools, and the image reaches the client as an image, also throughbatchand the proxies.ui_press_key,ui_type_text,ui_clickandui_hover(with a picture of the popup, including language-server hovers) operate palettes, quick panels and menus. Real mouse and keys wait until the person at the computer has been idle (wait_idle_s), so they never type over them.Work through native dialogs (1.10, 1.12.4).
list_native_windowsanddismiss_native_windowlist and dismiss a dialog or menu that has blocked Sublime's main thread;close_filewithdiscardcloses a tab with unsaved edits without the Save Changes dialog.Drive quick panels and menus (1.12).
get_quick_panel,pick_quick_panel(withwait_msfor a list that is still loading) andclick_menu_item;get_view_regionsandget_view_phantoms(withlast,html,max_chars) inspect what a plugin drew. Panels of older Python 3.3 packages are visible with"install_py33_helper": true(1.16, off by default); a pick whose callback opens a dialog answerspending(1.16.1) and the dialog is answered withdismiss_native_window.Dialogs and tabs (1.18).
list_native_windowsreads the message of a Windows task dialog (Package Control's "needs to be restarted" text) and answers while a dialog blocks Sublime;dismiss_native_windowclicks again if the first click is dropped and can cancel the Windows file-operation progress window.close_fileneeds apath,nameorindexand never closes the active tab. Theinstall_packageandsearch_packagestools are gone: installing and searching are Package Control's job, so drive its own picker withrun_commandandpick_quick_panel.Share one Sublime between agents (1.12.0).
claim_resource,release_resourceandlist_claimslet agents take turns on the input and control panels.Safer by default. Browser-origin requests are refused (1.12.2), the visible-console read only touches Sublime's own window and restores focus and clipboard (1.12.1),
eval_pythoncannot take down the plugin host withsys.exit()(1.12.3), and Windows-only tools are hidden on other platforms (1.11.2).A tool tree (1.11).
discover_toolswith no arguments walks 12 categories instead of dumping a catalog.
Agent how-to: AGENT_GUIDE.md (also served live by
get_help). Release history: CHANGELOG.md.
Related MCP server: OpenSpec MCP Server
Ports
sublime-mcp serves MCP streamable HTTP at /mcp, legacy MCP SSE at
/sse, and a plain HTTP bridge.
The bundled Node/Python proxies use sublime-mcp's HTTP bridge only. Defaults:
Plugin | MCP SSE | HTTP bridge | Settings file |
sublime-mcp | 9502 (Win) / 9503 (macOS/Linux) | 9500 (Win) / 9501 (macOS/Linux) |
|
The settings file takes "mcp_port" and "http_port" keys; edit your copy
under Packages/User/ (Preferences > Package Settings) to override the
defaults above — no env vars needed.
SSE URL form: http://127.0.0.1:<sse-port>/sse. The bundled Node/Python
proxies talk to sublime-mcp's HTTP bridge, not SSE; override with
SUBLIME_MCP_BASE (e.g. http://127.0.0.1:9500).
Security
Both servers are loopback-only (127.0.0.1) by default and have no
authentication — one of the tools they expose (eval_python) is
arbitrary code execution in Sublime's own process, so treat this server
as equivalent in trust level to your own login session. All of the
following are keys in MCP Commander.sublime-settings:
allow_lan_access(defaultfalse) — binds0.0.0.0instead of127.0.0.1, making both servers reachable from every other device on your network, still with no authentication. Only turn this on for a specific reason a client can't reach127.0.0.1directly (e.g. a WSL client when WSL's networking mode doesn't forward localhost to the Windows host).auth_token(default unset) — requires a matchingAuthorization: Bearer <token>header on every request. This is the one control that works regardless of bind address, since loopback-only doesn't protect against another process, or another user on a shared/multi-user machine, reaching127.0.0.1on the same host. Generate a real random value yourself; don't use a short or guessable string. Not every MCP client UI exposes custom headers — check yours supports one before relying on this. If you connect through the bundled Node/Python proxy instead of a direct SSE/HTTP URL, set the same value asSUBLIME_MCP_TOKENin the proxy process's environment.disabled_tools(default[]) — a list of tool names to refuse and hide from discovery entirely, e.g.["eval_python", "run_command"]to remove the two tools with the broadest reach while keeping the rest of the server usable.
Browsers are kept out in two ways. The real tool-call endpoints send no
Access-Control-Allow-Origin header, and, because a missing CORS header does
not stop a request from being sent, with no auth_token and the default
loopback bind they also refuse any request whose Origin or Host header
names something other than loopback (including Origin: null). Command-line and desktop MCP clients send no Origin and are
not affected. This does not protect against another process on the same
machine: set auth_token for that.
Installation
1. Install the Sublime Text plugin
Manual (also the path for developing sublime-mcp itself):
git clone https://github.com/dpc00/sublime-mcp.git
cd sublime-mcpThe repo root is the package. Symlink it into ST's Packages/ directory as sublime-mcp.
Windows (Command Prompt):
mklink /J "%APPDATA%\Sublime Text\Packages\sublime-mcp" "C:\path\to\sublime-mcp"macOS:
ln -s "$(pwd)" "$HOME/Library/Application Support/Sublime Text/Packages/sublime-mcp"Linux:
ln -s "$(pwd)" "$HOME/.config/sublime-text/Packages/sublime-mcp"Restart Sublime Text after linking so the plugin loads.
2. Configure your agent
Point your agent straight at the server the plugin starts inside Sublime Text.
No helper program is needed. Use the streamable-HTTP URL if your client
supports it (Codex example; no mcp-remote wrapper is required):
[mcp_servers.sublime-mcp]
type = "http"
url = "http://127.0.0.1:9502/mcp"Optional proxies. Only for clients that cannot connect to a URL directly, a small Node or Python proxy can sit in between:
cd packages/node-proxy && npm install . && npx sublime-mcp # Node
cd packages/python-proxy && pip install . && sublime-mcp # PythonRestart or open a new Codex session after changing MCP configuration. Verify the entire path before debugging agent behavior:
npx sublime-mcp doctorThe report checks the HTTP bridge, MCP handshake, and focused tool catalog.
From Sublime's Command Palette, MCP Commander: Connection Doctor shows the
main server-side state. (Controlling a debugger or language server doesn't
need its own MCP server or doctor check — see "Toolset" above and
skills/package-skill-generator.)
Other MCP clients that take a JSON config (oh-my-pi, Claude Code, Cursor) use the same streamable-HTTP URL (Windows example):
{
"mcpServers": {
"sublime-mcp": { "type": "http", "url": "http://127.0.0.1:9502/mcp" }
}
}Only a client that cannot do streamable HTTP needs the deprecated SSE URL,
"type": "sse" with http://127.0.0.1:9502/sse.
The MCP server starts automatically when ST loads the plugin. To stop or restart it, run "MCP Commander: Server Status" from the Command Palette. Check View > Show Console for startup confirmation.
Agent skill
Two skills ship with sublime-mcp: skills/sublime-mcp (how an agent uses the
tools) and skills/package-skill-generator (how to generate a small skill for
any Sublime package you use, such as a language server or a debugger). Copy the
directories to your agent's skills directory or install them through your normal
skill workflow. Skills for individual packages are not shipped: generate your own
with the generator.
Available Tools
59 toolsadd_folderC
Add a folder to the current project.
Inputs: path (required).
close_fileA
Close a file by path, or close the active file if path is omitted.
Inputs: path.
duplicate_lineA
Duplicate the current line(s) in the active file.
Inputs: no named parameters.
eval_pythonA
Execute arbitrary Python in Sublime Text's main thread. Locals: sublime, window, view, print. Returns captured stdout in 'output'.
Inputs: code (required).
find_in_fileA
Find all occurrences of pattern in the active file. Returns list of {line, col, text}.
Inputs: pattern (required), case_sensitive, regex.
find_in_filesC
Search for pattern across project folders (or the supplied folder list). Skips .git, pycache, node_modules, .venv. Returns list of {path, line, match}.
Inputs: pattern (required), folders, case_sensitive, regex, +1 more.
focus_groupA
Move focus to a pane group by 0-based index.
Inputs: group (required).
fold_linesB
Fold (collapse) lines begin through end (1-based) in the active file.
Inputs: begin (required), end (required).
get_active_fileA
Return the active file's path, full content, cursor line/col, dirty flag, and syntax name.
Inputs: no named parameters.
get_active_panelA
Return the active panel id and, if it is an output panel, its content.
Inputs: no named parameters.
get_bookmarksA
Return all bookmarked positions in the active file.
Inputs: no named parameters.
get_command_paletteA
List Command Palette entries from installed *.sublime-commands resources. Optional filters: package, command id, or caption substring.
Inputs: package, command, caption.
get_commandsA
List runnable Sublime command ids from loaded command classes, optionally enriched with matching Command Palette entries from installed packages.
Inputs: package, command, include_palette.
get_cursor_contextA
Return lines lines above and below the cursor with 1-based line numbers prepended.
Inputs: lines.
get_encodingA
Return the character encoding of the active file.
Inputs: no named parameters.
get_file_contentB
Return the full content of an already-open file by its path.
Inputs: path (required).
get_layoutA
Return the current window layout (groups, cells) and which files are in each group.
Inputs: no named parameters.
get_line_countA
Return the total number of lines in the active file.
Inputs: no named parameters.
get_open_filesA
List all files open in the current window (path, name, is_dirty).
Inputs: no named parameters.
get_output_panelA
Return the text content of an output panel. If name is omitted, read the active output panel. Use name='exec' for build output.
Inputs: name.
get_project_dataA
Return the raw .sublime-project JSON data for the current project.
Inputs: no named parameters.
get_project_foldersB
Return the project's root folder paths.
Inputs: no named parameters.
get_scope_at_cursorA
Return the full syntax scope string at the cursor position.
Inputs: no named parameters.
get_selectionA
Return the current selection(s): text and begin/end line+col for each.
Inputs: no named parameters.
get_settingB
Get a Sublime Text setting by key. scope='view' (default) or 'window'.
Inputs: key (required), scope.
get_symbolsA
Return all symbols (functions, classes, etc.) in the active file with line numbers.
Inputs: no named parameters.
get_syntaxesA
List all syntax definitions available in Sublime Text (name + path).
Inputs: no named parameters.
get_variablesA
Return Sublime Text's build variables: $file, $project_path, $platform, etc.
Inputs: no named parameters.
get_view_charsA
Return text at character offsets begin..end (0-based, end exclusive) from any open tab. Works for Terminus tabs and any other view. Clamps to buffer bounds automatically. Use get_view_size first, then e.g. begin=size-5000, end=size to read the last 5000 chars. Omit name for the active view.
Inputs: begin (required), end (required), name.
get_view_contentA
Return the full content of any open tab by name (partial match, case-insensitive). Works for Terminus tabs and other nameless views that have no file path. Omit name to read the active view.
Inputs: name.
get_view_phantomsB
Return phantom HTML and extracted text from a view by name. If key is omitted, defaults to the common 'pybackup' phantom key.
Inputs: name, key.
get_view_sizeA
Return the total character count of any open tab by name (partial match, case-insensitive). Use before get_view_chars to compute offsets — e.g. begin=size-5000, end=size for the tail. Omit name for the active view.
Inputs: name.
get_word_at_cursorA
Return the word under the cursor and its line/col.
Inputs: no named parameters.
goto_lineB
Move the cursor to a line (and optional column) in the active file.
Inputs: line (required), col.
insert_snippetA
Insert a snippet at the cursor using Sublime Text's snippet syntax (e.g. $1 for tab stops).
Inputs: contents (required).
lookup_symbolC
Find where a symbol is defined across all open files.
Inputs: symbol (required).
open_fileB
Open a file in Sublime Text, optionally jumping to a specific line and column.
Inputs: path (required), line, col.
redoA
Redo the last undone edit in the active file.
Inputs: no named parameters.
remove_folderC
Remove a folder from the current project by path.
Inputs: path (required).
replace_linesB
Replace lines begin through end (inclusive, 1-based) in the active file with text. Pass path to target a specific open file regardless of which tab is focused.
Inputs: begin (required), end (required), text (required), path.
replace_selectionC
Replace the current selection(s) with text.
Inputs: text (required).
revert_fileA
Revert the active file to its last saved state, discarding unsaved changes.
Inputs: no named parameters.
run_buildC
Trigger the current build system, or pass cmd/shell_cmd to run a specific command.
Inputs: cmd, shell_cmd, working_dir.
run_commandC
Run any Sublime Text command. scope='window' (default) or 'view'.
Inputs: command (required), args, scope.
save_allB
Save all open files.
Inputs: no named parameters.
save_fileA
Save a file. Pass path to save a specific open file; omit path to save the active file.
Inputs: path.
select_linesA
Select lines begin through end (1-based, inclusive). end defaults to begin.
Inputs: begin (required), end.
send_to_viewA
Send a string to any open tab by name (partial match, case-insensitive). For Terminus tabs this types the text into the terminal as if the user typed it. Include a trailing newline (\n) to execute a command. Omit name to target the active view.
Inputs: text (required), name.
set_encodingB
Set the character encoding of the active file (e.g. 'UTF-8', 'Western (Windows 1252)').
Inputs: encoding (required).
set_layoutB
Set the window pane layout. layout must be a ST layout dict with cols, rows, cells keys.
Inputs: layout (required).
set_settingB
Set a Sublime Text setting by key. scope='view' (default) or 'window'.
Inputs: key (required), value (required), scope.
set_statusC
Write a message to Sublime Text's status bar.
Inputs: value (required), key.
set_syntaxB
Set the syntax of the active file by name (case-insensitive partial match is fine).
Inputs: name (required).
show_panelA
Bring an output panel to the front. Use name='exec' for the build panel.
Inputs: name.
sort_linesA
Sort the selected lines (or all lines if nothing is selected).
Inputs: case_sensitive.
toggle_commentA
Toggle line comment (or block comment if block=True) on the current selection.
Inputs: block.
toggle_sidebarA
Show or hide the Sublime Text sidebar.
Inputs: no named parameters.
undoA
Undo the last edit in the active file.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 59 tools
Many tools have overlapping purposes (e.g., get_file_content, get_view_content, get_view_chars), and while descriptions are detailed, an agent might struggle to choose the correct one for a given scenario. Some tools like eval_python and run_command are distinct but others blur boundaries.
The naming convention is largely consistent with verb_noun snake_case (e.g., add_folder, get_open_files, set_syntax). A few deviate slightly (send_to_view, eval_python) but these are still clear and follow the overall pattern.
59 tools is excessive for a single MCP server. While Sublime Text operations can be many, this count overwhelms an agent with choices, many of which are overly specific (e.g., get_view_phantoms, get_line_count). A more focused set would improve usability.
The tool surface covers a wide range of editor actions (file management, editing, search, project, settings, terminal), but notable gaps exist: no create_file, rename_file, or delete_file tools. Basic file lifecycle operations are incomplete.
Maintenance
Related MCP Connectors
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Build, validate, test-run and publish AIOS workflows from Claude Code, Codex, Cursor or VS Code.
Get open-source GitHub projects running on your computer, with your AI app
Get open-source GitHub projects running on your computer, with your AI app
Related MCP Servers
- AlicenseAqualityDmaintenanceRemote-control Unity Editor from any AI IDE via file-based IPC — 62 tools, zero dependencies6523Apache 2.0
- AlicenseBqualityDmaintenanceConnects OpenSpec specification system to AI coding assistants, enabling automated spec-driven development workflows.1133 npm2MIT

Elgato MCP Serverofficial
AlicenseAqualityBmaintenanceBridges AI assistants with Elgato apps via IPC, enabling dynamic tool discovery and notification forwarding.13,374 npm17MIT- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to Nuke for compositing tasks via natural language.14MIT