Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/en/resources/integrations/components/toolkit-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ export const normalizeString = (str: string) =>

/**
* Find toolkit from pathname
* e.g., /en/mcp-servers/productivity/gmail -> Gmail toolkit
* e.g., /en/resources/integrations/productivity/gmail -> Gmail toolkit
* e.g., /en/resources/integrations/productivity/gmail/reference -> Gmail toolkit
*/
export const findToolkitFromPath = (pathname: string | null) => {
if (!pathname) {
return null;
}

const pathSegments = pathname.split("/").filter(Boolean);
const toolkitSlug = pathSegments.at(-1);
// URL structure can be:
// - /en/resources/integrations/{category}/{toolkit}
// - /en/resources/integrations/{category}/{toolkit}/reference
const lastSegment = pathSegments.at(-1);
const toolkitSlug =
lastSegment === "reference" ? pathSegments.at(-2) : lastSegment;

if (!toolkitSlug) {
return null;
Expand Down
17 changes: 16 additions & 1 deletion app/en/resources/integrations/components/toolkits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ import { ToolCard } from "./tool-card";
import { TYPE_CONFIG, TYPE_DESCRIPTIONS } from "./type-config";
import { useFilterStore, useToolkitFilters } from "./use-toolkit-filters";

// Map old MCP server paths to new integration paths
function mapToNewIA(oldLink: string): string {
// Pattern: /en/mcp-servers/{category}/{tool} -> /en/resources/integrations/{category}/{tool}/reference
const mcpServerPattern = /^\/en\/mcp-servers\/([^/]+)\/([^/]+)$/;
const match = oldLink.match(mcpServerPattern);

if (match) {
const [, category, tool] = match;
return `/en/resources/integrations/${category}/${tool}/reference`;
}

// Return original link if it doesn't match the pattern
return oldLink;
}
Copy link

Choose a reason for hiding this comment

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

mapToNewIA regex requires /en/ prefix that may be absent

The mapToNewIA function's regex pattern ^\/en\/mcp-servers\/... requires the input link to start with /en/mcp-servers/. Based on the PR discussion, the design system likely provides relativeDocsLink values without the /en/ locale prefix since "the prefix should be added automatically." If the design system returns paths like /mcp-servers/productivity/gmail, the regex won't match and the original (potentially broken) link will be returned unchanged. The pattern may need to handle links both with and without the locale prefix.

Fix in Cursor Fix in Web


export default function Toolkits() {
const clearAllFilters = useFilterStore((state) => state.clearAllFilters);

Expand Down Expand Up @@ -123,7 +138,7 @@ export default function Toolkits() {
isComingSoon={toolkit.isComingSoon}
isPro={toolkit.isPro}
key={toolkit.id}
link={toolkit.relativeDocsLink}
link={mapToNewIA(toolkit.relativeDocsLink)}
name={toolkit.label}
type={toolkit.type}
/>
Expand Down
2 changes: 1 addition & 1 deletion lib/remark-glossary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function remarkGlossary(options: RemarkGlossaryOptions) {
}

// don't process the many MCP tool pages
if (file.history?.[0]?.includes("/mcp-servers/")) {
if (file.history?.[0]?.includes("/resources/integrations/")) {
return;
}

Expand Down
Loading