Skip to content

Adding surface metadata to search_indicators endpoint#108

Merged
lucyking140 merged 19 commits intodatacommonsorg:mainfrom
lucyking140:lucysking/mcp-metadata-si
Oct 17, 2025
Merged

Adding surface metadata to search_indicators endpoint#108
lucyking140 merged 19 commits intodatacommonsorg:mainfrom
lucyking140:lucysking/mcp-metadata-si

Conversation

@lucyking140
Copy link
Copy Markdown
Contributor

@lucyking140 lucyking140 commented Oct 17, 2025

Building from this PR that added a surface to the DataCommonsClient to also pass it in on any calls made to the DC Flask API. This header is ultimately passed into Mixer and used to identify that these calls come from the MCP server.

@lucyking140 lucyking140 marked this pull request as ready for review October 17, 2025 18:32
@lucyking140 lucyking140 requested a review from keyurva October 17, 2025 18:32
endpoint_url = f"{self.sv_search_base_url}/api/nl/search-indicators"
headers = {"Content-Type": "application/json"}
# 'x-surface' indicates to mixer that this call is coming from the MCP server
headers = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these headers are used at multiple places, consider extracting it into a const.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@keyurva
Copy link
Copy Markdown
Contributor

keyurva commented Oct 17, 2025

Building from this PR that added a surface to the DataCommonsClient to also pass it in on any calls made to the DC Flask API. This header is ultimately passed into Mixer and used to identify that these calls come from the MCP server.

Note that the search-indicators call is in the flask server and it may not involve any further downstream mixer calls. So while not relevant to this PR, we may need to take the surface header into account for non-mixer servers as well.

Copy link
Copy Markdown
Contributor

@keyurva keyurva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Lucy!

# shortly to include release candidates (TODO: lucysking)
SURFACE = f"mcp-{__version__.replace('rc', '.')}"

# 'x-surface' indicates to mixer that this call is coming from the MCP server
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/mixer/DC APIs? (if we are to expand surface header's scope to non-mixer servers as well)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this!

# This is here temporarily because of validation in the DataCommonsClient
# that surface headers must only contain numbers, which will be updated
# shortly to include release candidates (TODO: lucysking)
SURFACE = f"mcp-{__version__.replace('rc', '.')}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/SURFACE/SURFACE_HEADER_VALUE?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

# Replaces 'rc' with '.' in a version string if present.
# This is here temporarily because of validation in the DataCommonsClient
# that surface headers must only contain numbers, which will be updated
# shortly to include release candidates (TODO: lucysking)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a bug for this so it's tracked?

Copy link
Copy Markdown
Contributor Author

@lucyking140 lucyking140 Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added b/453012979!

@lucyking140 lucyking140 merged commit cd54254 into datacommonsorg:main Oct 17, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants