#25203·mlflow

search_mcp_access_endpoints(filter_string=...) always rejects server_name due to a sqlparse keyword collision

Author: kaikailaCreated Aug 18, 2026Updated Sep 30, 2026
Labelshas-closing-prready

[!WARNING] Before submitting a PR, please make sure that:

  • A maintainer has triaged this issue and applied the ready label
  • This issue has no assignee
  • No duplicate PR exists

PRs not meeting these requirements may be automatically closed.

Summary

server_name is a documented searchable attribute for search_mcp_access_endpoints (it's in SearchMCPAccessEndpointUtils.VALID_SEARCH_ATTRIBUTE_KEYS), but using it in a filter_string with any comparator fails with Invalid clause(s) in filter string.

Reproduction

python
store.search_mcp_access_endpoints(filter_string="server_name = 'my-server'")
# mlflow.exceptions.MlflowException: Invalid clause(s) in filter string:
# 'server_name', '=', ''my-server''

Confirmed with sqlparse==0.5.5:

python
>>> import sqlparse
>>> sqlparse.parse("server_name = 'x'")[0].tokens[0]
<Keyword 'server_name' ...>   # not an Identifier
>>> sqlparse.parse("servername = 'x'")[0].tokens[0]
<Identifier 'servername' ...>

Root cause

sqlparse's built-in keyword table includes the literal string SERVER_NAME (likely inherited from T-SQL/ODBC reserved words), so it tokenizes server_name as Token.Keyword rather than an Identifier. Downstream, both _join_in_comparison_tokens (used to assemble key IN (...) / key NOT IN (...) clauses) and the generic _invalid_statement_token_search_runs validity check assume the attribute-name token is an Identifier. Because it isn't, the clause is rejected outright before comparator-specific logic ever runs — this affects =, !=, IN, NOT IN, etc., not just list comparators.

This has gone unnoticed because every existing test/call site uses the server_name= keyword argument (a separate code path that never goes through the filter-string parser), not filter_string="server_name ...".

Suggested fix direction

In the tokenizer/validity-check layer (mlflow/utils/search_utils.py), treat a Keyword-typed token as a valid attribute identifier when its text (case-insensitive) matches one of the calling class's VALID_SEARCH_ATTRIBUTE_KEYS. This fixes server_name today and protects against any other legitimate MLflow field name that happens to collide with sqlparse's reserved-word table in the future.

Environment

  • mlflow (dev, 3.15.2.dev0)
  • sqlparse 0.5.5