mirror of
https://github.com/open-webui/mcpo.git
synced 2026-07-22 11:45:46 -04:00
feat: Implement data sanitization for field name compatibility #71
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @carlosaln on GitHub (May 27, 2025).
Check Existing Issues
Problem Description
mcpo currently fails when connecting to MCP servers that use field names with leading underscores (like
__user_id__,__calendar_id__) due to Pydantic's built-in restriction against such field names. This creates compatibility issues with servers like MCP GSuite, which uses these naming conventions to distinguish system parameters from user data.Note that the use of double underscore (
__) prefixes for special or system fields is a common convention in many organizations and platforms (like Google APIs, which often use leading underscores or double underscores to denote internal or reserved fields...) also see MongoDB that uses them to clearly separate system-level parameters from user data.As a result, mcpo's current incompatibility with these field names limits its ability to interact with some MCP servers.
As an example when I tried to use mcp-gsuite, I got:
Desired Solution you'd like
I propose adding some kind of field name sanitization module to mcpo that automatically handles incompatible field names while preserving the original semantics for MCP server communication.
It would:
__user_id__-->field__user_id__)+ restore original field names when calling MCP serversI'm happy to do some work on this if the idea is accepted.
Alternatives Considered
Additional Context
Maybe we’ll want to handle cases where a field name is a reserved Python keyword, or where the field names start with special characters like $ or @. It could even be possible to let people set up their own rules for how field names get cleaned up, depending on the server?
I'm happy to do some work on this if the idea is accepted.
@2underscores commented on GitHub (Jun 4, 2025):
IMO this is more a bug than a feature, raised ^ for it.
Very basic and only handles specifically the leading
_'s case (I think by far that will be most common), but could easily extend the field cleaning logic in PR beyond just _ strip to something more comprehensive as proposed in the feat req. Unsure exactly what other restrictions pydantic might place