Skip to content

Resources

mcjtag exposes 7 MCP resources that provide read-only access to target state. Resources use the jtag:// URI scheme and can be polled by MCP clients without invoking tool calls.

Resources are distinct from tools in several ways:

  • Read-only — they reflect current state without side effects
  • No parameters — the URI fully identifies the resource (except for templated URIs)
  • Polling-friendly — clients can read resources repeatedly to monitor changes
  • Error handling — resources return a dict with an error key if something goes wrong, rather than raising exceptions

All resources require an active OpenOCD connection. If the server is not connected, every resource returns:

{"error": "Not connected to OpenOCD. Use connect or start_openocd first."}

Current target execution state and program counter.

Returns:

FieldTypeDescription
namestrTarget name (e.g. "stm32f1x.cpu")
statestrExecution state: halted, running, reset, debug-running
pcstr | nullProgram counter as hex (e.g. "0x08001234"), null if not halted
haltedboolWhether the target is halted
{
"name": "stm32f1x.cpu",
"state": "halted",
"pc": "0x08001234",
"halted": true
}

All CPU register values. The target must be halted for this resource to succeed.

Returns:

FieldTypeDescription
registersdict[str, str]Map of register name to hex value
countintNumber of registers returned

Register values are formatted with width-appropriate hex padding (e.g., 32-bit registers as 0x00000000).

{
"registers": {
"r0": "0x00000000",
"r1": "0x20000100",
"sp": "0x20004ff0",
"lr": "0x080011a5",
"pc": "0x08001234",
"xPSR": "0x61000000"
},
"count": 21
}

Flash bank topology and metadata.

Returns:

FieldTypeDescription
bankslist[dict]List of flash bank descriptors
countintNumber of flash banks

Each bank contains:

FieldTypeDescription
indexintBank index (0-based)
namestrFlash driver name
basestrBase address (hex)
sizeintTotal size in bytes
targetstrAssociated target name
{
"banks": [
{
"index": 0,
"name": "stm32f1x",
"base": "0x08000000",
"size": 65536,
"target": "stm32f1x.cpu"
}
],
"count": 1
}

JTAG scan chain enumeration with TAP details.

Returns:

FieldTypeDescription
tapslist[dict]List of TAP descriptors
countintNumber of TAPs discovered

Each TAP contains:

FieldTypeDescription
namestrTAP name (e.g. "stm32f1x.cpu")
idcodestrJTAG IDCODE (hex)
ir_lengthintInstruction register length in bits
enabledboolWhether the TAP is enabled
{
"taps": [
{
"name": "stm32f1x.cpu",
"idcode": "0x1ba01477",
"ir_length": 4,
"enabled": true
}
],
"count": 1
}

List of peripherals from the currently loaded SVD file.

Returns:

FieldTypeDescription
svd_loadedboolWhether an SVD file is loaded
svd_pathstrPath to the loaded SVD file (only if loaded)
peripheralslist[str]Peripheral names (empty list if no SVD loaded)

If no SVD file has been loaded, svd_loaded will be false and peripherals will be an empty list:

{
"svd_loaded": false,
"peripherals": []
}

After loading an SVD file via svd_inspect(svd_path=...):

{
"svd_loaded": true,
"svd_path": "/path/to/STM32F103.svd",
"peripherals": ["GPIOA", "GPIOB", "GPIOC", "USART1", "USART2", "SPI1", "I2C1", "TIM1", "RCC", "FLASH"]
}

Decoded register values for a specific peripheral. This is a templated resource — replace {peripheral} with the actual peripheral name.

URI examples:

  • jtag://svd/GPIOA
  • jtag://svd/USART1
  • jtag://svd/RCC

Returns:

FieldTypeDescription
peripheralstrPeripheral name
registersdict[str, dict]Map of register name to decoded register

Each register contains:

FieldTypeDescription
addressstrRegister address (hex)
raw_valuestrRaw 32-bit value read from hardware (hex)
fieldslist[dict]Decoded bitfields

Each bitfield contains:

FieldTypeDescription
namestrField name from SVD
valueintExtracted value
widthintField width in bits
offsetintBit offset within the register
descriptionstrField description from SVD

Requires a loaded SVD file. Returns {"error": "No SVD file loaded"} if no SVD is available.

{
"peripheral": "GPIOA",
"registers": {
"CRL": {
"address": "0x40010800",
"raw_value": "0x44444444",
"fields": [
{
"name": "MODE0",
"value": 0,
"width": 2,
"offset": 0,
"description": "Port mode bits"
},
{
"name": "CNF0",
"value": 1,
"width": 2,
"offset": 2,
"description": "Port configuration bits"
}
]
}
}
}

Active transport protocol and debug adapter information.

Returns:

FieldTypeDescription
transportstrActive transport (e.g. "swd", "jtag")
adapterstrAdapter/probe identifier
speed_khzint | nullAdapter clock speed in kHz (null if unavailable)
available_transportslist[str]All transports the adapter supports
{
"transport": "swd",
"adapter": "cmsis-dap",
"speed_khz": 1000,
"available_transports": ["swd", "jtag"]
}

Use resources when you want to passively observe state. Use tools when you need to perform actions or need parameterized queries.

NeedUse
Check if target is haltedResource: jtag://target/state
Halt the targetTool: target_control(action="halt")
See all register valuesResource: jtag://registers/all
Read specific registersTool: read_registers(names=["pc", "sp"])
Check what peripherals are availableResource: jtag://svd/peripherals
Decode a specific register with bitfieldsTool: svd_inspect(peripheral="GPIOA", register="CRL")