Skip to content

issue: mcpo failed with TypeError and NameError when running with Neo4j MCP server #198

Open
@yohei1126

Description

@yohei1126

Check Existing Issues

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

mcpo Version

0.0.16

Open WebUI Version (if applicable)

No response

Operating System

macOS

Browser (if applicable)

No response

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

$ cat ~/work/config.json 
{
  "mcpServers": {
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time", "--local-timezone=America/New_York"]
    },
    "neo4j-cypher": {
      "command": "uvx",
      "args": [
        "mcp-neo4j-cypher",
        "--db-url", "bolt://localhost:7687",
        "--username", "neo4j",
        "--password", "password123",
        "--namespace", "lineage"
      ]
    }
  }
}
$ uv run mcpo --config ~/work/config.json 
Starting MCP OpenAPI Proxy with config file: /xxx/work/config.json
2025-07-14 15:30:52,537 - INFO - Starting MCPO Server...
2025-07-14 15:30:52,538 - INFO -   Name: MCP OpenAPI Proxy
2025-07-14 15:30:52,538 - INFO -   Version: 1.0
2025-07-14 15:30:52,538 - INFO -   Description: Automatically generated API from MCP Tool Schemas
2025-07-14 15:30:52,538 - INFO -   Hostname: XP43WG00FM
2025-07-14 15:30:52,538 - INFO -   Port: 8000
2025-07-14 15:30:52,538 - INFO -   API Key: Not Provided
2025-07-14 15:30:52,538 - INFO -   CORS Allowed Origins: ['*']
2025-07-14 15:30:52,538 - INFO -   Path Prefix: /
2025-07-14 15:30:52,539 - INFO - Loading MCP server configurations from: /Users/yohei.onishi/work/config.json
2025-07-14 15:30:52,539 - INFO - Configured MCP Servers:
2025-07-14 15:30:52,539 - INFO -   Configuring Stdio MCP Server 'time' with command: uvx with args: ['mcp-server-time', '--local-timezone=America/New_York']
2025-07-14 15:30:52,540 - INFO -   Configuring Stdio MCP Server 'neo4j-cypher' with command: uvx with args: ['mcp-neo4j-cypher', '--db-url', 'bolt://localhost:7687', '--username', 'neo4j', '--password', 'password123', '--namespace', 'lineage']
2025-07-14 15:30:52,540 - INFO - Uvicorn server starting...
INFO:     Started server process [53131]
INFO:     Waiting for application startup.
[07/14/25 15:30:57] INFO     Running Neo4j Cypher MCP Server with  server.py:170
                             stdio transport...                                 
                    INFO     Processing request of type            server.py:625
                             ListToolsRequest                                   
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

Actual Behavior

$ mcpo --config config.json
Starting MCP OpenAPI Proxy with config file: config.json
2025-07-14 15:10:15,420 - INFO - Starting MCPO Server...
2025-07-14 15:10:15,420 - INFO -   Name: MCP OpenAPI Proxy
2025-07-14 15:10:15,420 - INFO -   Version: 1.0
2025-07-14 15:10:15,420 - INFO -   Description: Automatically generated API from MCP Tool Schemas
2025-07-14 15:10:15,420 - INFO -   Hostname: XP43WG00FM
2025-07-14 15:10:15,420 - INFO -   Port: 8000
2025-07-14 15:10:15,420 - INFO -   API Key: Not Provided
2025-07-14 15:10:15,420 - INFO -   CORS Allowed Origins: ['*']
2025-07-14 15:10:15,420 - INFO -   Path Prefix: /
2025-07-14 15:10:15,420 - INFO - Loading MCP server configurations from: config.json
2025-07-14 15:10:15,422 - INFO - Configured MCP Servers:
2025-07-14 15:10:15,422 - INFO -   Configuring Stdio MCP Server 'time' with command: uvx with args: ['mcp-server-time', '--local-timezone=America/New_York']
2025-07-14 15:10:15,422 - INFO -   Configuring Stdio MCP Server 'neo4j-cypher' with command: uvx with args: ['mcp-neo4j-cypher', '--db-url', 'bolt://localhost:7687', '--username', 'neo4j', '--password', 'password123', '--namespace', 'lineage']
2025-07-14 15:10:15,422 - INFO - Uvicorn server starting...
INFO:     Started server process [45290]
INFO:     Waiting for application startup.
[07/14/25 15:10:19] INFO     Running Neo4j Cypher MCP Server with stdio transport...                                                                                              server.py:170
                    INFO     Processing request of type ListToolsRequest                                                                                                          server.py:625
