Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.
In a product, one agent serves many users. Each user should only ever reach their own accounts. With BundleUp, the connection ID is the only per-user input, so this comes down to looking up the right connection IDs for the user you’re serving.User A has connected Slack and Linear, so their agent run gets two MCP servers. User B has only connected Slack, so theirs gets one. Both runs use the same code and the same mcp.bundleup.io; only the connection IDs differ.
When a user connects an account, store (user_id, provider, connection_id) in your database. Setting external_id to your user ID when you start the authorization flow lets you recover this from BundleUp too.
When the user starts a conversation, load their connections.
Give the agent one MCP server per connection.
Never accept a connection ID from the client side. Always look it up server-side for the authenticated user.
Any API key in your workspace can use any connection in your workspace. BundleUp can’t know which of your users a connection belongs to. Picking the right connection for the signed-in user is your application’s job.
Your own MCP client: open one client per connection. Tool names come from each provider, so two providers can both have a search tool. Prefix each tool name with its label (for example slack__search) before giving the list to the model, and route calls back by that prefix.
Each MCP message counts as one request toward the connection’s rate limit (100 per minute) and toward usage. An agent that lists tools on every turn uses more than its tool calls suggest. Cache the tool list for the length of a conversation where your client allows it.
Listen for the connection.deletedwebhook and remove the connection from your database, so the next agent run doesn’t try to use it. If an MCP call fails with connection_invalid or connection_refresh_failed, prompt the user to reconnect.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"BundleUp","colors":{"primary":"#000","light":"#ffffff","dark":"#0f58d0"},"logo":{"light":"https://www.bundleup.io/logo-dark.png","dark":"https://www.bundleup.io/logo.png"},"favicon":"https://www.bundleup.io/favicon.ico","appearance":{"default":"system"},"navbar":{"links":[{"href":"https://www.bundleup.io/integrations","label":"Integrations"},{"href":"https://github.com/bundleup","label":"Github"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.bundleup.io"}},"footer":{"socials":{"x":"https://x.com/bundleupio","github":"https://github.com/bundleup"}},"integrations":{"ga4":{"measurementId":"G-TVEREMEC6C"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"interaction":{"drilldown":false},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bundleup","hasAudioNarration":false,"actualSubdomain":"bundleup","customDomains":["bundleup.io"],"gitSource":{"type":"github","owner":"bundleup","repo":"bundleup","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6acc5ee4e7a7c8a946e76915","clientVersion":"0.0.4088","searchFilterCounts":[{"language":"default","tag":"Documentation","count":52},{"language":"default","tag":"API Reference","count":42},{"language":"default","tag":"Unified API","count":32},{"language":"default","tag":"Platform API","count":13},{"language":"default","tag":"Get started","count":10},{"language":"default","tag":"Webhooks","count":8},{"language":"default","tag":"SDKs","count":8},{"language":"default","tag":"Concepts","count":7},{"language":"default","tag":"Git","count":7},{"language":"default","tag":"Platform","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/mcp/multi-tenant-agents","slug":"/guides/mcp/multi-tenant-agents","pageMetadata":{"title":"Agents for Many Users","description":"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.","href":"/guides/mcp/multi-tenant-agents"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`In a product, one agent serves many users. Each user should only ever reach `,_jsx(_components.strong,{children:`their own`}),` accounts. With BundleUp, the connection ID is the only per-user input, so this comes down to looking up the right connection IDs for the user you’re serving.`]}),`\n`,_jsx(Mermaid,{chart:`flowchart LR\n subgraph Users\n A[User A]\n B[User B]\n end\n subgraph DB[Your database]\n CA[\"A: slack → conn_a1\u003cbr/>A: linear → conn_a2\"]\n CB[\"B: slack → conn_b1\"]\n end\n A --> CA\n B --> CB\n CA -->|\"2 MCP servers\"| AG1[Agent run for A]\n CB -->|\"1 MCP server\"| AG2[Agent run for B]\n AG1 --> MCP[mcp.bundleup.io]\n AG2 --> MCP`}),`\n`,_jsxs(_components.p,{children:[`User A has connected Slack and Linear, so their agent run gets two MCP servers. User B has only connected Slack, so theirs gets one. Both runs use the same code and the same `,_jsx(_components.code,{children:`mcp.bundleup.io`}),`; only the connection IDs differ.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-pattern`,children:`The pattern`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`When a user connects an account, store `,_jsx(_components.code,{children:`(user_id, provider, connection_id)`}),` in your database. Setting `,_jsx(_components.code,{children:`external_id`}),` to your user ID when you start the `,_jsx(_components.a,{href:`/guides/auth/authorization-flow`,children:`authorization flow`}),` lets you recover this from BundleUp too.`]}),`\n`,_jsx(_components.li,{children:`When the user starts a conversation, load their connections.`}),`\n`,_jsx(_components.li,{children:`Give the agent one MCP server per connection.`}),`\n`,_jsx(_components.li,{children:`Never accept a connection ID from the client side. Always look it up server-side for the authenticated user.`}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Any API key in your workspace can use any connection in your workspace. BundleUp can’t know which of `,_jsx(_components.em,{children:`your`}),` users a connection belongs to. Picking the right connection for the signed-in user is your application’s job.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`several-providers-in-one-agent`,children:`Several providers in one agent`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Model-hosted MCP:`}),` pass one `,_jsx(_components.code,{children:`mcp`}),` tool entry per connection. The model provider keeps them apart by label.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` connections`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` db`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`connectionsFor`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. { slack: 'conn_a1', linear: 'conn_a2' }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tools`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`entries`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`connections`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(([`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`label`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`connectionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bundleup`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`mcp`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`connectionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`hosted`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'mcp'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` server_label:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` label`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` server_url:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` authorization:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` require_approval:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'never'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` openai`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`responses`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'gpt-4o'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`input`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Your own MCP client:`}),` open one client per connection. Tool names come from each provider, so two providers can both have a `,_jsx(_components.code,{children:`search`}),` tool. Prefix each tool name with its label (for example `,_jsx(_components.code,{children:`slack__search`}),`) before giving the list to the model, and route calls back by that prefix.`]}),`\n`,_jsx(Heading,{level:`2`,id:`keep-the-tool-list-short`,children:`Keep the tool list short`}),`\n`,_jsx(_components.p,{children:`Two or three providers can easily add up to 60 tools, and models choose less accurately as the list grows. Give each agent only the tools it needs:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Only attach the providers relevant to the task.`}),`\n`,_jsxs(_components.li,{children:[`Filter `,_jsx(_components.code,{children:`tools/list`}),` results to an allowlist before passing them to the model.`]}),`\n`,_jsxs(_components.li,{children:[`Narrow the integration’s `,_jsx(_components.a,{href:`/guides/integrations/scopes`,children:`scopes`}),`, so the provider exposes fewer tools in the first place.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`rate-limits-and-cost`,children:`Rate limits and cost`}),`\n`,_jsxs(_components.p,{children:[`Each MCP message counts as one request toward the connection’s `,_jsx(_components.a,{href:`/guides/proxy/rate-limits`,children:`rate limit`}),` (100 per minute) and toward `,_jsx(_components.a,{href:`/concepts/requests#what-counts-toward-usage`,children:`usage`}),`. An agent that lists tools on every turn uses more than its tool calls suggest. Cache the tool list for the length of a conversation where your client allows it.`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-a-user-disconnects`,children:`When a user disconnects`}),`\n`,_jsxs(_components.p,{children:[`Listen for the `,_jsx(_components.code,{children:`connection.deleted`}),` `,_jsx(_components.a,{href:`/guides/webhooks/events`,children:`webhook`}),` and remove the connection from your database, so the next agent run doesn’t try to use it. If an MCP call fails with `,_jsx(_components.code,{children:`connection_invalid`}),` or `,_jsx(_components.code,{children:`connection_refresh_failed`}),`, prompt the user to reconnect.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Agents for Many Users","description":"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.","href":"/guides/mcp/multi-tenant-agents"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The pattern","slug":"the-pattern","depth":2,"children":[]},{"title":"Several providers in one agent","slug":"several-providers-in-one-agent","depth":2,"children":[]},{"title":"Keep the tool list short","slug":"keep-the-tool-list-short","depth":2,"children":[]},{"title":"Rate limits and cost","slug":"rate-limits-and-cost","depth":2,"children":[]},{"title":"When a user disconnects","slug":"when-a-user-disconnects","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"bundleup","siteName":"BundleUp","title":"Agents for Many Users - BundleUp","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-06T13:08:06.894Z","originalFileLocation":"guides/mcp/multi-tenant-agents.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\">\u003cmeta data-mint-head name=\"application-name\" content=\"BundleUp\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/x-icon\" sizes=\"180x180\" href=\"https://www.bundleup.io/favicon.ico\">\u003clink data-mint-head rel=\"icon\" type=\"image/x-icon\" sizes=\"32x32\" href=\"https://www.bundleup.io/favicon.ico\">\u003clink data-mint-head rel=\"icon\" type=\"image/x-icon\" sizes=\"16x16\" href=\"https://www.bundleup.io/favicon.ico\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://www.bundleup.io/favicon.ico\">\u003cmeta data-mint-head property=\"og:title\" content=\"Agents for Many Users - BundleUp\">\u003cmeta data-mint-head property=\"og:description\" content=\"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"BundleUp\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://bundleup.mintlify.site/docs/_mintlify/api/og/v2?division=MCP\u0026amp;title=Agents+for+Many+Users\u0026amp;description=Run+one+agent+for+all+your+users%2C+give+each+user+their+own+accounts%2C+and+combine+several+providers+in+one+agent.\u0026amp;theme=0c03fc33512e6cc8d93233cc\u0026amp;signature=f2384f3baba6278f40d0575a57463fb9150980e1ef880ababd9ca222e7733f90\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Agents for Many Users - BundleUp\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://bundleup.mintlify.site/docs/_mintlify/api/og/v2?division=MCP\u0026amp;title=Agents+for+Many+Users\u0026amp;description=Run+one+agent+for+all+your+users%2C+give+each+user+their+own+accounts%2C+and+combine+several+providers+in+one+agent.\u0026amp;theme=0c03fc33512e6cc8d93233cc\u0026amp;signature=f2384f3baba6278f40d0575a57463fb9150980e1ef880ababd9ca222e7733f90\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/bundleup/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"BundleUp\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#000\">\u003clink data-mint-head rel=\"canonical\" href=\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/guides/mcp/multi-tenant-agents.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://bundleup.io/#organization\",\"name\":\"BundleUp\",\"url\":\"https://bundleup.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://www.bundleup.io/logo-dark.png\"}},{\"@type\":\"WebSite\",\"@id\":\"https://bundleup.io/docs#website\",\"name\":\"BundleUp\",\"url\":\"https://bundleup.io/docs\",\"publisher\":{\"@id\":\"https://bundleup.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents#webpage\",\"url\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents\",\"name\":\"Agents for Many Users\",\"description\":\"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\",\"dateModified\":\"2026-10-06T13:08:06.894Z\",\"isPartOf\":{\"@id\":\"https://bundleup.io/docs#website\"},\"breadcrumb\":{\"@id\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"MCP\",\"item\":\"https://bundleup.io/docs/guides/mcp/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Agents for Many Users\",\"item\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents#article\",\"headline\":\"Agents for Many Users\",\"name\":\"Agents for Many Users\",\"description\":\"Run one agent for all your users, give each user their own accounts, and combine several providers in one agent.\",\"url\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents\",\"mainEntityOfPage\":{\"@id\":\"https://bundleup.io/docs/guides/mcp/multi-tenant-agents#webpage\"},\"dateModified\":\"2026-10-06T13:08:06.894Z\",\"publisher\":{\"@id\":\"https://bundleup.io/#organization\"},\"isPartOf\":{\"@id\":\"https://bundleup.io/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"BundleUp\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"BundleUp","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get started","icon":"rocket","pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":""},{"title":"Why BundleUp","href":"/why-bundleup"},{"title":"How BundleUp Works","href":"/how-it-works"},{"title":"Use Cases","href":"/use-cases"},{"title":"Proxy vs Unified API vs MCP","sidebarTitle":"Choosing an API","href":"/choosing-a-surface"},{"title":"Quickstart","href":"/quickstart"},{"group":"Framework quickstarts","pages":[{"title":"Next.js Quickstart","sidebarTitle":"Next.js","href":"/quickstart/next-js"},{"title":"Django Quickstart","sidebarTitle":"Django","href":"/quickstart/django"},{"title":"Rails Quickstart","sidebarTitle":"Rails","href":"/quickstart/rails"},{"title":"AI Agent Quickstart","sidebarTitle":"AI agent","href":"/quickstart/ai-agent"}]}]},{"group":"Concepts","icon":"book","pages":[{"title":"Core Concepts","sidebarTitle":"Overview","href":"/concepts/overview"},{"title":"Workspaces","href":"/concepts/workspaces"},{"title":"Integrations","href":"/concepts/integrations"},{"title":"Connections","href":"/concepts/connections"},{"title":"Requests \u0026 Usage","href":"/concepts/requests"},{"title":"API Keys \u0026 Client ID","href":"/concepts/api-keys"},{"title":"Glossary","href":"/concepts/glossary"}]},{"group":"Authentication","icon":"key","pages":[{"title":"Connecting User Accounts","href":"/guides/auth/authorization-flow"},{"title":"Authenticating API Requests","href":"/guides/auth/authenticating-requests"},{"title":"Connection Lifecycle","href":"/guides/auth/connection-lifecycle"}]},{"group":"Integrations","icon":"puzzle-piece","pages":[{"title":"Setting Up an Integration","href":"/guides/integrations/creating"},{"title":"Choosing Scopes","href":"/guides/integrations/scopes"}]},{"group":"Proxy","icon":"arrow-right-arrow-left","pages":[{"title":"Proxy Overview","sidebarTitle":"Overview","href":"/guides/proxy/overview"},{"title":"Making Proxy Requests","sidebarTitle":"Making requests","href":"/guides/proxy/making-requests"},{"title":"Retries","href":"/guides/proxy/retries"},{"title":"Rate Limits","href":"/guides/proxy/rate-limits"}]},{"group":"Unified API","icon":"merge","pages":[{"title":"Unified API Overview","sidebarTitle":"Overview","href":"/guides/unified/overview"},{"title":"Unified API Conventions","sidebarTitle":"Conventions","href":"/guides/unified/conventions"},{"title":"Account","href":"/guides/unified/account"},{"title":"Chat","href":"/guides/unified/chat"},{"title":"Git","href":"/guides/unified/git"},{"title":"Tasks","href":"/guides/unified/tasks"},{"title":"Helpdesk","href":"/guides/unified/helpdesk"},{"title":"CRM","href":"/guides/unified/crm"},{"title":"Drive","href":"/guides/unified/drive"},{"title":"Calendar","href":"/guides/unified/calendar"}]},{"group":"MCP","icon":"microchip-ai","pages":[{"title":"MCP Overview","sidebarTitle":"Overview","href":"/guides/mcp/overview"},{"title":"How Proxy MCP Works","sidebarTitle":"How Proxy MCP works","href":"/guides/mcp/proxy-mcp"},{"title":"Using MCP Clients","description":"Connect OpenAI, Anthropic, the MCP SDKs, or Claude Code to a user’s account through mcp.bundleup.io.","href":"/guides/mcp/clients"},{"title":"Agents for Many Users","href":"/guides/mcp/multi-tenant-agents"}]},{"group":"Webhooks","icon":"bell","pages":[{"title":"Webhooks","description":"Get an HTTP request on your server when integrations or connections change in your workspace.","sidebarTitle":"Overview","href":"/guides/webhooks/overview"},{"title":"Webhook Events","sidebarTitle":"Event catalogue","href":"/guides/webhooks/events"},{"title":"Verifying Webhook Signatures","sidebarTitle":"Verifying signatures","href":"/guides/webhooks/verifying"}]},{"group":"Operations","icon":"chart-line","pages":[{"title":"Logs \u0026 Observability","sidebarTitle":"Logs","href":"/guides/operations/logs"},{"title":"Handling Errors","href":"/guides/operations/error-handling"},{"title":"Production Checklist","href":"/guides/operations/going-to-production"},{"title":"Troubleshooting \u0026 FAQ","sidebarTitle":"Troubleshooting \u0026 FAQ","href":"/guides/operations/troubleshooting"}]},{"group":"Platform","icon":"building","pages":[{"title":"Dashboard Tour","href":"/platform/dashboard"},{"title":"Team \u0026 Members","href":"/platform/team"},{"title":"Security","href":"/platform/security"},{"title":"Pricing \u0026 Plans","sidebarTitle":"Pricing","href":"/platform/pricing"},{"title":"Limits \u0026 Quotas","href":"/platform/limits"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]},{"tab":"SDKs","pages":[{"title":"SDKs","href":"/sdks/overview"}]}]},"basePath":"","title":"Agents for Many Users - BundleUp","buildId":"dpl_6dVqRXFR2Go5vF5RLvAdHuv189oT","deploymentId":"dpl_6dVqRXFR2Go5vF5RLvAdHuv189oT","dynamics":[],"chunks":[]}