Skip to content

issue: _process_schema_property crashes on list-valued schema fragments: AttributeError: 'list' object has no attribute 'get' #296

Description

@pschaer

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of mcpo.

mcpo Version

v0.0.20

Open WebUI Version (if applicable)

N/A

Operating System

Docker (Linux Container)

Browser (if applicable)

N/A

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both MCPO and Open WebUI.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

mcpo should start successfully and expose @brave/brave-search-mcp-server tools via OpenAPI, just like it does for other MCP servers.

Actual Behavior

mcpo crashes during startup when parsing the Brave server's tool schemas. The _process_schema_property function receives a list object where it expects a dict, causing:

AttributeError: 'list' object has no attribute 'get'

The server fails to connect and mcpo logs it in the startup summary.

Steps to Reproduce

  1. Add the current latest Brave package to an mcpo config:
    "brave": {
      "command": "npx",
      "args": ["-y", "@brave/brave-search-mcp-server"],
      "env": { "BRAVE_API_KEY": "..." }
    }
  2. Start mcpo.
  3. Wait for mcpo to reach the Brave server during initialization.
  4. Observe the AttributeError crash in logs.

Logs & Screenshots

Full traceback:

2026-05-16 07:55:35,024 - ERROR - Failed to connect to MCP server 'brave-search-mcp-server': AttributeError: 'list' object has no attribute 'get'
Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/mcpo/main.py", line 719, in lifespan
    await create_dynamic_endpoints(app, api_dependency=api_dependency)
  File "/app/.venv/lib/python3.12/site-packages/mcpo/main.py", line 546, in create_dynamic_endpoints
    response_model_fields = get_model_fields(
                            ^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/mcpo/utils/main.py", line 253, in get_model_fields
    python_type_hint, pydantic_field_info = _process_schema_property(
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/mcpo/utils/main.py", line 221, in _process_schema_property
    item_type_hint, _ = _process_schema_property(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/mcpo/utils/main.py", line 183, in _process_schema_property
    nested_type_hint, nested_pydantic_field = _process_schema_property(
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/mcpo/utils/main.py", line 221, in _process_schema_property
    item_type_hint, _ = _process_schema_property(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/mcpo/utils/main.py", line 126, in _process_schema_property
    prop_type = prop_schema.get("type")
                ^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'get'

Workaround that works: pin to 1.3.7 and force stdio:

"args": ["-y", "@brave/brave-search-mcp-server@1.3.7", "--transport", "stdio"]

Additional Information

The crash occurs because _process_schema_property types its prop_schema parameter as Dict[str, Any] and calls .get("type") unconditionally. However, valid JSON Schema Draft 7 allows items to be either a single schema object or an array of schema objects (tuple validation). When mcpo recurses into the latter, it passes a Python list back into _process_schema_property, triggering the AttributeError.

Suggested fix: add an isinstance(items_schema, list) guard in the prop_type == "array" branch inside mcpo/utils/main.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions