x1pen-mcp
v2.13.0Local MCP server for controlling X1Pen in a user-visible Chromium tab
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
x1pen_connection_info
Get the local bridge port and pairing code used by the X1Pen Connector extension.
x1pen_list_sessions
List X1Pen browser tabs explicitly connected through the extension.
x1pen_select_session
Select the X1Pen browser tab used by later tool calls. Pad input is released on the previously selected live tab first; force only when that cleanup cannot complete.
| Parameter | Type | Description |
|---|---|---|
sessionId * | string | |
force | boolean | Select after pad-release failure; the old live tab may stay held until disconnect/reload |
x1pen_get_language_profile
Call before generating nontrivial code. Lists the bundled FuzzyBASIC, SLANG, HuBASIC, built-in Z80 assembler and X1 hardware profiles and, when connected, compares language profiles with those reported by X1Pen (including the HuBASIC runtime revision and the SLANG compiler revision once X1Pen has loaded them).
| Parameter | Type | Description |
|---|---|---|
includeActive | boolean | Read profile IDs from the connected X1Pen tab when one is available |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_search_reference
Search the bundled X1Pen-specific FuzzyBASIC, SLANG, HuBASIC (hubasic2sl), built-in Z80 assembler and X1 hardware reference before assuming syntax, APIs, memory maps or I/O behavior. Returns compact summaries and stable IDs; use x1pen_get_reference for selected details.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
kinds | array | |
language | string | |
maxResults | integer | |
profile | string |
x1pen_get_reference
Get complete X1Pen-specific reference entries for stable IDs returned by x1pen_search_reference, with a bounded response size.
| Parameter | Type | Description |
|---|---|---|
ids * | array | |
maxCharacters | integer |
x1pen_get_program
Get a compact program summary and explicitly selected complete sources. Defaults to metadata only; prefer get_source/search_source for large sources.
| Parameter | Type | Description |
|---|---|---|
fields | array | Complete sources to include; omit or pass [] for metadata only |
includeGeneratedAsm | boolean | Allow generated ASM to be returned when the program is in SLANG mode |
maxCharacters | integer | Maximum combined size of explicitly selected complete sources |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_set_program
Replace the complete program when its revision guard still matches. Sources inactive for sourceMode are cleared even when supplied; use apply_edits to preserve the other active authoring section. Before embedding a large generated byte table, follow the server large-asset guidance; ordinary long code alone does not trigger it. expectedRevisionEpoch is required when all connected components support reload-safe source sync; older peers visibly degrade to numeric revision guarding. HuBASIC text is stored as X1 bytes and read back in one spelling (\xB1 comes back as ア), so the returned hashes de…
| Parameter | Type | Description |
|---|---|---|
expectedRevision * | integer | |
sourceMode * | string | |
asm | string | |
basic | string | |
expectedRevisionEpoch | string | |
hubasic | string | HuBASIC program in X1Pen text form, for sourceMode hubasic |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
slang | string |
x1pen_set_source_file
Replace one editable source section from a local UTF-8 file under an explicitly configured allowed source root. The file content and host path are never returned. The same revision/epoch guard as other source writes applies. For HuBASIC the stored section hash describes X1Pen's read-back spelling of the bytes, so it can differ from the raw file SHA-256.
| Parameter | Type | Description |
|---|---|---|
expectedRevision * | integer | |
path * | string | |
section * | string | |
expectedRevisionEpoch | string | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_get_source
Read a bounded line range from one X1Pen source section without returning the complete program.
| Parameter | Type | Description |
|---|---|---|
section * | string | |
includeGeneratedAsm | boolean | |
lineCount | integer | |
maxCharacters | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
startLine | integer |
x1pen_search_source
Find literal text in one X1Pen source section and return bounded line context around matches.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
section * | string | |
caseSensitive | boolean | |
contextLines | integer | |
includeGeneratedAsm | boolean | |
maxResults | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_diff_source
Compare a retained source baseline with the current connected tab using bounded line hunks. Baselines are ephemeral; caller-supplied text is labeled self-attested. Diffs never authorize a write.
| Parameter | Type | Description |
|---|---|---|
baseHash * | string | |
baseRevisionEpoch * | string | |
baseSourceMode * | string | |
section * | string | |
baseGenerated | boolean | |
baseSource | string | Optional caller-retained fallback when the ephemeral baseline cache no longer has baseHash |
contextLines | integer | |
includeGeneratedAsm | boolean | |
maxCharacters | integer | |
maxHunks | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_apply_edits
Apply non-overlapping line edits when the current revision guard matches. Before embedding a large generated byte table, follow the server large-asset guidance; ordinary long code alone does not trigger it. expectedRevisionEpoch is required for reload-safe source sync; degraded revision-only mode is reported and has a narrow reload-collision risk between the final pre-read and write.
| Parameter | Type | Description |
|---|---|---|
edits * | array | |
expectedRevision * | integer | |
section * | string | |
expectedRevisionEpoch | string | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_validate
Compile or tokenize the current program without running it. For SLANG, output.generatedAsmLines and asmBytes describe temporary compilation output; validate does not store generated ASM in the program, while Run does.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_get_hubasic_options
Get the hubasic2sl conversion options X1Pen uses for every HuBASIC program. They are one X1Pen setting, not part of the program or its revision.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_set_hubasic_options
Change hubasic2sl conversion options for every HuBASIC program in X1Pen; the next Validate or Run uses them. Keys left out keep their value; null resets a key to the hubasic2sl default (wait none, noLineNumbers false, assumeDefint false, stringLen 255, dataBudget 24576). Not part of the program: no revision guard. Refused while a Run is being set up.
| Parameter | Type | Description |
|---|---|---|
patch * | object | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_get_state
Get the Z80 debugger run state, stop reason, registers, cycles and current memory mapping.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_pause
Pause Z80 execution after any in-progress X1Pen Run setup finishes.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_resume
Resume Z80 execution. Pass the returned sequence to x1pen_debug_wait_for_pause when waiting for a later stop.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_step
Execute one or more Z80 instructions from a paused state and return only the final state.
| Parameter | Type | Description |
|---|---|---|
count | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_set_breakpoints
Atomically replace up to 1024 Z80 PC breakpoints. Pass an empty array to clear them.
| Parameter | Type | Description |
|---|---|---|
addresses * | array | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_read_memory
Read a bounded range from the current Z80 address space as a compact uppercase hexadecimal string.
| Parameter | Type | Description |
|---|---|---|
address * | integer | |
length | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_get_video_state
Get the current X1 model, screen dimensions, display/access graphics banks and VRAM availability.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_read_vram
Read logical X1 video memory without I/O side effects and return compact uppercase hex. Running reads may not be a consistent multi-byte snapshot; pause first when consistency matters.
| Parameter | Type | Description |
|---|---|---|
offset * | integer | |
region * | string | |
bank | Required for graphics VRAM; display/access are resolved atomically by X1Pen | |
length | integer | |
plane | string | Required for graphics VRAM |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_write_vram
Write logical X1 video memory while the Z80 debugger is paused. hex must contain 1-4096 bytes as contiguous even-length hexadecimal.
| Parameter | Type | Description |
|---|---|---|
hex * | string | |
offset * | integer | |
region * | string | |
bank | Required for graphics VRAM; display/access are resolved atomically by X1Pen | |
plane | string | Required for graphics VRAM |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_debug_wait_for_pause
Wait for a matching debugger pause. afterSequence must be the sequence returned by x1pen_debug_resume, not an earlier stopped state.
| Parameter | Type | Description |
|---|---|---|
address | integer | |
afterSequence | integer | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
stopReason | string | |
timeoutMs | integer |
x1pen_run
Build and run the current program in the connected user-visible X1Pen tab. Concurrent Run returns ordinary content with code RUN_IN_PROGRESS and retryAfterMs; a Run held behind other Automation work can return non-retryable RUN_QUEUE_TIMEOUT. The server does not retry automatically.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
waitMs | integer |
x1pen_recover_stalled
Reload a Run-stalled X1Pen tab. First call without confirmation to read the data-loss warning. Recovery is refused unless Run admission is already stalled; it preserves editor source but loses emulator RAM and unpersisted disk changes.
| Parameter | Type | Description |
|---|---|---|
confirmDataLoss | boolean | |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_send_key
Send one allowlisted X1 virtual key down/hold/up lifecycle to the visible connected X1Pen emulator. Success confirms dispatch, not guest consumption; a short hold may be missed by a throttled guest, while a long hold may repeat across responsive guest input calls. Use the shortest adequate hold and verify acknowledgement before a duplicate-safe retry. code is a numeric Windows-compatible VK (for example 0x41=A, 0x0D=Enter, 0x20=Space); modifiers, chords and text strings are not supported.
| Parameter | Type | Description |
|---|---|---|
code * | integer | |
durationMs | integer | Requested hold duration in milliseconds; short holds may be missed when throttled and long holds may repeat when responsive |
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_set_pad
Set one X1 joystick port as an active-low raw byte in the visible connected emulator. Ports 1/2 map to PSG registers 14/15; bits 0..7 are Up, Down, Left, Right, Button 4, Button 2 (B), Button 1 (A), Button 3. Zero means pressed and 255 releases the remote contribution.
| Parameter | Type | Description |
|---|---|---|
bits * | integer | |
port * | ||
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_stop
Send ESC to stop the program in the connected X1Pen tab.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_get_status
Get readiness, revision, lock and status state from the connected X1Pen tab.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |
x1pen_capture_screen
Capture the connected X1Pen emulator canvas as a 640x400 PNG.
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Connected X1Pen instance ID; omit when one tab is connected |