Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

docs: add app auth for Vercel MCP (#1619)

Allen Zhou35c9ca342d28
diff --git a/apps/docs/app/[lang]/integrations/[slug]/page.tsx b/apps/docs/app/[lang]/integrations/[slug]/page.tsx
index 7831ea401..683abe995 100644
--- a/apps/docs/app/[lang]/integrations/[slug]/page.tsx
+++ b/apps/docs/app/[lang]/integrations/[slug]/page.tsx
@@ -3,11 +3,7 @@ import type { Metadata } from "next";
import Link from "next/link";
import { notFound } from "next/navigation";
import { Suspense } from "react";
-import {
- buildConnectionConfigure,
- buildConnectionInstall,
- buildConnectionSetup,
-} from "@/lib/integrations/connection-setup";
+import { buildConnectionInstall, buildConnectionSetup } from "@/lib/integrations/connection-setup";
import {
getIntegration,
integrations,
@@ -66,9 +62,7 @@ const IntegrationDetailPage = async ({ params }: PageProps<"/[lang]/integrations
const isConnection = Boolean(integration.connection);
const install = isConnection ? buildConnectionInstall(integration) : (integration.install ?? "");
- const configure = isConnection
- ? buildConnectionConfigure(integration)
- : (integration.configure ?? "");
+ const configure = integration.configure ?? "";
const setup = isConnection ? buildConnectionSetup(integration) : null;
return (
@@ -140,7 +134,23 @@ const IntegrationDetailPage = async ({ params }: PageProps<"/[lang]/integrations
)}
</Section>
<Section title="Configure">
- <Markdown>{configure}</Markdown>
+ {setup ? (
+ <Suspense
+ fallback={
+ <Markdown>
+ {setup.configureVariants[`${setup.protocols[0]}:${setup.authModes[0]}`] ?? ""}
+ </Markdown>
+ }
+ >
+ <SetupTabs
+ authModes={setup.authModes}
+ protocols={setup.protocols}
+ variants={setup.configureVariants}
+ />
+ </Suspense>
+ ) : (
+ <Markdown>{configure}</Markdown>
+ )}
</Section>
</div>
</main>
diff --git a/apps/docs/lib/integrations/connection-setup.test.ts b/apps/docs/lib/integrations/connection-setup.test.ts
index 2e5f082f6..32095ce53 100644
--- a/apps/docs/lib/integrations/connection-setup.test.ts
+++ b/apps/docs/lib/integrations/connection-setup.test.ts
@@ -42,18 +42,35 @@ describe("Kernel extension setup", () => {
});
describe("Vercel MCP connection setup", () => {
- it("uses Vercel's MCP endpoint and Connect service", () => {
+ it("offers user OAuth and shared app credential setup", () => {
const integration = getIntegration("vercel")!;
- const quickStart = buildConnectionSetup(integration).variants["mcp:user"];
+ const setup = buildConnectionSetup(integration);
+ const userQuickStart = setup.variants["mcp:user"];
+ const appQuickStart = setup.variants["mcp:app"];
+
+ expect(setup.authModes).toEqual(["user", "app"]);
+ expect(userQuickStart).toContain('url: "https://mcp.vercel.com"');
+ expect(userQuickStart).toContain('auth: connect("vercel")');
+ expect(appQuickStart).toContain(
+ 'auth: connect({ connector: "vercel/your-connector", principalType: "app" })',
+ );
+ const userConfigure = setup.configureVariants["mcp:user"];
+ const appConfigure = setup.configureVariants["mcp:app"];
+
+ expect(userConfigure).toContain("vercel connect create vercel --name vercel");
+ expect(userConfigure).toContain("Select None");
+ expect(userConfigure).not.toContain("create api-key");
+ expect(appConfigure).toContain("vercel connect create api-key --name vercel");
+ expect(appConfigure).not.toContain("Select None");
+ expect(appConfigure).toContain(
+ "[Vercel token](https://vercel.com/kb/guide/how-do-i-use-a-vercel-api-access-token)",
+ );
+ expect(appConfigure).toContain("copy the returned connector UID into the App example");
+ expect(appConfigure).toContain("token still belongs to the user who created it");
- expect(quickStart).toContain('url: "https://mcp.vercel.com"');
- expect(quickStart).toContain('auth: connect("vercel")');
const configure = buildConnectionConfigure(integration);
- expect(configure).toContain("vercel connect create vercel");
+ expect(configure).toContain("### MCP · User");
+ expect(configure).toContain("### MCP · App");
expect(configure).not.toContain("vercel connect attach");
- expect(configure.indexOf("vercel link")).toBeLessThan(
- configure.indexOf("vercel connect create vercel"),
- );
- expect(configure).toContain("select None");
});
});
diff --git a/apps/docs/lib/integrations/connection-setup.ts b/apps/docs/lib/integrations/connection-setup.ts
index 04e2fe653..1ebde48aa 100644
--- a/apps/docs/lib/integrations/connection-setup.ts
+++ b/apps/docs/lib/integrations/connection-setup.ts
@@ -4,6 +4,7 @@ import {
type ConnectionSpec,
type Integration,
authModeLabel,
+ protocolLabel,
} from "./data";
/**
@@ -15,12 +16,15 @@ export interface ConnectionSetup {
authModes: AuthMode[];
/** Generated quick-start markdown keyed by `"<protocol>:<auth>"`. */
variants: Record<string, string>;
+ /** Generated configure markdown keyed by `"<protocol>:<auth>"`. */
+ configureVariants: Record<string, string>;
}
export const setupKey = (protocol: ConnectionProtocol, auth: AuthMode): string =>
`${protocol}:${auth}`;
-const connectorOf = (slug: string, spec: ConnectionSpec): string => spec.connector ?? slug;
+const connectorOf = (slug: string, spec: ConnectionSpec, auth?: AuthMode): string =>
+ (auth === undefined ? undefined : spec.connectors?.[auth]) ?? spec.connector ?? slug;
/** The TypeScript connection file for one (protocol, auth) combination. */
const buildSnippet = (
@@ -32,7 +36,7 @@ const buildSnippet = (
if (!spec) {
return "";
}
- const connector = connectorOf(integration.slug, spec);
+ const connector = connectorOf(integration.slug, spec, auth);
const description = spec.description ?? integration.tagline;
const defineFn = protocol === "mcp" ? "defineMcpClientConnection" : "defineOpenAPIConnection";
const transport = protocol === "mcp" ? spec.mcp : spec.openapi;
@@ -125,44 +129,19 @@ const buildVariant = (
].join("\n");
};
-/** All quick-start variants for a connection, plus its switcher options. */
-export const buildConnectionSetup = (integration: Integration): ConnectionSetup => {
- const spec = integration.connection;
- const protocols = spec ? (integration.protocols ?? []) : [];
- const authModes = spec?.authModes ?? [];
- const variants: Record<string, string> = {};
- for (const protocol of protocols) {
- for (const auth of authModes) {
- variants[setupKey(protocol, auth)] = buildVariant(integration, protocol, auth);
- }
- }
- return { protocols, authModes, variants };
-};
-
-/** Generated Install markdown for a connection. */
-export const buildConnectionInstall = (integration: Integration): string => {
- if (!integration.connection) {
- return "";
- }
- return [
- "Add the connection from eve's registry. This writes the initial definition under `agent/connections/` and installs its authentication dependency when needed:",
- ``,
- "```bash",
- `eve add connection/${integration.slug}`,
- "```",
- ].join("\n");
-};
-
-/** Generated Configure markdown for a connection. */
-export const buildConnectionConfigure = (integration: Integration): string => {
+/** Configure markdown for one auth mode. */
+const buildConfigureVariant = (integration: Integration, auth: AuthMode): string => {
const spec = integration.connection;
if (!spec) {
return "";
}
const sections: string[] = [];
- if (spec.authModes.some((auth) => auth !== "apiKey")) {
- const connector = connectorOf(integration.slug, spec);
- const connectorService = spec.connectorService ?? connector;
+
+ if (auth !== "apiKey") {
+ const connector = connectorOf(integration.slug, spec, auth);
+ const modeService = spec.connectorServices?.[auth];
+ const connectorService = modeService ?? spec.connectorService ?? connector;
+ const namedConnector = modeService !== undefined || spec.connectorService !== undefined;
sections.push(
[
"Link your project, create the connector, and pull OIDC locally:",
@@ -170,7 +149,7 @@ export const buildConnectionConfigure = (integration: Integration): string => {
"```bash",
"vercel link",
`vercel connect create ${connectorService}${
- spec.connectorService === undefined ? "" : ` --name ${integration.slug}`
+ namedConnector ? ` --name ${integration.slug}` : ""
}`,
"vercel env pull",
"```",
@@ -178,7 +157,7 @@ export const buildConnectionConfigure = (integration: Integration): string => {
);
}
- if (spec.apiKey) {
+ if (auth === "apiKey" && spec.apiKey) {
sections.push(
[
`Set \`${spec.apiKey.env}\` as a server-side environment variable:`,
@@ -190,12 +169,16 @@ export const buildConnectionConfigure = (integration: Integration): string => {
);
}
- if (spec.authModes.includes("jwtBearer")) {
+ if (auth === "jwtBearer") {
sections.push(
'For JWT bearer, `principalToSubject` controls the asserted subject. The default maps app principals to `{ type: "app" }` and user principals to `{ type: "user", id, issuer }`.',
);
}
+ const modeNote = spec.configureNotes?.[auth];
+ if (modeNote) {
+ sections.push(modeNote);
+ }
if (spec.configureNote) {
sections.push(spec.configureNote);
}
@@ -206,5 +189,49 @@ export const buildConnectionConfigure = (integration: Integration): string => {
return sections.join("\n\n");
};
+/** All quick-start and configure variants for a connection, plus their switcher options. */
+export const buildConnectionSetup = (integration: Integration): ConnectionSetup => {
+ const spec = integration.connection;
+ const protocols = spec ? (integration.protocols ?? []) : [];
+ const authModes = spec?.authModes ?? [];
+ const variants: Record<string, string> = {};
+ const configureVariants: Record<string, string> = {};
+ for (const protocol of protocols) {
+ for (const auth of authModes) {
+ const key = setupKey(protocol, auth);
+ variants[key] = buildVariant(integration, protocol, auth);
+ configureVariants[key] = buildConfigureVariant(integration, auth);
+ }
+ }
+ return { protocols, authModes, variants, configureVariants };
+};
+
+/** Generated Install markdown for a connection. */
+export const buildConnectionInstall = (integration: Integration): string => {
+ if (!integration.connection) {
+ return "";
+ }
+ return [
+ "Add the connection from eve's registry. This writes the initial definition under `agent/connections/` and installs its authentication dependency when needed:",
+ ``,
+ "```bash",
+ `eve add connection/${integration.slug}`,
+ "```",
+ ].join("\n");
+};
+
+/** Generated Configure markdown for a connection. */
+export const buildConnectionConfigure = (integration: Integration): string => {
+ const setup = buildConnectionSetup(integration);
+ return setup.protocols
+ .flatMap((protocol) =>
+ setup.authModes.map((auth) => {
+ const content = setup.configureVariants[setupKey(protocol, auth)] ?? "";
+ return `### ${protocolLabel[protocol]} · ${authModeLabel[auth]}\n\n${content}`;
+ }),
+ )
+ .join("\n\n");
+};
+
/** Human label for an auth-mode switcher button. */
export const authModeButtonLabel = (auth: AuthMode): string => authModeLabel[auth];
diff --git a/apps/docs/lib/integrations/data.ts b/apps/docs/lib/integrations/data.ts
index d6dae74c1..3e4407bfc 100644
--- a/apps/docs/lib/integrations/data.ts
+++ b/apps/docs/lib/integrations/data.ts
@@ -41,13 +41,17 @@ export interface ApiKeySpec {
* Structured description of a connection consumed by the detail page to
* generate Install, Quick start, and Configure content. Transport (`mcp`,
* `openapi`) and `description` are filled from the shared catalog identity;
- * `authModes`, `connector`, and `configureNote` are the docs-only overlay.
+ * Auth modes, connectors, and configure notes are the docs-only overlay.
*/
export interface ConnectionSpec {
/** Vercel Connect connector UID; defaults to the integration slug. */
connector?: string;
+ /** Auth-mode-specific connector UIDs when one service needs separate connectors. */
+ connectors?: Partial<Record<AuthMode, string>>;
/** Service passed to `vercel connect create` when it differs from the connector UID. */
connectorService?: string;
+ /** Auth-mode-specific services passed to `vercel connect create`. */
+ connectorServices?: Partial<Record<AuthMode, string>>;
/** Supported auth modes in display order; the first is the default. */
authModes: AuthMode[];
/** API-key wiring when `authModes` includes `apiKey`. */
@@ -56,8 +60,10 @@ export interface ConnectionSpec {
description?: string;
mcp?: ConnectionIdentity["mcp"];
openapi?: ConnectionIdentity["openapi"];
- /** Optional one-line, provider-specific configure note. Keep it short. */
+ /** Optional provider-specific configure guidance, rendered as markdown. */
configureNote?: string;
+ /** Auth-mode-specific configure guidance, rendered as markdown. */
+ configureNotes?: Partial<Record<AuthMode, string>>;
}
export interface Integration {
@@ -116,8 +122,11 @@ interface ConnectionPresentation extends Presentation {
authModes: AuthMode[];
apiKey?: ApiKeySpec;
connector?: string;
+ connectors?: Partial<Record<AuthMode, string>>;
connectorService?: string;
+ connectorServices?: Partial<Record<AuthMode, string>>;
configureNote?: string;
+ configureNotes?: Partial<Record<AuthMode, string>>;
}
const channelPresentations: Record<string, ChannelPresentation> = {
@@ -1471,11 +1480,15 @@ const connectionPresentations: Record<string, ConnectionPresentation> = {
logo: "vercel",
docsHref: "https://vercel.com/docs/agent-resources/vercel-mcp",
keywords: ["mcp", "projects", "deployments", "logs", "oauth", "connect"],
- authModes: ["user"],
+ authModes: ["user", "app"],
connector: "vercel",
+ connectors: { app: "vercel/your-connector" },
connectorService: "vercel",
- configureNote:
- "When the Connect form asks for a token authentication method, select None. Vercel MCP completes OAuth when the agent first calls an authenticated tool.",
+ connectorServices: { app: "api-key" },
+ configureNotes: {
+ user: "Select None when prompted for a token authentication method. Each user completes OAuth when needed.",
+ app: "Enter a team-scoped [Vercel token](https://vercel.com/kb/guide/how-do-i-use-a-vercel-api-access-token) when prompted, then copy the returned connector UID into the App example. This avoids per-user OAuth, though the Vercel token still belongs to the user who created it.",
+ },
},
linear: {
logo: "linear",
@@ -1993,12 +2006,17 @@ function buildConnection(entry: IntegrationEntry): Integration {
};
if (presentation.apiKey !== undefined) spec.apiKey = presentation.apiKey;
if (presentation.connector !== undefined) spec.connector = presentation.connector;
+ if (presentation.connectors !== undefined) spec.connectors = presentation.connectors;
if (presentation.connectorService !== undefined) {
spec.connectorService = presentation.connectorService;
}
+ if (presentation.connectorServices !== undefined) {
+ spec.connectorServices = presentation.connectorServices;
+ }
if (identity.mcp !== undefined) spec.mcp = identity.mcp;
if (identity.openapi !== undefined) spec.openapi = identity.openapi;
if (presentation.configureNote !== undefined) spec.configureNote = presentation.configureNote;
+ if (presentation.configureNotes !== undefined) spec.configureNotes = presentation.configureNotes;
return {
slug: entry.slug,
name: entry.name,