ERROR:      + Exception Group Traceback (most recent call last):
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/starlette/routing.py", line 694, in lifespan
  |     async with self.lifespan_context(app) as maybe_state:
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 210, in __aenter__
  |     return await anext(self.gen)
  |            ^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 98, in lifespan
  |     async with AsyncExitStack() as stack:
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 745, in __aexit__
  |     raise exc_details[1]
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 728, in __aexit__
  |     cb_suppress = await cb(*exc_details)
  |                   ^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 113, in lifespan
  |     async with stdio_client(server_params) as (reader, writer):
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 180, in stdio_client
  |     async with (
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 187, in stdio_client
    |     yield read_stream, write_stream
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 114, in lifespan
    |     async with ClientSession(reader, writer) as session:
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
    |     raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
      | Exception Group Traceback (most recent call last):
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 117, in lifespan
      |     yield
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 101, in lifespan
      |     await stack.enter_async_context(
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 650, in enter_async_context
      |     result = await _enter(cm)
      |              ^^^^^^^^^^^^^^^^
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 210, in __aenter__
      |     return await anext(self.gen)
      |            ^^^^^^^^^^^^^^^^^^^^^
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 113, in lifespan
      |     async with stdio_client(server_params) as (reader, writer):
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
      |     await self.gen.athrow(typ, value, traceback)
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 180, in stdio_client
      |     async with (
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
      |     raise BaseExceptionGroup(
      | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
      +-+---------------- 1 ----------------
        | Exception Group Traceback (most recent call last):
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 187, in stdio_client
        |     yield read_stream, write_stream
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 114, in lifespan
        |     async with ClientSession(reader, writer) as session:
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
        |     raise BaseExceptionGroup(
        | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
        +-+---------------- 1 ----------------
          | Traceback (most recent call last):
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 116, in lifespan
          |     await create_dynamic_endpoints(app, api_dependency=api_dependency)
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 61, in create_dynamic_endpoints
          |     response_model_fields = get_model_fields(
          |                             ^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 236, in get_model_fields
          |     python_type_hint, pydantic_field_info = _process_schema_property(
          |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 204, in _process_schema_property
          |     item_type_hint, _ = _process_schema_property(
          |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 166, in _process_schema_property
          |     nested_type_hint, nested_pydantic_field = _process_schema_property(
          |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 126, in _process_schema_property
          |     type_hint, _ = _process_schema_property(
          |                    ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 112, in _process_schema_property
          |     assert ref in schema_defs, "Custom field not found"
          |            ^^^^^^^^^^^^^^^^^^
          | TypeError: argument of type 'NoneType' is not iterable
          +------------------------------------

ERROR:    Application startup failed. Exiting.

Steps to Reproduce

  1. create config.json
{
  "mcpServers": {
    "time": {
      "command": "uvx",
      "args": ["mcp-server-time", "--local-timezone=America/New_York"]
    },
    "neo4j-cypher": {
      "command": "uvx",
      "args": [
        "mcp-neo4j-cypher",
        "--db-url", "bolt://localhost:7687",
        "--username", "neo4j",
        "--password", "password123",
        "--namespace", "lineage"
      ]
    }
  }
}
  1. run uv run mcpo --config ./config.json

Logs & Screenshots

$ mcpo --config config.json
Starting MCP OpenAPI Proxy with config file: config.json
2025-07-14 15:10:15,420 - INFO - Starting MCPO Server...
2025-07-14 15:10:15,420 - INFO -   Name: MCP OpenAPI Proxy
2025-07-14 15:10:15,420 - INFO -   Version: 1.0
2025-07-14 15:10:15,420 - INFO -   Description: Automatically generated API from MCP Tool Schemas
2025-07-14 15:10:15,420 - INFO -   Hostname: XP43WG00FM
2025-07-14 15:10:15,420 - INFO -   Port: 8000
2025-07-14 15:10:15,420 - INFO -   API Key: Not Provided
2025-07-14 15:10:15,420 - INFO -   CORS Allowed Origins: ['*']
2025-07-14 15:10:15,420 - INFO -   Path Prefix: /
2025-07-14 15:10:15,420 - INFO - Loading MCP server configurations from: config.json
2025-07-14 15:10:15,422 - INFO - Configured MCP Servers:
2025-07-14 15:10:15,422 - INFO -   Configuring Stdio MCP Server 'time' with command: uvx with args: ['mcp-server-time', '--local-timezone=America/New_York']
2025-07-14 15:10:15,422 - INFO -   Configuring Stdio MCP Server 'neo4j-cypher' with command: uvx with args: ['mcp-neo4j-cypher', '--db-url', 'bolt://localhost:7687', '--username', 'neo4j', '--password', 'password123', '--namespace', 'lineage']
2025-07-14 15:10:15,422 - INFO - Uvicorn server starting...
INFO:     Started server process [45290]
INFO:     Waiting for application startup.
[07/14/25 15:10:19] INFO     Running Neo4j Cypher MCP Server with stdio transport...                                                                                              server.py:170
                    INFO     Processing request of type ListToolsRequest                                                                                                          server.py:625
ERROR:      + Exception Group Traceback (most recent call last):
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/starlette/routing.py", line 694, in lifespan
  |     async with self.lifespan_context(app) as maybe_state:
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 210, in __aenter__
  |     return await anext(self.gen)
  |            ^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 98, in lifespan
  |     async with AsyncExitStack() as stack:
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 745, in __aexit__
  |     raise exc_details[1]
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 728, in __aexit__
  |     cb_suppress = await cb(*exc_details)
  |                   ^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 113, in lifespan
  |     async with stdio_client(server_params) as (reader, writer):
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 180, in stdio_client
  |     async with (
  |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 187, in stdio_client
    |     yield read_stream, write_stream
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 114, in lifespan
    |     async with ClientSession(reader, writer) as session:
    |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
    |     raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
      | Exception Group Traceback (most recent call last):
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 117, in lifespan
      |     yield
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 101, in lifespan
      |     await stack.enter_async_context(
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 650, in enter_async_context
      |     result = await _enter(cm)
      |              ^^^^^^^^^^^^^^^^
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 210, in __aenter__
      |     return await anext(self.gen)
      |            ^^^^^^^^^^^^^^^^^^^^^
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 113, in lifespan
      |     async with stdio_client(server_params) as (reader, writer):
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/contextlib.py", line 231, in __aexit__
      |     await self.gen.athrow(typ, value, traceback)
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 180, in stdio_client
      |     async with (
      |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
      |     raise BaseExceptionGroup(
      | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
      +-+---------------- 1 ----------------
        | Exception Group Traceback (most recent call last):
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcp/client/stdio/__init__.py", line 187, in stdio_client
        |     yield read_stream, write_stream
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 114, in lifespan
        |     async with ClientSession(reader, writer) as session:
        |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 772, in __aexit__
        |     raise BaseExceptionGroup(
        | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
        +-+---------------- 1 ----------------
          | Traceback (most recent call last):
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 116, in lifespan
          |     await create_dynamic_endpoints(app, api_dependency=api_dependency)
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/main.py", line 61, in create_dynamic_endpoints
          |     response_model_fields = get_model_fields(
          |                             ^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 236, in get_model_fields
          |     python_type_hint, pydantic_field_info = _process_schema_property(
          |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 204, in _process_schema_property
          |     item_type_hint, _ = _process_schema_property(
          |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 166, in _process_schema_property
          |     nested_type_hint, nested_pydantic_field = _process_schema_property(
          |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 126, in _process_schema_property
          |     type_hint, _ = _process_schema_property(
          |                    ^^^^^^^^^^^^^^^^^^^^^^^^^
          |   File "/Users/yohei.onishi/.local/share/mise/installs/python/3.11.9/lib/python3.11/site-packages/mcpo/utils/main.py", line 112, in _process_schema_property
          |     assert ref in schema_defs, "Custom field not found"
          |            ^^^^^^^^^^^^^^^^^^
          | TypeError: argument of type 'NoneType' is not iterable
          +------------------------------------

ERROR:    Application startup failed. Exiting.

Additional Information

No response

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