Skip to content

docs: add filter URL parameter to /clients page to pre-filter clients with specific capabilities#2665

Open
jancurn wants to merge 3 commits into
modelcontextprotocol:mainfrom
jancurn:main
Open

docs: add filter URL parameter to /clients page to pre-filter clients with specific capabilities#2665
jancurn wants to merge 3 commits into
modelcontextprotocol:mainfrom
jancurn:main

Conversation

@jancurn
Copy link
Copy Markdown
Contributor

@jancurn jancurn commented Apr 29, 2026

This PR improves the https://modelcontextprotocol.io/clients page by adding the filter URL parameter, which automatically selects only the matching filters.

For example: https://modelcontextprotocol.io/clients?filter=Tools,Resources

Motivation and Context

This small change enables sharing/linking to a pre-filtered client list (e.g. from blog posts or docs) that highlights only the clients matching specific MCP features, and thus helps promote MCO clients that support the newer capabilities.

Here are the changes made:

  • Read on mount: parse the filter query parameter, split by comma, and intersect with the known FEATURES whitelist before populating selectedFeatures. Unknown values are dropped, which is what makes this safe against HTML/script injection — combined with React's auto-escaping, no attacker-controlled string can reach the DOM.
  • Write on change: a useEffect mirrors selectedFeatures back into the URL via history.replaceState, so toggling a filter updates the address bar in place (no new history entries, back button still works). Each feature name is encodeURIComponent-encoded individually; the , separator is left literal (it's a valid sub-delim per RFC 3986) so the URL reads as ?filter=Prompts,Tools,Discovery instead of ?filter=Prompts%2CTools%2CDiscovery.
  • Both effects are SSR-safe (typeof window !== "undefined" guard).

How Has This Been Tested?

I've tested it locally in these scenarios:

  • npm run serve:docs, open /clients?filter=Discovery,Resources — both filters auto-selected, list narrowed
  • Open /clients?filter=Resources,BogusValue — only Resources selected (whitelist drops the unknown)
  • Open /clients?filter=<script>alert(1)</script> — nothing selected, no script execution
  • Click filter chips and confirm the URL updates in place; clicking "Clear filters" removes the param entirely

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

claude and others added 3 commits April 29, 2026 14:49
Auto-select feature filters on the clients page from a `?filter=` query
parameter, and update the URL in place when filters change. Filter
values are validated against the known FEATURES whitelist, so unknown
or malicious values are ignored.
…QhE73

Add URL query parameter support for client filter persistence
@jancurn jancurn requested review from a team as code owners April 29, 2026 15:30
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