langgenius / langgenius/dify

After adding the MCP service, check the tools and modify the MCP server, but encounter errors.

Open
#41,649 2 comments 2 reactions 0 assignees View on GitHub
🐞 bug 1.17.0
Dominant language
TypeScript
Stars
156k
Forks
24.6k
Avg merge
22h 9m
Merged PRs (30d)
610

Description

### Self Checks

- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] 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

Contributor guide

Open the contributing guide

Research direction

Start at api/controllers/console/workspace/tool_providers.py in put and trace get_provider_for_url_validation into api/services/tools/mcp_tools_manage_service.py, especially get_provider. Reproduce the MCP list and save actions in the self-hosted Docker setup and inspect why the provider ID reaches PostgreSQL as "fast-mcp". Done means viewing the MCP tool list and modifying an existing MCP complete without the UUID error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python, sqlalchemy
Domain
api, backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.