x1pen-mcp

v2.13.0
x1pen-mcp Checked 5 days ago Published 16 days ago

Local 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.

ParameterTypeDescription
sessionId *string
forcebooleanSelect 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).

ParameterTypeDescription
includeActivebooleanRead profile IDs from the connected X1Pen tab when one is available
sessionIdstringConnected 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.

ParameterTypeDescription
query *string
kindsarray
languagestring
maxResultsinteger
profilestring

x1pen_get_reference

Get complete X1Pen-specific reference entries for stable IDs returned by x1pen_search_reference, with a bounded response size.

ParameterTypeDescription
ids *array
maxCharactersinteger

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.

ParameterTypeDescription
fieldsarrayComplete sources to include; omit or pass [] for metadata only
includeGeneratedAsmbooleanAllow generated ASM to be returned when the program is in SLANG mode
maxCharactersintegerMaximum combined size of explicitly selected complete sources
sessionIdstringConnected 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…

ParameterTypeDescription
expectedRevision *integer
sourceMode *string
asmstring
basicstring
expectedRevisionEpochstring
hubasicstringHuBASIC program in X1Pen text form, for sourceMode hubasic
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected
slangstring

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.

ParameterTypeDescription
expectedRevision *integer
path *string
section *string
expectedRevisionEpochstring
sessionIdstringConnected 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.

ParameterTypeDescription
section *string
includeGeneratedAsmboolean
lineCountinteger
maxCharactersinteger
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected
startLineinteger

x1pen_search_source

Find literal text in one X1Pen source section and return bounded line context around matches.

ParameterTypeDescription
query *string
section *string
caseSensitiveboolean
contextLinesinteger
includeGeneratedAsmboolean
maxResultsinteger
sessionIdstringConnected 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.

ParameterTypeDescription
baseHash *string
baseRevisionEpoch *string
baseSourceMode *string
section *string
baseGeneratedboolean
baseSourcestringOptional caller-retained fallback when the ephemeral baseline cache no longer has baseHash
contextLinesinteger
includeGeneratedAsmboolean
maxCharactersinteger
maxHunksinteger
sessionIdstringConnected 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.

ParameterTypeDescription
edits *array
expectedRevision *integer
section *string
expectedRevisionEpochstring
sessionIdstringConnected 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.

ParameterTypeDescription
sessionIdstringConnected 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.

ParameterTypeDescription
sessionIdstringConnected 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.

ParameterTypeDescription
patch *object
sessionIdstringConnected 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.

ParameterTypeDescription
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected

x1pen_debug_pause

Pause Z80 execution after any in-progress X1Pen Run setup finishes.

ParameterTypeDescription
sessionIdstringConnected 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.

ParameterTypeDescription
sessionIdstringConnected 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.

ParameterTypeDescription
countinteger
sessionIdstringConnected 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.

ParameterTypeDescription
addresses *array
sessionIdstringConnected 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.

ParameterTypeDescription
address *integer
lengthinteger
sessionIdstringConnected 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.

ParameterTypeDescription
sessionIdstringConnected 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.

ParameterTypeDescription
offset *integer
region *string
bankRequired for graphics VRAM; display/access are resolved atomically by X1Pen
lengthinteger
planestringRequired for graphics VRAM
sessionIdstringConnected 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.

ParameterTypeDescription
hex *string
offset *integer
region *string
bankRequired for graphics VRAM; display/access are resolved atomically by X1Pen
planestringRequired for graphics VRAM
sessionIdstringConnected 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.

ParameterTypeDescription
addressinteger
afterSequenceinteger
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected
stopReasonstring
timeoutMsinteger

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.

ParameterTypeDescription
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected
waitMsinteger

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.

ParameterTypeDescription
confirmDataLossboolean
sessionIdstringConnected 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.

ParameterTypeDescription
code *integer
durationMsintegerRequested hold duration in milliseconds; short holds may be missed when throttled and long holds may repeat when responsive
sessionIdstringConnected 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.

ParameterTypeDescription
bits *integer
port *
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected

x1pen_stop

Send ESC to stop the program in the connected X1Pen tab.

ParameterTypeDescription
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected

x1pen_get_status

Get readiness, revision, lock and status state from the connected X1Pen tab.

ParameterTypeDescription
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected

x1pen_capture_screen

Capture the connected X1Pen emulator canvas as a 640x400 PNG.

ParameterTypeDescription
sessionIdstringConnected X1Pen instance ID; omit when one tab is connected