-
Notifications
You must be signed in to change notification settings - Fork 49.5k
feat(desktop): present MCP catalog as connectors #59692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
UlysseTRIN
wants to merge
3
commits into
NousResearch:main
Choose a base branch
from
UlysseTRIN:feat/mcp-connectors-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| import { connectorDisplayName, connectorIdentityKey, connectorPrimaryActionKind, connectorSetupSummary } from './mcp-catalog' | ||
|
|
||
| const entry = (overrides = {}) => ({ | ||
| name: 'github-enterprise', | ||
| description: 'GitHub connector', | ||
| source: 'https://example.com', | ||
| transport: 'http', | ||
| auth_type: 'oauth', | ||
| required_env: [], | ||
| command: null, | ||
| args: [], | ||
| url: 'https://example.com/mcp', | ||
| install_url: null, | ||
| install_ref: null, | ||
| bootstrap: [], | ||
| default_enabled: null, | ||
| post_install: '', | ||
| display_name: '', | ||
| category: '', | ||
| icon: '', | ||
| tags: [], | ||
| capabilities: [], | ||
| setup_steps: [], | ||
| danger_notes: [], | ||
| needs_install: false, | ||
| installed: false, | ||
| enabled: false, | ||
| ...overrides | ||
| }) | ||
|
|
||
| describe('connectorDisplayName', () => { | ||
| it('uses manifest display_name when present', () => { | ||
| expect(connectorDisplayName(entry({ display_name: 'GitHub Enterprise' }))).toBe('GitHub Enterprise') | ||
| }) | ||
|
|
||
| it('falls back to a readable name for legacy manifests', () => { | ||
| expect(connectorDisplayName(entry())).toBe('Github Enterprise') | ||
| }) | ||
| }) | ||
|
|
||
| describe('connectorIdentityKey', () => { | ||
| it('prefers the curated icon key over the config name', () => { | ||
| expect(connectorIdentityKey(entry({ icon: 'unreal-engine', name: 'ue-local' }))).toBe('unreal-engine') | ||
| }) | ||
|
|
||
| it('falls back to the entry name for legacy manifests', () => { | ||
| expect(connectorIdentityKey(entry({ icon: '' }))).toBe('github-enterprise') | ||
| }) | ||
| }) | ||
|
|
||
| describe('connectorPrimaryActionKind', () => { | ||
| it('treats uninstalled OAuth HTTP catalog entries as connect actions', () => { | ||
| expect(connectorPrimaryActionKind(entry())).toBe('connect') | ||
| }) | ||
|
|
||
| it('keeps local stdio catalog entries as install actions', () => { | ||
| expect(connectorPrimaryActionKind(entry({ transport: 'stdio', auth_type: 'none', command: 'npx', url: null }))).toBe( | ||
| 'install' | ||
| ) | ||
| }) | ||
|
|
||
| it('returns installed once the entry is already installed', () => { | ||
| expect(connectorPrimaryActionKind(entry({ installed: true, enabled: true }))).toBe('installed') | ||
| }) | ||
| }) | ||
|
|
||
| describe('connectorSetupSummary', () => { | ||
| it('describes OAuth HTTP connectors as browser sign-in flows', () => { | ||
| expect(connectorSetupSummary(entry({ setup_steps: ['Sign in', 'Pick tools'] }))).toBe( | ||
| '2 setup steps · Browser OAuth' | ||
| ) | ||
| }) | ||
|
|
||
| it('describes api-key connectors as credential setup flows', () => { | ||
| expect( | ||
| connectorSetupSummary( | ||
| entry({ auth_type: 'api_key', required_env: [{ name: 'API_KEY', prompt: 'API key', required: true }] }) | ||
| ) | ||
| ).toBe('1 setup step · Requires credentials') | ||
| }) | ||
|
|
||
| it('describes local build connectors without setup steps', () => { | ||
| expect(connectorSetupSummary(entry({ auth_type: 'none', needs_install: true, setup_steps: [] }))).toBe('Local build') | ||
| }) | ||
| }) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import type { McpCatalogEntry } from '@/types/hermes' | ||
|
|
||
| export type ConnectorPrimaryActionKind = 'connect' | 'install' | 'installed' | ||
|
|
||
| export function connectorIdentityKey(entry: Pick<McpCatalogEntry, 'icon' | 'name'>): string { | ||
| return entry.icon?.trim() || entry.name | ||
| } | ||
|
|
||
| export function connectorDisplayName(entry: Pick<McpCatalogEntry, 'display_name' | 'name'>): string { | ||
| const displayName = entry.display_name?.trim() | ||
|
|
||
| if (displayName) { | ||
| return displayName | ||
| } | ||
|
|
||
| return entry.name | ||
| .split(/[-_\s]+/) | ||
| .filter(Boolean) | ||
| .map(part => part.charAt(0).toUpperCase() + part.slice(1)) | ||
| .join(' ') | ||
| } | ||
|
|
||
| export function connectorPrimaryActionKind( | ||
| entry: Pick<McpCatalogEntry, 'auth_type' | 'installed' | 'transport'> | ||
| ): ConnectorPrimaryActionKind { | ||
| if (entry.installed) { | ||
| return 'installed' | ||
| } | ||
|
|
||
| return entry.auth_type === 'oauth' && entry.transport === 'http' ? 'connect' : 'install' | ||
| } | ||
|
|
||
| export function connectorSetupSummary( | ||
| entry: Pick<McpCatalogEntry, 'auth_type' | 'needs_install' | 'required_env' | 'setup_steps' | 'transport'> | ||
| ): string { | ||
| const parts: string[] = [] | ||
| const stepCount = entry.setup_steps.length || entry.required_env.filter(env => env.required).length | ||
|
|
||
| if (stepCount > 0) { | ||
| parts.push(`${stepCount} setup step${stepCount === 1 ? '' : 's'}`) | ||
| } | ||
|
|
||
| if (entry.auth_type === 'oauth' && entry.transport === 'http') { | ||
| parts.push('Browser OAuth') | ||
| } else if (entry.auth_type === 'api_key' || entry.required_env.length > 0) { | ||
| parts.push('Requires credentials') | ||
| } else if (entry.needs_install) { | ||
| parts.push('Local build') | ||
| } | ||
|
|
||
| return parts.join(' · ') | ||
| } |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Desktop can run against an older Hermes runtime, whose
/api/mcp/catalogresponse lacks this new field. Normalize connector metadata to empty arrays at the API boundary (or guard optional fields) before dereferencing.length; the same applies tocapabilitiesanddanger_notesbelow.