Mcp
MCP Marketplace Changes
Sypha-specific changes to the MCP Marketplace rendering and installation flow.
MCP Marketplace: Rendering and Installation (Sypha changes)
Marketplace rendering flow
- Data source:
src/services/mcp/MarketplaceDataService.tsretrieves catalog JSON from S3 athttps://sypha-mcp-images.s3.us-east-1.amazonaws.com/mcp-marketplace.json. - Caching: Implements in-memory cache (
cachedCatalog,lastFetchTime) featuring a 5-minute timeout for network call reduction. - Parsing and normalization:
- Accommodates either an array (
[{...}]) or an object containingitems({ items: [...] }). - When the response is a string, it normalizes frequent JSON problems:
- Adds quotes to unquoted
logoUrlvalues while maintaining separators (comma/brace). - Eliminates trailing commas.
- Removes double commas.
- Adds missing commas between object boundaries (
}{->},{).
- Adds quotes to unquoted
- Comprehensive logging for raw/cleaned data and post-parse structure facilitates debugging.
- Accommodates either an array (
- Output: Produces a
McpMarketplaceCatalogcontainingitemsfor UI layer rendering of MCP entries (name, author, description, icon, tags, etc.).
Installation flow
- Server selection: Upon user selection of an MCP from the marketplace, the controller invokes
downloadMcp()insrc/core/controller/mcp/downloadMcp.ts. - Details fetch:
downloadMcp()utilizesMarketplaceDataService.getInstance().getMcpById(mcpId)to acquire metadata (GitHub URL, README, etc.). - Validation: Confirms presence of
githubUrlandreadmeContent. - Task orchestration:
- Constructs a guided task for MCP installation, incorporating
READMEandllmsInstallationContent. - References
sypha_mcp_settings.jsonfor installation/configuration details. - Transitions to "act" mode when necessary, initializes the task, and launches the chat view to execute installation procedures.
- Constructs a guided task for MCP installation, incorporating
- Response: Delivers a
McpDownloadResponse(or a structured error upon failure).
Changes implemented
src/services/mcp/MarketplaceDataService.ts
- JSON parsing hardening:
- Corrected unquoted
logoUrlvalues without compromising JSON separators by maintaining the subsequent comma/brace. - Preserved safe cleanups (eliminate trailing commas, correct double commas, add commas between objects).
- Corrected unquoted
- Flexible format support: Processes both array root and
{ items: [...] }structures; consistently returns{ items }. - Caching + timeouts: 10s request timeout; 5-minute cache duration.
- Diagnostics: Enhanced console logs for raw responses, cleaned content, type verification, item tallies.
src/core/controller/mcp/downloadMcp.ts
- Marketplace integration: Extracts MCP metadata from
MarketplaceDataServicereplacing the previous external API. - Settings filename: Installation task text modified to reference
sypha_mcp_settings.json.
Follow-ups
- UI text alignment: Modify any UI references still mentioning
sypha_mcp_settings.json(e.g.,webview-ui/src/components/mcp/configuration/tabs/add-server/AddLocalServerForm.tsx) tosypha_mcp_settings.jsonfor consistency maintenance.
Connecting to a Remote Server
Through the Model Context Protocol (MCP), Sypha gains the ability to interface with external servers, expanding its functionality with supplementary tools and resources. This documentation covers the process of establishing connections to remote MCP servers using the MCP Servers interface.
MCP Made Easy
Explore how to leverage the MCP Marketplace for discovering, installing, and configuring MCP servers that expand Sypha's functionality with supplementary tools and resources.