fix(mcp): tag MCP SQL queries with /* atlan-mcp */ comment for log observability#220
Closed
kabhishek1001 wants to merge 1 commit intomainfrom
Closed
fix(mcp): tag MCP SQL queries with /* atlan-mcp */ comment for log observability#220kabhishek1001 wants to merge 1 commit intomainfrom
kabhishek1001 wants to merge 1 commit intomainfrom
Conversation
…rvability Prepend `/* atlan-mcp */` to all SQL queries executed via `query_asset` so they are identifiable in Heka's `db.statement` OTEL field. Without this tag, MCP queries are indistinguishable from UI-initiated queries in downstream log analysis. `QueryRequest` has no `application` or source field, making a SQL block comment the only portable origin tag that survives to the execution log without pyatlan SDK changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
query_assets_toolare currently indistinguishable from UI-initiated queries in Heka'sSQL_QUERY_EXECUTEDOTEL logs becausepyatlan.model.query.QueryRequesthas noapplicationorsourcefield, and Heka defaults all queries toapplication=adhoc./* atlan-mcp */as a SQL block comment to every query submitted throughquery_asset(). This comment passes through Heka unchanged and appears in thedb.statementfield of the OTEL log, enabling reliable log filtering.QueryRequestexposes onlysql,data_source_name, anddefault_schema.AtlanObjectusesExtra.ignore, so passingapplication=silently no-ops. A SQL comment is the only zero-dependency way to tag origin without pyatlan SDK changes.Change
modelcontextprotocol/tools/query.pyLog impact
After this fix, MCP queries are directly filterable in ClickHouse:
Related
This is the observability companion to a separate Heka-side fix where
credentialStrategy=custombyocssounconditionally uses the service account private key for Snowflake JDBC connections, ignoring the validatedbyocSsoAccessToken. The Heka fix is required to actually resolve the RBAC bypass; this PR ensures MCP queries are auditable in the interim.Test plan
query_assets_toolagainst a Snowflake connection on a test tenant/* atlan-mcp */appears indb.statementfield in Heka OTEL logs (otel_logs.service_logswhereServiceName='heka')/* */block comments)🤖 Generated with Claude Code