Phil's ST MCP
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
MCP server for Sublime Text 4. Lets Claude Code (or any MCP client) read and control a running ST instance via a local HTTP bridge.
58 tools covering reading, navigation, editing, searching, build, Terminus integration, settings, layout, and live Python scripting.
Architecture
Claude Code (MCP client)
│ stdio / MCP protocol
▼
mcp_server.py ← Python process you run outside ST
│ HTTP 127.0.0.1:9500
▼
sublime_mcp.py ← ST plugin, HTTP server on ST's main thread
│ sublime API
▼
Sublime Text 4File | Role |
| ST plugin — runs an HTTP server inside Sublime Text |
| MCP server — wraps the HTTP API for MCP clients |
Installation
1. Install the ST plugin
Copy sublime_mcp.py to your Sublime Text Packages/User/ folder:
%APPDATA%\Sublime Text\Packages\User\sublime_mcp.pyST loads it automatically on start (or via Tools › Developer › New Plugin…
then save over it). You should see:
sublime-mcp: listening on 127.0.0.1:9500in the ST console (View › Show Console).
2. Install the MCP server
pip install sublime-mcp3. Register with Claude Code
Add to ~/.claude/settings.json:
{
"mcpServers": {
"sublime": {
"command": "sublime-mcp"
}
}
}Then restart Claude Code. Tools will appear with the mcp__sublime__ prefix.
Then restart Claude Code. Tools will appear with the mcp__sublime__ prefix.
Tools
Read / Introspect
Tool | Description |
| Path, full content, cursor line/col, dirty flag, and syntax name |
| Current selection(s): text and begin/end line+col for each |
|
|
| All files open in the current window (path, name, is_dirty) |
| Project root folder paths |
| Full content of any already-open file by path |
| Full content of any open tab by name (partial match). Works for Terminus tabs and nameless views |
| Total character count of any open tab. Use to compute offsets before |
| Text at character offsets begin..end (0-based, end exclusive). Clamps to buffer bounds |
| Phantom HTML and extracted plain text from a named view; filters by phantom key |
| Text content of a named output panel. Omit name for the active panel; |
| Active panel id and, if it is an output panel, its content |
| All symbols (functions, classes, etc.) in the active file with line numbers |
| Find where a symbol is defined across all open files |
| Raw |
| ST build variables: |
| Command Palette entries from installed |
| Runnable command ids from loaded command classes, optionally merged with palette metadata |
| Menu items from |
| All syntax definitions available in ST (name + path) |
| Full syntax scope string at the cursor position |
| Word under the cursor and its line/col |
| All bookmarked positions in the active file |
| Total number of lines in the active file |
| Character encoding of the active file |
| A ST setting by key. |
| Current window layout (groups, cells) and which files are in each group |
Navigate
Tool | Description |
| Open a file, optionally jumping to a specific line and column |
| Move cursor to line (and optional column) in the active file |
| Bring an output panel to the front. Default |
| Move focus to a pane group by 0-based index |
Edit
Tool | Description |
| Replace the current selection(s) with text |
| Replace lines begin..end (inclusive, 1-based) in the active file |
| Insert at the cursor using ST snippet syntax ( |
| Duplicate the current line(s) |
| Toggle line comment, or block comment if |
| Sort selected lines, or all lines if nothing is selected |
| Select lines begin..end (1-based, inclusive) |
| Fold (collapse) lines begin..end in the active file |
| Undo the last edit |
| Redo the last undone edit |
| Run any ST command with optional args. |
Search
Tool | Description |
| Find all occurrences of a pattern in the active file. Returns |
| Search across project folders (or a supplied list). Skips |
File / Project
Tool | Description |
| Save the active file |
| Save all open files |
| Close a file by path, or the active file if path is omitted |
| Revert the active file to its last saved state |
| Add a folder to the current project (no-op if already present) |
| Remove a folder from the current project by path |
Syntax / Encoding
Tool | Description |
| Set the syntax of the active file by name (case-insensitive partial match) |
| Set the character encoding of the active file (e.g. |
Settings / Window
Tool | Description |
| Set a ST setting by key. |
| Show or hide the sidebar |
| Set the window pane layout. Accepts a ST layout dict with |
| Write a message to ST's status bar |
Build
Tool | Description |
| Trigger the current build system, or pass |
Terminus Integration
Terminus is a popular ST terminal package.
send_to_view is Terminus-aware: when targeting a Terminus tab it uses
terminus_send_string to type text into the terminal session rather than
inserting into a buffer.
Tool | Description |
| Send a string to any open tab by name. For Terminus tabs, types the text as if the user typed it. Include a trailing |
Scripting
Tool | Description |
| Execute arbitrary Python in ST's main thread. Locals available: |
Configuration
Port
Default is 9500. To change it, edit _PORT in sublime_mcp.py and BASE in mcp_server.py.
Timeout
The MCP server waits up to 10 seconds for each HTTP response. Edit TIMEOUT in
mcp_server.py if you need longer (e.g. for slow eval_python calls).
Security note
The HTTP server binds to 127.0.0.1 only and accepts any request without
authentication. Do not expose port 9500 to a network interface.
Requirements
Sublime Text 4
Python 3.10+ (for the MCP server process)
pip install mcp httpxTerminus package (optional, required only for
send_to_viewon terminal tabs)
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dpc00/sublime-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server