Skip to content

Conversation

@peteski22
Copy link
Contributor

Summary

Resolves inconsistent normalization between CLI search results and daemon API responses.

Previously, mcpd search would return non-normalized data from registry JSON manifests while the daemon API would return normalized data from internal storage, which could cause user confusion when server IDs and tool names had different casing.

Changes

  • API Layer: Normalize server and tool names in ToAPIType() methods to ensure consistent output at the API boundary
  • Mozilla-AI Provider: Add custom JSON unmarshaling to normalize server and tool names during data ingestion
  • MCPM Provider: Add custom JSON unmarshaling to normalize server and tool names during data ingestion
  • Registry Map Keys: Normalize registry map keys during unmarshaling to enable proper lookups by normalized names
  • Testing: Add unit tests and integration tests using file URLs with mixed-case test data

Closes: #177

* Normalize server names in health.go ToAPIType method
* Normalize tool names in tools.go ToAPIType method
* Update API tests to expect normalized output
* Document ToAPIType normalization responsibility in convert interface

This ensures consistent normalized output at the API boundary for both
server names and tool names, resolving inconsistencies between CLI
search results and daemon API responses.

Related to #177
* Add UnmarshalJSON methods for MCPRegistry, Server, and Tool types
* Normalize map keys and Name fields during JSON unmarshaling
* Add comprehensive unit tests for unmarshaling behavior
* Fix registry to use normalized server names for ID and Name fields
* Add integration test with file URL and mixed-case test data

This ensures server and tool names are normalized at data ingestion
time, making normalization transparent and impossible to bypass.

Related to #177
* Add UnmarshalJSON methods for MCPServers, MCPServer, and Tool types
* Normalize map keys and Name fields during JSON unmarshaling
* Add comprehensive unit tests for unmarshaling behavior
* Fix registry to use normalized server names for ID and Name fields
* Add integration test with file URL and mixed-case test data

This ensures server and tool names are normalized at data ingestion
time for MCPM registry sources, maintaining consistency with the
mozilla-ai provider implementation.

Related to #177
Copy link
Member

@aittalam aittalam left a comment

Choose a reason for hiding this comment

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

Thanks Peter! Overall looks good, I have just one concern re: the repeated code (unmarashaljson + tests) on mcpm + mozilla_ai repos. As we know mcpm is to be removed soon I would not bother too much, but let's keep it in the back of our heads that in case we add other registries we should factor this out to avoid redundant code

@peteski22 peteski22 merged commit a21c8dc into main Sep 17, 2025
2 checks passed
@peteski22 peteski22 deleted the peteski22/177/api/normalize-output branch September 17, 2025 16:11
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.

Normalize API output to match stored configuration format

3 participants