[GH-ISSUE #296] issue: _process_schema_property crashes on list-valued schema fragments: AttributeError: 'list' object has no attribute 'get' #133

Open
opened 2026-10-18 21:12:04 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @pschaer on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/open-webui/mcpo/issues/296

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.

Originally created by @pschaer on GitHub (May 16, 2026). Original GitHub issue: https://github.com/open-webui/mcpo/issues/296 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] 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 - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** MCPO and Open WebUI. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] 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: ```json "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: ```json "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`.
Author
Owner

@SaurabhMaydeo commented on GitHub (Jun 26, 2026):

Opened #300 to fix this. It adds the isinstance(items_schema, list) guard you suggested, and also covers the Draft 2020-12 prefixItems form and non-object elements, with regression tests. Falls back to List[Any] for the empty/odd cases rather than crashing.

<!-- gh-comment-id:4808121110 --> @SaurabhMaydeo commented on GitHub (Jun 26, 2026): Opened #300 to fix this. It adds the `isinstance(items_schema, list)` guard you suggested, and also covers the Draft 2020-12 `prefixItems` form and non-object elements, with regression tests. Falls back to `List[Any]` for the empty/odd cases rather than crashing.
Author
Owner

@veno501 commented on GitHub (Aug 9, 2026):

I have the same issue, waiting for this to be merged

<!-- gh-comment-id:5231658374 --> @veno501 commented on GitHub (Aug 9, 2026): I have the same issue, waiting for this to be merged
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/mcpo#133
No description provided.