Structured Data
LocalData MCP handles JSON, YAML, and TOML files as navigable trees, and XML and INI files as flat SQL tables. The connection interface is the same for all five formats; the storage model determines which tools are available after connection.
Tree storage (JSON, YAML, TOML)
When connected, these files are parsed into a tree where each node is individually addressable. Nodes can hold key-value properties and any number of child nodes. An LLM agent can navigate, query, edit, and export the tree without loading the entire file into context.
connect_database("cfg", "json", "./config.json")
connect_database("settings", "yaml", "./settings.yaml")
connect_database("pyproject", "toml", "./pyproject.toml")
The connection response includes a tree summary: root nodes, maximum depth, and total property count.
Tree tools
Tool |
Description |
|---|---|
|
View a node’s properties and whether it has children |
|
List child nodes with pagination |
|
Create a node; missing ancestors are created automatically |
|
Remove a node and all its descendants |
|
List key-value pairs at a node |
|
Read a single property value |
|
Create or update a property; type is inferred automatically |
|
Remove a property from a node |
|
Export the tree as JSON, YAML, or TOML |
The path argument uses dot notation to address nodes: "server" addresses a top-level node,
"server.tls" addresses a child node named tls under server.
Editing
set_value("cfg", "server", "port", "9090")
# Dot-notation path; "monitoring" and "alerts" are created if absent
set_value("cfg", "monitoring.alerts", "enabled", "true")
delete_key("cfg", "server", "deprecated_setting")
delete_node("cfg", "monitoring.alerts") # Removes the node and all children
Format conversion
export_structured converts the in-memory tree to any of the three supported formats, regardless of the
source format:
connect_database("cfg", "toml", "./config.toml")
export_structured("cfg", "json") # Emit as JSON
export_structured("cfg", "yaml") # Emit as YAML
This lets an agent convert between TOML, JSON, and YAML without writing any conversion logic.
Type inference
set_value infers the type of the supplied string before storing it:
"true"/"false"→ booleanNumeric strings → integer or float
"null"→ nullAnything else → string
Lists and dicts must be supplied as JSON-serialized strings; they are stored as-is and returned in that form.
XML and INI (flat handling)
XML and INI files connect with the same call but are stored as flat SQL tables rather than trees. After
connection, use the standard database tools (execute_query, describe_table, and so on).
connect_database("config_xml", "xml", "./config.xml")
connect_database("app_ini", "ini", "./app.ini")
XML table layout
Each XML element becomes a row. The columns are:
Column |
Content |
|---|---|
|
Auto-assigned integer row identifier |
|
Element tag name |
|
Text content of the element, if any |
|
Row identifier of the parent element ( |
|
One column per attribute, prefixed with |
Querying is the same as for any SQL-backed source:
execute_query("config_xml", "SELECT tag, text FROM data WHERE attrs_enabled = 'true'")
INI table layout
Each key-value pair becomes a row:
Column |
Content |
|---|---|
|
Section name from the INI file |
|
Key within that section |
|
Value as a string |
execute_query("app_ini", "SELECT value FROM data WHERE section = 'database' AND key = 'host'")
Available tools for XML and INI
Because these formats map to SQL tables, all standard database tools apply:
describe_database(name)— list tables and row countsdescribe_table(name, table)— column names and typesexecute_query(name, sql)— run any read queryfind_table(name, keyword)— search table names by keyword
The tree tools (get_node, get_value, etc.) are not available for XML or INI connections.