What is Within
Within is the sales agent inside your MCP server. A customer using your product in Claude or ChatGPT asks about pricing, a plan, billing, a demo, or cancellation while they work. The model would otherwise answer from general knowledge, and the question would leave no record. Within answers in your company's words, at the moment the question is asked.
You install it once, on the server you already ship. The agent your customer uses keeps calling your tools as before. Your tool result stays intact. A person from your team joins the same conversation only after the customer chooses to connect. When nobody is free, the customer can leave a note, and the question is still in your console.
The path
One way to install. The SDK goes inside a server you own and meets the customers already using it.
@getwithin/sdk
A server you own. Goes inside it, wraps the tools you already ship, and answers your real customers. TypeScript, Node.js 20 or newer. Quickstart →
Installing is a short call. Here it is in full, with one of your tools wrapped:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import { SERVER_INSTRUCTIONS, SupportBridge } from "@getwithin/sdk";
const server = new McpServer(
{ name: "northwind", version: "1.0.0" },
{ instructions: `Your business instructions. ${SERVER_INSTRUCTIONS}` }
);
const support = SupportBridge.install(server, {
apiKey: process.env.SUPPORTBRIDGE_API_KEY,
baseUrl: process.env.SUPPORTBRIDGE_URL,
source: "northwind-mcp",
});
const search = support.wrapTool({
name: "search_companies",
title: "Search companies",
description: "Search companies.",
inputSchema: { query: z.string() },
handler: async ({ query }) => ({
content: [{ type: "text", text: `Found companies for ${query}.` }],
structuredContent: { query, companies: [] },
}),
});
server.registerTool(
search.name,
{ title: search.title, description: search.description, inputSchema: search.inputSchema },
search.handler
);
The API key is one string from the console, under Integrations. It names your company, so the SDK sends no vendor id of its own. Quickstart →
Next steps
Open the console
Every buying question lands with what happened next: answered, offered, chatted, or a note. Console →
Answer the question, then offer a person
get_vendor_answer returns your reply and, when that topic is on, a card. Calling it contacts nobody. What the customer sees →
Choose what is stored
Tool arguments stay on your server unless you set privacy.captureArguments. When they are stored, secret-like values are redacted first. What leaves your server →
Write the answers in the console
Pricing, billing, demos, cancellation, and topics of your own. Turn any of them on or off without a deploy. Revenue topics →
Overview
@getwithin/sdk is the install for a vendor who controls their MCP server. One call registers the answer, the offer card, and the live chat, and reports activity to your console. It runs in the same process as your server. Your customers install nothing.
- Your tools keep their names, descriptions, and results.
wrapToolruns your handler first. - A call to Within stops after 5 seconds. When Within cannot be reached, your result is still returned, with a line that the service is unreachable.
- The only thing that leaves the process is what you configure: the activity report, and tool arguments only when you ask for them.
Node.js 20 or newer. The server is an official @modelcontextprotocol/sdk McpServer. Zod 3.25 or newer, or Zod 4, is yours: it is a peer dependency, and the SDK adds its optional context field with the same Zod your schemas use.
The package is @getwithin/sdk on npm, Apache-2.0. The current release in this repository is 0.3.0.
Install
npm install @getwithin/sdk @modelcontextprotocol/sdk zod
Install @modelcontextprotocol/sdk and zod as well when the project does not already have them.
Quickstart
Call SupportBridge.install once, when the server is created. Wrap each business tool you want Within to see, then register the wrapped tool as you do today.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import { SERVER_INSTRUCTIONS, SupportBridge } from "@getwithin/sdk";
const server = new McpServer(
{ name: "northwind", version: "1.0.0" },
{ instructions: `Your business instructions. ${SERVER_INSTRUCTIONS}` }
);
const support = SupportBridge.install(server, {
apiKey: process.env.SUPPORTBRIDGE_API_KEY,
baseUrl: process.env.SUPPORTBRIDGE_URL ?? "https://app.getwith.in",
source: process.env.SUPPORTBRIDGE_SOURCE ?? "northwind-mcp",
privacy: { captureArguments: false },
});
const search = support.wrapTool({
name: "search_companies",
title: "Search companies",
description: "Search companies.",
inputSchema: { query: z.string() },
handler: async ({ query }) => ({
content: [{ type: "text", text: `Found companies for ${query}.` }],
structuredContent: { query, companies: [] },
}),
});
server.registerTool(
search.name,
{ title: search.title, description: search.description, inputSchema: search.inputSchema },
search.handler
);
A default install changes three things on your server.
- Server instructions.
SERVER_INSTRUCTIONStells the agent to callget_vendor_answerfor pricing, plans, upgrades, limits, seats, demos, trials, enterprise, quotes, contracts, implementation, security, billing, cancellation, renewal, competitive comparisons, and budget or timing, before it answers from general knowledge. Your own instructions stay first. Keep them free of the phrasesnext tool call,Do not call,Do not ask,Do not say, andDo not mention. A paragraph that contains one of those is replaced by the Within instructions. - Three tools, plus the tools you wrap:
get_vendor_answer,confirm_assistance, anddecline_assistance. Within also registers two UI resources,ui://supportbridge/intent-offerandui://supportbridge/chat. - Wrapped tools report activity.
wrapToolcopies the name, title, and description. Pass{ appendResultHint: true }only when that tool's description should end with "Pricing and commercial questions are answered by get_vendor_answer."
Keep each business tool description as a description of that tool. A search stays a search. Commercial questions go to get_vendor_answer.
On a stateless HTTP connection with no session id, the SDK mints one id for that connection and reuses it for the connection's calls. A new connection gets a new id. A transport that already has a session id, such as Streamable HTTP, uses that id.
The API key
Sign in at app.getwith.in and open Integrations. The page shows SUPPORTBRIDGE_API_KEY, SUPPORTBRIDGE_URL, and SUPPORTBRIDGE_SOURCE, and the install snippet that reads them. Set all three on the host that runs the MCP server, then start the server.
SUPPORTBRIDGE_API_KEY=sb_live_... SUPPORTBRIDGE_URL=https://app.getwith.in SUPPORTBRIDGE_SOURCE=northwind-mcp
SUPPORTBRIDGE_URL is https://app.getwith.in for production, with no trailing slash. The SDK strips a trailing slash if one is present. When baseUrl is omitted, the SDK calls http://127.0.0.1:8787, which is the local service. A server running on another machine needs a Within URL that machine can reach.
source is a label for this server, such as northwind-mcp. Integrations lists each connected source with the SDK version it reported. A missing apiKey throws api_key_required at startup, before the server accepts calls.
SUPPORTBRIDGE_API_KEY on the MCP host and restart. The sandbox has its own key, for the test server only.Install options
Passed to SupportBridge.install. apiKey is required. Everything else has a default.
| Option | What it does |
|---|---|
| apiKey | The company's key from Integrations. Read it from SUPPORTBRIDGE_API_KEY. |
| baseUrl | Where the SDK calls. Production is https://app.getwith.in. Default http://127.0.0.1:8787. |
| source | Name of this server in Integrations. Default mcp. |
| vendorName | Name used in the get_vendor_answer description. Default "this vendor". |
| privacy.captureArguments | true stores redacted tool arguments. Default false, which stores none. |
| identity | { provider, issuer } for Auth0, WorkOS, or Clerk, so a token that carries only a user id can be resolved to a name and email. |
| identityClaimNamespace | Auth0-style claim prefix, such as https://northwind.example/. A trailing slash is optional. |
| claimMap | Renames email, name, preferred_username, email_verified, and emailVerified to the keys your token uses. |
| identify | Your own function, when the host has already resolved the person. It returns userId, sessionId, authUserId, and displayName. |
What the customer sees
The agent calls get_vendor_answer when the question is commercial. The tool returns your company's answer and, when that topic is turned on, the offer card (ui://supportbridge/intent-offer). Calling it contacts nobody. The agent relays the answer in two or three sentences and leaves the card's wording as shown. A button handler must not call get_vendor_answer again. A second call mounts a second card. The result names the next call: which tool, which action, the offer id, and the suggested message.
| The customer chooses | The agent calls |
|---|---|
| Speak to a live person | confirm_assistance with the offer id. This is the only call that opens the chat (ui://supportbridge/chat). With no offer id, it accepts the pending manual offer for this session. |
| Speak to the assistant | decline_assistance with action assistant. The reply is painted on the card. No chat opens. |
| Send a note | decline_assistance with action file_note. The note is stored. It does not start a chat. When the note has a consent nonce, the call includes it. |
| Decline | decline_assistance with action decline. This is the default when action is omitted. |
When nobody on your team is available, the card is a note. If Speak to a live person finds nobody free, confirm_assistance returns that note card so the customer can still file it. Filing the note contacts your team later. It does not open a conversation.
An open chat uses decline_assistance actions get_messages, send_message, and end. Those calls leave the chat on screen. send_message requires client_message_id, a unique id for that message, reused on a retry. Polling, sending, or ending through confirm_assistance would mount the chat again, so the open chat stays on decline_assistance.
A card click sends a one-time nonce in the tool result _meta field supportbridge/consentNonce. That value is kept out of model-visible content and structuredContent. confirm_assistance checks the nonce when a caller sends one. A text host may omit it. file_note requires the nonce when the note has one.
A representative can also offer help from Live users. The next wrapped tool result in that session appends one text line and structuredContent.assistance, including a suggested message, once. Yes calls confirm_assistance with the offer id. No calls decline_assistance with action decline. A later call in that session does not append the line again. An expired offer cannot be accepted.
If get_vendor_answer cannot reach Within, it retries once. Both attempts share one 5-second budget, so a hung service is not retried. The agent then says the company's answer could not be loaded, and does not guess a price or contact anyone. When an answer begins with "The closest information", that sentence stays, and the reply is a partial answer.
Identity
Within names the person behind a call from claims your auth layer has already verified and placed on the MCP tool context: authInfo.extra, then authInfo.payload, plus _meta["openai/user"] and sessionId. The default path does not read tool arguments, decode the bearer token, or call a userinfo endpoint.
A verified email containing @ becomes the user id, lowercased. Otherwise the user id stays the bare subject (sub, then user_id, then userId). That id and name are what Live users shows. Placeholder ids (anonymous, customer-from-your-auth, session-from-your-auth) are dropped. With no user id from the host, the SDK does not invent one.
Tell the SDK which login provider signs your customers in, and its issuer exactly as tokens carry it in iss:
SupportBridge.install(server, {
apiKey: process.env.SUPPORTBRIDGE_API_KEY,
baseUrl: process.env.SUPPORTBRIDGE_URL,
source: "northwind-mcp",
identity: { provider: "auth0", issuer: "https://northwind.us.auth0.com/" },
// or { provider: "workos", issuer: "https://northwind.authkit.app" }
// or { provider: "clerk", issuer: "https://northwind.clerk.accounts.dev" }
});
When a token carries only a user id, the SDK asks that provider's userinfo endpoint (Auth0 /userinfo, WorkOS /oauth2/userinfo, Clerk /oauth/userinfo) with the same token, once per person, for their name and verified email. The customer's sign-in needs the openid profile email scopes. The request goes only to the issuer you name. If the provider is slow or refuses, the tool call goes on with the user id alone.
identityClaimNamespace matches Auth0-style claims such as https://northwind.example/email. An explicit namespace is not auto-detected. With no namespace, exactly one key ending in /email is used, and zero or two or more are left alone.
Pass identify only when the host has already resolved a real person. It may return userId, sessionId, authUserId, and displayName. customerUserId and customerSessionId are accepted aliases. When both forms are set, userId and sessionId win. Omit a fixed display name.
What leaves your server
The SDK reports the call. It does not read your logs, your database, or anything else in the process. Arguments are included only when you set privacy.captureArguments to true.
| Sent | What |
|---|---|
| On each wrapped call | The tool name, that the call happened, how it finished, and the customer and session when the host provided them. The client's name and version, when the MCP server reports them. |
| On get_vendor_answer | The topic the agent passed, and the answer your company has saved for it. |
| captureArguments true | The tool arguments, after redaction. Secret-like keys are removed. Email addresses, sk- keys, sb_ keys, bearer tokens, and card numbers that pass a Luhn check are replaced with [redacted]. |
| Left on your server | Tool arguments, when captureArguments is omitted or false. Your database, your logs, and the raw bearer token. |
query field can still be stored when argument capture is on. Turn capture on only for tools whose arguments you are willing to keep, redacted, in the console.Revenue topics
The topics live in the console, under Revenue rules. Changing one does not require a deploy. Each topic has your answer, an optional link, and a switch.
These topics ship ready: Pricing, Upgrade, Demo, Trial, Enterprise, Security, Implementation, Billing, Cancellation, Renewal, Competitive, and Buying process. You can add custom rules for a paywall, a rate limit, a seat expansion, or any other commercial question your product gets.
Answer source is either the sentence you saved, or an answer written from the context notes on the Context tab. The company setting Write answers from context decides whether a topic set to Context may call the model. With that setting off, the topic returns the saved sentence.
Silent mode (Revenue moments only) records the question as a revenue moment. The assistant says nothing about it, and no card is shown.
Try a question on the same page runs the settings currently on screen, including edits you have not saved.
Trust
- Your tool still returns. Calls to Within abort after 5 seconds. An unreachable service leaves your result in place and says the service is unreachable. It does not describe an offer as failed.
- Consent before a person joins.
get_vendor_answercontacts nobody. The vendor is contacted only afterconfirm_assistanceorfile_notesucceeds. - Outbound only. The SDK calls Within. It does not listen for inbound connections.
- The key is the company. The model and the request body do not send a vendor id. A key from Integrations acts only for that company. The sandbox key is separate.
- PII is redacted before storage when arguments are captured. See What leaves your server.
Overview
The console at app.getwith.in is where your team reads buying questions, writes the answers, and joins a chat the customer has accepted. Sessions arrive from every customer running your server. A question is kept whether or not anyone chats live.
- Many customers, one company. Activity is grouped by the person and, when you have uploaded them, by the account.
- A person joins only after a yes. Offering help from Live users, or the card on a topic you have turned on, waits for the customer. Nothing opens a chat before that.
- The answer is yours. Revenue rules hold the sentence, the link, and the context notes. The SDK reads them on the next
get_vendor_answer. No deploy.
What you see
The sidebar is the whole product. Search at the top filters the list you are on, by name or id. Your presence, online or away, is what the customer's card uses when it decides a live person is free.
Live users
People in a session now. Offer help from here. The offer is delivered on the customer's next wrapped tool call, once. A new company sees a setup checklist until the SDK is installed, a sandbox conversation has been sent, the first customer has arrived, and a teammate has been invited.
Conversations
Chats that opened after a customer chose a live person. The thread is the same conversation the customer has in Claude or ChatGPT.
Inbox
Offers and notes waiting on your team. A note filed when nobody was online lands here with the session attached. Filing a note does not start a chat.
Accounts
Activity grouped by customer, across sessions. Priority accounts, in beta, are the accounts you choose to put in front of your reps.
Revenue rules
Each topic, its answer source, and its switch. The Context tab holds the notes an answer can be written from. Silent mode records the question and shows nothing. Try a question runs the draft on the page.
Integrations
The API key, the URL, the source name, and the install snippet. It reports whether a server is connected and which SDK version it is running. The sandbox key is on the same page.
Revenue moments
In beta. Each buying question, with what happened next: asked, answered, offer sent, chatted, or a note. This is the record you still have when nobody joined live.
Team, Sandbox, Settings
Team is who can sign in and who can be offered. Sandbox is a test conversation on the sandbox key. Settings is the company and the name a customer sees on the card.
A buying question
- The customer asks in Claude or ChatGPT, while using your product.
- The agent calls
get_vendor_answerwith a short topic in the customer's words. - Within returns the answer you saved, or one written from your context notes when that topic is set to Context and the company allows it.
- When the topic is on and someone is available, the customer sees the offer card beside the answer. Nothing is sent to your team yet.
- Speak to a live person opens the chat in the same conversation, and it shows under Conversations. A note waits in the Inbox.
- The question is listed as a revenue moment either way.
A representative can start the same offer from Live users without waiting for a topic match. The customer still chooses, on the next tool result.
Access & security
The console is hosted by Within. Sign in at app.getwith.in. New accounts are approved within an hour. Each company sees its own customers, answers, and chats. PII is redacted before storage when tool arguments are captured, and arguments are omitted unless you turn capture on. The pattern list is in What leaves your server.
Start at Integrations, set the three environment variables, and wrap the tools you want the console to see. Quickstart →