Repository navigation
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.17.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
2026-09-02 15:58:14.406 | 2026-09-02 07:58:14.405 ERROR [Dummy-81] [app.py:875] 3e8f9d99203558e3a7b42e35681d8312 - Exception on /console/api/workspaces/current/tool-provider/mcp [PUT]
2026-09-02 15:58:14.406 | Traceback (most recent call last):
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2026-09-02 15:58:14.406 | self.dialect.do_execute(
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
2026-09-02 15:58:14.406 | cursor.execute(statement, parameters)
2026-09-02 15:58:14.406 | psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type uuid: "fast-mcp"
2026-09-02 15:58:14.406 | LINE 3: ...e-175cde6a5e5e'::UUID AND tool_mcp_providers.id = 'fast-mcp'...
2026-09-02 15:58:14.406 | ^
2026-09-02 15:58:14.406 |
2026-09-02 15:58:14.406 |
2026-09-02 15:58:14.406 | The above exception was the direct cause of the following exception:
2026-09-02 15:58:14.406 |
2026-09-02 15:58:14.406 | Traceback (most recent call last):
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
2026-09-02 15:58:14.406 | rv = self.dispatch_request()
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
2026-09-02 15:58:14.406 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/api.py", line 404, in wrapper
2026-09-02 15:58:14.406 | resp = resource(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
2026-09-02 15:58:14.406 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/flask_restx/resource.py", line 41, in dispatch_request
2026-09-02 15:58:14.406 | resp = meth(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/console/wraps.py", line 325, in decorated
2026-09-02 15:58:14.406 | return view(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/libs/login.py", line 166, in decorated_view
2026-09-02 15:58:14.406 | return current_app.ensure_sync(func)(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/console/wraps.py", line 124, in decorated
2026-09-02 15:58:14.406 | return view(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/common/wraps.py", line 92, in decorated
2026-09-02 15:58:14.406 | return view(*args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/console/wraps.py", line 604, in decorated
2026-09-02 15:58:14.406 | return view(self, current_tenant_id, *args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/console/wraps.py", line 683, in wrapper
2026-09-02 15:58:14.406 | return view(self, validated, *args, **kwargs)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/controllers/console/workspace/tool_providers.py", line 1447, in put
2026-09-02 15:58:14.406 | validation_data = service.get_provider_for_url_validation(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/services/tools/mcp_tools_manage_service.py", line 571, in get_provider_for_url_validation
2026-09-02 15:58:14.406 | provider = self.get_provider(provider_id=provider_id, tenant_id=tenant_id)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/services/tools/mcp_tools_manage_service.py", line 112, in get_provider
2026-09-02 15:58:14.406 | provider = self._session.scalar(stmt)
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2399, in scalar
2026-09-02 15:58:14.406 | return self._execute_internal(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2249, in _execute_internal
2026-09-02 15:58:14.406 | result: Result[Any] = compile_state_cls.orm_execute_statement(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 306, in orm_execute_statement
2026-09-02 15:58:14.406 | result = conn.execute(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
2026-09-02 15:58:14.406 | return meth(
2026-09-02 15:58:14.406 | ^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 527, in _execute_on_connection
2026-09-02 15:58:14.406 | return connection._execute_clauseelement(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1641, in _execute_clauseelement
2026-09-02 15:58:14.406 | ret = self._execute_context(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2026-09-02 15:58:14.406 | return self._exec_single_context(
2026-09-02 15:58:14.406 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
2026-09-02 15:58:14.406 | self._handle_dbapi_exception(
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception
2026-09-02 15:58:14.406 | raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2026-09-02 15:58:14.406 | self.dialect.do_execute(
2026-09-02 15:58:14.406 | File "/app/api/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
2026-09-02 15:58:14.406 | cursor.execute(statement, parameters)
2026-09-02 15:58:14.406 | sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: "fast-mcp"
2026-09-02 15:58:14.406 | LINE 3: ...e-175cde6a5e5e'::UUID AND tool_mcp_providers.id = 'fast-mcp'...
2026-09-02 15:58:14.406 | ^
2026-09-02 15:58:14.406 |
2026-09-02 15:58:14.406 | [SQL: SELECT tool_mcp_providers.id, tool_mcp_providers.name, tool_mcp_providers.server_identifier, tool_mcp_providers.server_url, tool_mcp_providers.server_url_hash, tool_mcp_providers.icon, tool_mcp_providers.tenant_id, tool_mcp_providers.user_id, tool_mcp_providers.encrypted_credentials, tool_mcp_providers.authed, tool_mcp_providers.tools, tool_mcp_providers.created_at, tool_mcp_providers.updated_at, tool_mcp_providers.timeout, tool_mcp_providers.sse_read_timeout, tool_mcp_providers.encrypted_headers, tool_mcp_providers.identity_mode
2026-09-02 15:58:14.406 | FROM tool_mcp_providers
2026-09-02 15:58:14.406 | WHERE tool_mcp_providers.tenant_id = %(tenant_id_1)s::UUID AND tool_mcp_providers.id = %(id_1)s::UUID]
2026-09-02 15:58:14.406 | [parameters: {'tenant_id_1': '609bf5e0-a7ce-4250-9b3e-175cde6a5e5e', 'id_1': 'fast-mcp'}]
2026-09-02 15:58:14.406 | (Background on this error at: https://sqlalche.me/e/20/9h9h)
✔️ Expected Behavior
Normal modification of MCP and viewing the list of specified MCPs
❌ Actual Behavior
After adding the MCP normally.
1、Clicking on MCP will pop up the right panel to view the tool list. At this point, the server reports an error.
2、Modify the MCP and click "Save", but the server reports an error.2
Activity
dosubot commentedon Sep 2, 2026
Hi @JianGuoHt! I'm Dosu and I'm helping the Dify team.
The root cause of this error is a mismatch between the
idvalue returned by the MCP list endpoint and what the edit/detail endpoints expect.The
GET /workspaces/current/tools/mcpendpoint (which populates the MCP card grid) callslist_providerswith the defaultfor_list=False[1]. Whenfor_listisFalse,mcp_provider_to_user_providersets the responseidto theserver_identifier(your human-readable slug"fast-mcp") instead of the actual database UUID [2].The frontend then uses this
idvalue ("fast-mcp") for both:useMCPTools(detail.id)→GET /workspaces/current/tool-provider/mcp/tools/fast-mcp[3] [4]provider_id: editingProvider.id→PUT /workspaces/current/tool-provider/mcp[5] [6]On the backend, both of those endpoints pass
provider_idtoget_provider(), which queriesWHERE tool_mcp_providers.id = 'fast-mcp'::UUID— and since"fast-mcp"is not a valid UUID, Postgres throws theinvalid input syntax for type uuiderror you're seeing [7] [8].The inconsistency is that the create endpoint and the detail endpoint both use
for_list=Trueto return the real UUID asid[9] [10], but the list-all endpoint (/workspaces/current/tools/mcp) uses the defaultfor_list=False[11], which returns theserver_identifierasid.This appears to be a bug in the current codebase. The fix would be to either pass
for_list=Truein theToolMCPListAllApi.get()endpoint, or to have the backend resolveprovider_idby first checking if it's a valid UUID and falling back toserver_identifierlookup if it isn't. Could you open an issue linking to this analysis if one doesn't exist already?To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
mfy78 commentedon Sep 2, 2026
Hi,我对这个问题很感兴趣,想尝试解决它,可以分配给我吗?
我的情况:
如果有任何需要注意的地方,请告诉我,谢谢!
test(workspace): add return type annotations to MCP provider_id UUID …
fix(api): validate MCP provider_id as a UUID at the Pydantic layer (l…
test(workspace): add return type annotations to MCP provider_id UUID …
fix(api): validate MCP provider_id as a UUID at the Pydantic layer (l…
test(workspace): add return type annotations to MCP provider_id UUID …