/iblai-vibe:iblai-vibe-agent-mcpfrom ibl.ai vibe
Adds an agent MCP tab to Next.js apps for managing external service connectors (Featured, Directory, custom) with per-agent on/off switches, OAuth/API key/no auth, sign-in scope, and a chat composer MCP panel.
Ships in ibl.ai vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Add the agent MCP tab -- the outside services (Model Context Protocol
servers) an agent can use in chats. The tab opens with the agent's MCP
switch; while it is off the connectors stay on the agent, greyed out.
Featured connectors are curated by the platform, Directory lists the
MCP directory plus the organization's own connectors, and every card has one
switch: on or off for this agent.
Configure (the gear) sets how a connector signs in for the agent, whether
users may turn it off, and the organization's own OAuth app. The same
connectors reach the chat: the composer's + menu gets an MCP row with
a per-chat switch per connector, which every user can use. This is one tab
in the agent-settings family; all tabs share AgentSettingsProvider.








Common setup (brand, conventions, env files, verification): see docs/skill-setup.md.
/iblai-vibe-auth)@iblai/mcp in .mcp.json)AgentSettingsProvider must wrap the route (see /iblai-vibe-agent-setting
Step 2 if not already set up)@iblai/iblai-js@^3.6.0 (resolves @iblai/web-containers 2.6.0): the
Featured / Directory tabs, per-agent sign-in scope, "Allow Users to Turn
Off", App Credentials and the chat's MCP panel arrived in
@iblai/web-containers 1.58.1, the MCP switch in 2.0.0mentorId (agent UUID). Do NOT invent one.Check for an iblai.env in the project root with PLATFORM, DOMAIN, and
TOKEN. If it is missing, ask the user to download the template and fill it in:
curl -o iblai.env https://raw.githubusercontent.com/iblai/vibe/refs/heads/main/iblai.env
McpTab// app/(app)/agents/[mentorId]/mcp/page.tsx
"use client";
import { McpTab } from "@iblai/iblai-js/web-containers/next";
export default function AgentMCPPage() {
return (
<div className="flex h-full flex-col bg-white">
<McpTab />
</div>
);
}
McpTab reads tenantKey, mentorId, username, enableRBAC and
rbacPermissions from AgentSettingsProvider; no props are required.
Inside a picker (the workflow editor's MCP step uses this) pass onSelect:
every card gets a Select button and the MCP switch is left out; picking
a connector that is off turns it on for the agent first (opening its shared
sign-in when needed), then calls the handler.
import { McpTab } from "@iblai/iblai-js/web-containers/next";
<McpTab
onSelect={(server) => {
console.log("connector selected", server.id, server.name);
}}
/>;
mcpApiSlice in the storeThe MCP endpoints live on their own slice that mentorReducer /
mentorMiddleware do not include, and the Chat composer queries them in
every signed-in chat (for the + menu's MCP row). Without it pnpm dev
throws Middleware for RTK-Query API at reducerPath "mcpApiSlice" has not been added to the store on the home chat, and a production build stores
no MCP response: no MCP row, and the tab never gets its lists. vibe-starter
ships the two lines; an older store needs them added:
// store/iblai-store.ts
import { configureStore } from "@reduxjs/toolkit";
import {
coreApiSlice,
mentorReducer,
mentorMiddleware,
mcpApiSlice,
} from "@iblai/iblai-js/data-layer";
import {
hostChatReducer,
chatInputSliceReducer,
chatSliceReducerShared,
filesReducer,
rbacReducer,
subscriptionReducer,
topBannerReducer,
appleRestrictionReducer,
} from "@iblai/iblai-js/web-utils";
export const iblaiStore = configureStore({
reducer: {
[coreApiSlice.reducerPath]: coreApiSlice.reducer,
...mentorReducer,
[mcpApiSlice.reducerPath]: mcpApiSlice.reducer, // + MCP
chat: hostChatReducer,
chatInput: chatInputSliceReducer,
chatSliceShared: chatSliceReducerShared,
files: filesReducer,
rbac: rbacReducer,
subscription: subscriptionReducer,
topBanner: topBannerReducer,
appleRestriction: appleRestrictionReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({ serializableCheck: false })
.concat(coreApiSlice.middleware)
.concat(mcpApiSlice.middleware) // + MCP
.concat(...mentorMiddleware),
});
export type IblaiRootState = ReturnType<typeof iblaiStore.getState>;
export type IblaiAppDispatch = typeof iblaiStore.dispatch;
A Connect opens the service's sign-in in a new tab. Where the user
lands afterwards is the redirect URI stored on the organization's OAuth
client for that service, which the SDK sets to this app's
/google-oauth-callback/ (the path is fixed) when the client is registered
from this app: Add with OAuth sends this origin's page as oauth-find's
callback_url, and App Credentials defaults the Redirect URI to it.
Featured connectors on the shared ibl.ai app return to the platform's own
page; the tab still completes, since it also polls the user's connected
services every 5 s for five minutes. vibe-starter does not ship the page,
so add it. It finishes the handshake through the SDK's callback query and
tells the opener both ways the SDK listens: postMessage and localStorage.
The stored address is organization-wide: an OAuth connector first added
from http://localhost:3000 sends that service's sign-ins for the whole
organization, os.ibl.ai included, to localhost. Add OAuth connectors from the
deployed host, never from a dev server.
// app/google-oauth-callback/page.tsx
"use client";
import { Suspense, useEffect, useRef } from "react";
import { useSearchParams } from "next/navigation";
import { useLazyConnectedServicesCallbackQuery } from "@iblai/iblai-js/data-layer";
export default function OAuthCallbackPage() {
// useSearchParams() needs a Suspense boundary in the App Router.
return (
<Suspense fallback={null}>
<OAuthCallback />
</Suspense>
);
}
function OAuthCallback() {
const searchParams = useSearchParams();
const [finishSignIn] = useLazyConnectedServicesCallbackQuery();
const started = useRef(false);
useEffect(() => {
if (started.current) return;
started.current = true;
// Relay the provider's query string as is (never alter `state`).
const params: Record<string, string> = {};
searchParams.forEach((value, key) => {
params[key] = value;
});
params.redirect_uri = `${window.location.origin}/google-oauth-callback/`;
finishSignIn(params)
.unwrap()
.then((result) => {
const done = {
connectedServiceId: result?.id as number | undefined,
provider: result?.provider as string | undefined,
serviceName: result?.service as string | undefined,
serverId: readPendingServer()?.serverId,
timestamp: Date.now(),
};
window.opener?.postMessage(
{ type: "GOOGLE_AUTH_SUCCESS", ...done },
window.location.origin,
);
try {
localStorage.setItem("oauth_connection_complete", JSON.stringify(done));
} catch {
// Private mode: the postMessage above still reaches the opener.
}
})
.catch(() => {
// The opener keeps polling and gives up after its own timeout.
})
.finally(() => setTimeout(() => window.close(), 1000));
}, [searchParams, finishSignIn]);
return <p className="p-6 text-sm text-gray-600">Finishing sign-in…</p>;
}
// The SDK stores the connector a sign-in was started for.
function readPendingServer(): { serverId?: number } | null {
try {
return JSON.parse(localStorage.getItem("oauth_pending_server") ?? "null");
} catch {
return null;
}
}
Keep the page outside AuthProvider / TenantProvider, as the starter
does for /sso-login: the callback endpoint needs no session, and if the
auth check fails in the tab (an expired token, a sign-out elsewhere) the
redirect keeps only the pathname, so code and state are lost and the
opener gives up after five minutes. In providers/iblai-providers.tsx,
widen the one check both providers' skip reads:
const isSsoRoute =
(pathname?.startsWith("/sso-login") || pathname?.startsWith("/google-oauth-callback")) ?? false;
For a connector that signs in through the organization's own OAuth app,
https://<your host>/google-oauth-callback/ is the Redirect URI to
register with the service (the Configure dialog shows and copies it).
Ask @iblai/mcp: get_component_info("McpTab"), get_component_info("McpServersMenu"),
get_component_info("AgentSettingsProvider"), get_api_query_info("useGetMCPServersQuery").
<McpTab> PropsImport from @iblai/iblai-js/web-containers/next.
| Prop | Type | Required | Description |
|---|---|---|---|
onSelect | (server: MCPServer) => void | No | Adds a Select button to every card. Without it the tab is the agent's manager view. |
showCapabilitySwitch | boolean | No | Show the agent's MCP switch above the connectors. Defaults to true, and to false with onSelect. Pass false where the agent is still being set up (a create wizard): its first connector turned on turns MCP on. |
capability_* flag: it is on while the mcp
tool is on the agent, so the switch adds or removes that one tool ("MCP
turned on" / "MCP turned off") and keeps the connectors. Locked when the
person may not change the agent's tools, left out when they can't read
them; a spinner shows until the settings load. A refused save shows one
sentence under it ("MCP doesn't work with the model this agent uses. Pick
another model in the LLM tab, then try again.").created_at),
and a transport filter (All / SSE / WebSocket / Streamable HTTP; the
WebSocket choice makes the list requests fail, see below).is_featured), Directory is everything else the agent may use: the
MCP directory (registry.source === "registry") and the organization's
own connectors (include_global, agent-bound ones included). 12 cards a
page, with a pager per list.mcp_servers and, when missing, the mcp
tool; off removes it (the last one off drops mcp only where the MCP
switch is not shown). A connector that signs in once for everyone (scope
Agent or Organization) with no such sign-in yet also opens that sign-in
when switched on. Every card switch is locked while one saves; a refused
save toasts one sentence ("Couldn't turn on Slack. Try again.")./mcpservers/#create permission.| Field | Notes |
|---|---|
| Connector image | Optional file upload (image/*, under 2 MB). |
| Connector Name | Required -- the name people see in the chat and in agent settings. |
| Connector Server | Required -- the MCP server's address (https://…). |
| Description | Optional -- shows on the card. |
| Connector Scope | All Agents (mentor: null) or This Agent (mentor: <uuid>) -- which agents in the organization may use it. |
| Allow Users to Turn Off | On (default): people can switch it off in their own chats. Off: it stays on in every chat and nobody can switch it off (user_can_disable: false). |
| Transport | Streamable HTTP (default) or SSE. WebSocket is still offered, but the platform refuses it (transport accepts sse and streamable_http only; Connect answers 400). |
| Authentication Method | No Authentication, API Key or OAuth. |
| Token Type / Token | API Key only: Bearer or a custom scheme, and the key (hidden after save; leave it to keep the stored one). |
| Authentication Scope | OAuth only: User (each person signs in with their own account from the chat), Agent (one shared account for everyone who chats with this agent) or Organization (one shared account for every agent). |
Connect saves the connector and turns it on for the agent. For OAuth it
first asks the platform to find the service's sign-in settings
(oauth-find), then opens the sign-in. When the service cannot register an
app by itself, publishes no sign-in settings, or the organization already
has an app for it, the dialog stays open and shows App Credentials: the
Redirect URI to register with the service (copy button), Client ID,
Client Secret (blank for a public app), and under Advanced the
Permissions (scopes, pre-filled from what was discovered), How the Secret
Is Sent (in the request, HTTP Basic, or none), Extra Sign-In / Token
Settings (name=value lines), and the Authorization URL / Token URL
when the service publishes none. Save, and the sign-in opens through that
app. A server that did not answer, a blocked address or a timeout shows one
sentence under the address instead.
The gear opens the same form on an existing connector. For the organization's own connector everything is editable (changing the server address of an OAuth connector restarts the sign-in). For a featured or directory connector the fields are read-only; only two settings, both for this agent, and the organization's App Credentials can change:
Under Authentication Scope, Connection (only for a connector with a sign-in service) shows Connected / Not Connected with Connect or Disconnect for the saved scope: the admin's own sign-in for User scope, the shared account otherwise. Disconnecting a shared sign-in also turns the connector off for the agent. App Credentials shows the organization's app for an OAuth connector (secret masked, "Saved. Enter a new one to replace it."), with Remove Credentials; everyone who signed in through it must sign in again.
Chat (/iblai-vibe-agent-chat) adds an MCP row to the composer's +
menu by itself when the user is signed in, the chat is not embedded, the
agent has at least one connector on, and MCP is on for the agent (off: its
tools are readable and mcp is not among them). The row's badge counts the
connectors on for this chat and signed in. The panel lists the agent's
connectors (name, logo, description) with one switch each:
With RBAC off, anyone who can chat gets the panel. With RBAC on, the row
needs read access to the agent's mcp_servers field
(Ibl.Mentor/Settings/mcp_servers/read): the seeded chat role does not
have it, the settings read then omits the servers, and students see no MCP
row until the role is granted it. Embedded chats (embed) never show the
row.
The tab shows a control when the RBAC grant allows it; the platform then decides for itself, and the two do not always agree:
| Control | The tab shows it with | The platform accepts it from |
|---|---|---|
| The MCP switch | read / write on the agent's mentor_tools field (no switch without read) | the same as the per-agent switch (one settings PUT) |
| Cards and the per-agent switch | read / write on the agent's mcp_servers field | whoever may write the agent's settings |
| Add Connector | /mcpservers/#create in the provider's rbacPermissions, even with enableRBAC off (no grant, no button): load it with useGetRbacPermissionsMutation (resources: ["/mcpservers/"]) into a nested AgentSettingsProvider, as /iblai-vibe-agent-dataset Step 2 does | the same |
| Delete | the connector's object delete permission (own connectors only) | the owning organization |
| Authentication Scope (Configure) | write on mcp_servers | an organization admin or the Platform API Token (mentor-auth-scope/ answers 403 "A mentor's MCP connection mode is set by platform admins." to anyone else, and 404 while the connector is off for the agent, which is why the tab stores the choice when the switch goes on) |
| App Credentials | /mcpservers/#create | an organization admin or the Platform API Token (credentials/ answers 403 "MCP server credentials are limited to platform admins.") |
| Allow Users to Turn Off on a featured / directory connector | write on mcp_servers | the owning organization only (404 otherwise) |
| The chat's MCP panel | signing in, plus read on mcp_servers when RBAC is on | the user's own preferences |
With enableRBAC off, the other controls hide or lock only where the platform's
permissions say no (a missing entry counts as allowed); its rules still apply.
| Setting | Where | Wire | Who it affects |
|---|---|---|---|
| MCP on / off | the tab's MCP switch | the mcp tool slug in the agent's tool_slugs | every connector of this agent |
| Connector Scope | Add / Configure | mentor on the server (null = all agents) | which agents may list it |
| On / Off for this agent | the card | the agent's mcp_servers (+ the mcp tool slug when missing) | this agent's chats |
| Authentication Scope | Configure | auth_scope (user / mentor / platform) and the agent's override, read back as effective_auth_scope | whose account the agent signs in with |
| Allow Users to Turn Off | Add / Configure | user_can_disable | whether the chat's switch (and the user's lasting choice) can move |
| On / Off for this chat | the chat's MCP panel | the user's session preference; read back as user_enabled when the list is fetched with the conversation's session_id | one conversation of one user |
McpServersMenuThe chat's panel is also exported on its own, from @iblai/iblai-js/web-containers.
| Prop | Type | Required | Description |
|---|---|---|---|
tenantKey | string | Yes | Organization key. |
username | string | Yes | The signed-in user. |
mentorId | string | Yes | The agent's unique id (UUID). |
sessionId | string | No | The open conversation. With it every row gets the per-chat switch; without it a switch is shown only to sign in. |
onClose | () => void | Yes | The panel's close button. |
onConnectingChange | (connecting: boolean) => void | No | True while a sign-in is in flight: keep the panel mounted until it settles, or the sign-in is lost. |
Run /iblai-vibe-ops-test before telling the user the work is ready, and give
every page, control and state this skill added its own checkpoint — one Playwright
test titled <ID> · … in e2e/journeys/, listed in e2e/coverage.json;
pnpm e2e:coverage must pass:
pnpm build -- must pass with zero errorspnpm test -- vitest must pass/agents/<id>/mcp in the browser as /iblai-vibe-ops-test
says: turn the MCP switch on ("MCP turned on"), switch a Directory
connector on and off, open Configure on a featured one, add a connector
with No Authentication, then open the home chat and check the + menu's
MCP row and its switch; turn MCP off -- the connectors grey out and the
chat's MCP row is gone; read the console, check the phone width.initializeDataLayer(): 5 args (v1.2+); @reduxjs/toolkit deduplicated via webpack aliases in next.config.tssonner and @iblai/iblai-web-mentor (pnpm add sonner @iblai/iblai-web-mentor)AgentSettingsProvider wraps the route at layout level (/iblai-vibe-agent-setting Step 2).is_enabled: false, set
through the API) is never used, whatever the agent or the user chose, and
does not appear in the chat's panel.AgentToolsTab was removed in @iblai/web-containers
2.0.0; the MCP switch reads no flag, so it works on any platform version.From @iblai/iblai-js/web-containers/next: McpTab, McpTabProps; from
@iblai/iblai-js/web-containers: McpServersMenu, McpServersMenuProps.
From @iblai/iblai-js/data-layer -- the hooks the tab and the panel use,
for custom UI: useGetMCPServersQuery (mentorUniqueId, includeGlobal,
isFeatured, isEnabled, sessionId, search, transport, pageSize),
useCreateMCPServerMutation, usePartialUpdateMCPServerMutation,
useDeleteMCPServerMutation, useOauthFindMutation,
useLazyStartOAuthFlowQuery, useLazyConnectedServicesCallbackQuery,
useGetConnectedServicesQuery, useDisconnectServiceMutation,
useGetMCPServerConnectionsQuery, useCreateMCPServerConnectionMutation,
useGetMCPServerMentorAuthScopeQuery / useSetMCPServerMentorAuthScopeMutation,
useGetMCPServerPreferenceQuery / useSetMCPServerPreferenceMutation,
useGetMCPServerSessionPreferenceQuery / useSetMCPServerSessionPreferenceMutation,
useGetMCPServerCredentialsQuery / useSetMCPServerCredentialsMutation /
useDeleteMCPServerCredentialsMutation; types MCPServer,
MCPServerConnection, ConnectedService, MCPAuthScope,
MCPServerOAuthCredentials, OAuthFindDiagnostic.
Under ${dmUrl}/api/ai-mentor/orgs/{org}/users/{user_id}/, where dmUrl is
${NEXT_PUBLIC_API_BASE_URL}/dm (config.dmUrl() in the starter); sign-in
services under ${dmUrl}/api/ai-account/. Bodies and errors: /iblai-api-agent-mcp.
| What the UI does | Call |
|---|---|
| List a tab | GET mcp-servers/?mentor_unique_id=&include_global=true&is_featured=…&page_size=12 |
| Add / edit / delete a connector | POST / PATCH / DELETE mcp-servers/[{id}/] (multipart with image; user_can_disable, mentor, auth_scope, oauth_service) |
| Find a service's sign-in settings | POST mcp-servers/oauth-find/ (url, name, callback_url; with the organization's own app: client_id, client_secret, scopes, token_endpoint_auth_method, authorization_url, token_url) |
| The organization's app for a connector | GET / PUT / DELETE mcp-servers/{id}/credentials/ (secrets come back masked) |
| How a connector signs in for this agent | GET / PUT mcp-servers/{id}/mentor-auth-scope/ (mentor, auth_scope; null restores the connector's own) |
| The MCP switch | PUT mentors/{mentor}/settings/ with tool_slugs plus mcp (and can_use_tools: true when the agent could not use tools), or minus mcp as JSON |
| A card on / off for the agent | PUT mentors/{mentor}/settings/ as JSON with mcp_servers (on: plus tool_slugs with mcp when missing, and can_use_tools: true; the last one off where no MCP switch shows: plus tool_slugs without mcp); can_use_tools: false is never sent |
| Start a sign-in | GET …/ai-account/connected-services/orgs/{org}/users/{user_id}/{provider}/{service}/ → auth_url |
| Finish it | GET …/ai-account/connected-services/callback/?code=…&state=…&redirect_uri=… (the Step 4 page) |
| Bind the sign-in | POST mcp-server-connections/ (server, scope, auth_type: "oauth2", connected_service, mentor for Agent scope) |
| Disconnect | DELETE …/ai-account/connected-services/orgs/{org}/users/{user_id}/{id}/ |
| The chat's switch | GET / PUT mcp-servers/{id}/session-preference/ (session_id, is_enabled); the lasting choice is preference/ |
iblai-vibe-agent-mcp-add.png (opens in a new tab)iblai-vibe-agent-mcp-chat-menu.png (opens in a new tab)iblai-vibe-agent-mcp-chat-panel.png (opens in a new tab)iblai-vibe-agent-mcp-configure-advanced.png (opens in a new tab)iblai-vibe-agent-mcp-configure-credentials.png (opens in a new tab)iblai-vibe-agent-mcp-connectors.png (opens in a new tab)iblai-vibe-agent-mcp-edit.png (opens in a new tab)iblai-vibe-agent-mcp-featured.png (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iblai/base --plugin iblai-vibe166 skills in this plugin
/iblai-api-agent-accessManage role-based access to an ibl.ai agent via the platform API — list role policies, search users/groups, and grant/revoke editor, chat, or analytics_viewer roles for users, groups, and emails. Use when controlling who can edit, chat with, or view analytics for an agent./iblai-api-agent-auditRead an ibl.ai agent's audit log via the platform API — a who-changed-what trail filterable by action, actor email, and date range. Read-only. Use when investigating configuration changes to an agent./iblai-api-agent-chatSet up live chat with a deployed ibl.ai agent by wiring the hosted iblai-api-agent-chat MCP server into the project (.mcp.json / claude mcp add) using the .env Api-Token and a chosen agent's unique id, or by signing in from claude.ai, ChatGPT or Claude Desktop with only the URL. Use to enable runtime conversations with an agent, and to list or disconnect the apps a user has connected. The actual chatting then happens through the MCP server's tools.Other plugins' skills for the same job