Can Multiple App Slugs be Passed When Connecting to MCP Servers Without Enabling Full Discovery?

This topic was automatically generated from Slack. You can find the original thread here.

Is there a way to pass in multiple app slugs when connecting to the MCP servers? Don’t want to enable full discovery, just filter the set of apps/tools to a specific subset. Can create a connection per app if needed, but was hoping there’s a way to pass a list of apps slugs

i do it like this:

"use server";
import { experimental_createMCPClient as createMCPClient, Message } from "ai";

import { IntegrationType } from "@prisma/client";

import { pipedreamBEClient } from "@jenius/core/services/integrations/pipedreamBEClient";
import { IntegrationsService } from "@jenius/core/services/integrations";

export const getMCPToolsForTask = async (
  orgId: string,
  userId: string,
  messages: Message[]
) => {
  const lastMessage = messages[messages.length - 1];

  if (!lastMessage) {
    throw new Error("No last message found");
  }

  const connectedIntegrations =
    await IntegrationsService.getChatAccessibleIntegrations({
      organizationId: orgId,
      userId,
    });

  const accessToken = await pipedreamBEClient.rawAccessToken;

  const mcpClients = await Promise.all(
    connectedIntegrations.map(
      ({ integration: { providerSlug, type }, connectedById }) => {
        const externalUserId =
          type === IntegrationType.personal ? connectedById : orgId;

        return createMCPClient({
          transport: {
            type: "sse",
            url: `https://remote.mcp.pipedream.net/${externalUserId}/${providerSlug}`,
            headers: {
              Authorization: `Bearer ${accessToken}`,
              "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
              "x-pd-environment": process.env.PIPEDREAM_ENV!,
            },
          },
        });
      }
    )
  );

  return {
    ...Object.assign(
      {},
      ...(await Promise.all(mcpClients.map((client) => client.tools())))
    ),
  };
};

I believe you can pass multiple app slugs, it may just be undocumented — can you try just passing a comma separate list of app slugs in the x-pd-app-slug header or app query param?

Thanks – yes, turns out comma separated list of apps slugs works :slightly_smiling_face: