Skip to content

Conversation

jbdocuphase
Copy link

@jbdocuphase jbdocuphase commented Aug 14, 2025

This PR fixes an issue when using the MCP against databases that have special characters in their name, such as org.uat, which would cause MCP calls to fail due to "invalid name" errors.

According to MariaDB's documentation here, there are particular rules around what constitutes a valid/invalid identifier.

Key Changes

  • Replaced Python's .isidentifier() with _is_valid_identifier() method that follows MariaDB identifier rules
  • Added _normalize_identifier() as a guard method at all MCP endpoint entry points that:
    • Validates identifiers (quoted or unquoted) according to MariaDB rules
    • Returns clean, unquoted identifiers for internal use
    • Provides clear error messages with method context
  • Added _quote_identifier() to safely quote identifiers for SQL without double-quoting
  • Simplified internal methods to work with normalized (unquoted) identifiers
  • Supports both input formats: org.uat and `org.uat` are handled identically

Testing

Verified this works for databases with special characters. Unable to test vector store endpoints due to missing embedding provider setup.

@jbdocuphase
Copy link
Author

Fixes #25

@jbdocuphase
Copy link
Author

Going to take a different approach with this. It's probably best we automatically quote all identifiers coming into the MCP to make the rules simper. Please hold-off on merge until I've made those changes. Thanks!

@jbdocuphase
Copy link
Author

Simplified the implementation and updated PR details

@jbdocuphase jbdocuphase changed the title Replace Python isidentifier() with MariaDB-compliant identifier validation Fix identifier handling for identifiers with special characters (e.g. org.uat) Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant