Dify Cloud MCP Server returns -32603 Internal Server Error when called from n8n MCP Client
- 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.16.1
### Cloud or Self Hosted
Cloud
### Steps to reproduce
### Environment
- Dify Version: 1.16.1 (Cloud)
- n8n: Self-hosted
- MCP Transport: HTTP Streamable
### Steps to Reproduce
1. Create any MCP Server in Dify Cloud.
2. Configure an n8n MCP Client node using the Dify MCP endpoint.
3. Call any tool exposed by the MCP server.
4. Execute the workflow.
### Expected Result
The MCP server should execute the requested tool and return a normal response.
### Actual Result
Every Dify Cloud MCP server returns the following error:
```text
MCP error -32603: Internal server error:
Can't operate on closed transaction inside context manager.
Please complete the context manager before emitting further commands.
```
### Additional Verification
- Tested multiple Dify Cloud MCP servers.
- Tested MCP servers created from different Dify Cloud accounts.
- Tested previously working MCP servers without making any changes.
- Tested simple workflows (Tesla Model examples) to rule out workflow complexity.
- The same n8n MCP Client successfully communicates with a VPS-hosted MCP server.
### Conclusion
The issue appears to be specific to the Dify Cloud MCP service, since the same n8n MCP Client works correctly with a VPS-hosted MCP server.
### ✔️ Expected Behavior
When an n8n MCP Client calls a Dify Cloud MCP Server, the MCP server should execute the requested tool successfully and return a normal response without any internal server errors.
The same behavior is expected regardless of which Dify Cloud account or MCP server is used.
This issue started on 2026-08-04. Previously, the same Dify Cloud MCP servers were working correctly without any workflow changes.
Based on our testing, this appears to be a regression in the Dify Cloud MCP service rather than an issue with the n8n MCP Client.
### ❌ Actual Behavior
Every Dify Cloud MCP Server immediately returns the following error when called from an n8n MCP Client:
```text
MCP error -32603: Internal server error:
Can't operate on closed transaction inside context manager.
Please complete the context manager before emitting further commands.
```
This issue occurs consistently across multiple Dify Cloud MCP servers, including servers created from different Dify Cloud accounts.
The same n8n MCP Client successfully communicates with a VPS-hosted MCP Server, indicating that the issue appears to be specific to the Dify Cloud MCP service.
Contributor guide
Research direction
Start by reproducing the failure through an n8n MCP Client against a Dify Cloud MCP endpoint, then trace the MCP tool-call entry point that emits the reported transaction error. Compare the failing Cloud behavior with the working VPS-hosted MCP server and verify that tool calls return normal responses across multiple servers and accounts.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100