How do I put my MCP server on iMessage and WhatsApp?
Build a two-tool MCP server, connect it to Keiki, and test lookups, iMessage approvals and WhatsApp refusals.
How do I put my MCP server on iMessage and WhatsApp?
Connect your remote MCP server to a Keiki-hosted agent, then attach an iMessage line and a WhatsApp number to that same agent. Run lookups on both channels and set sensitive writes to Ask: Keiki can ask for approval on iMessage, but it refuses the gated MCP call on WhatsApp.
Key takeaways
- Put two tools behind one remote MCP endpoint: a read that can run immediately and a write that needs a yes.
- Connect the server once on a Keiki-hosted agent. Attach the iMessage line and WhatsApp number separately.
- In real test threads, check that iMessage waits for a decision and that WhatsApp refuses the gated write without running it.
Say your customers want to text your product to check a delivery or request a hold. Start with those two jobs. Keiki runs the line, the conversation and the team inbox; your server owns the delivery data.
1. Serve a lookup and a write
This illustrative TypeScript server exposes one fake delivery. The hold is in memory and resets when the process restarts. Save it as server.ts, install the dependencies with bun add @modelcontextprotocol/sdk@1.32.0 zod, set DEMO_MCP_TOKEN to a strong demo-only secret in the server environment, and run bun server.ts.
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js'
import { z } from 'zod'
const token = process.env.DEMO_MCP_TOKEN
if (!token) throw new Error('Set DEMO_MCP_TOKEN first')
const delivery = { id: 'DEMO-42', holdRequested: false }
const inputSchema = { id: z.string() }
const text = (message: string) => ({ content: [{ type: 'text' as const, text: message }] })
export default {
port: 3000,
async fetch(request: Request) {
if (new URL(request.url).pathname !== '/mcp') return new Response(null, { status: 404 })
if (request.headers.get('authorization') !== `Bearer ${token}`) {
return new Response(null, { status: 401 })
}
if (request.method !== 'POST') {
return new Response(null, { status: 405, headers: { Allow: 'POST' } })
}
const server = new McpServer({ name: 'delivery-demo', version: '1.0.0' })
server.registerTool('lookup_delivery', {
description: 'Read the status of a demo delivery by ID.',
inputSchema,
}, ({ id }) => text(id !== delivery.id
? 'Demo delivery not found.'
: delivery.holdRequested ? 'Hold requested.' : 'Scheduled.'))
server.registerTool('request_delivery_hold', {
description: 'Request a hold on a demo delivery by ID.',
inputSchema,
}, ({ id }) => {
if (id !== delivery.id) return text('Demo delivery not found.')
delivery.holdRequested = true
return text('Hold requested.')
})
const transport = new WebStandardStreamableHTTPServerTransport({
sessionIdGenerator: undefined,
enableJsonResponse: true,
})
await server.connect(transport)
try {
return await transport.handleRequest(request)
} finally {
await server.close()
}
},
}Host the demo behind a reachable HTTPS URL, such as https://mcp.example.com/mcp. Keep it on fake data. In production, authorize every lookup and write against the customer's account on your server; knowing a delivery ID or getting a yes in chat isn't authorization.
2. Connect it and check the tool list
- On your saved Keiki-hosted agent, open Tools → Connect a tool → Add an MCP server. The connection needs the agent's sandbox and MCP features.
- Enter a name and the HTTPS Endpoint. Under Authentication, choose Static headers, set the
Authorizationheader toBearer <your demo token>, then select Save & connect. Keep the token out of the agent's prompt. - When the service says Connected, open it and expand Tool permissions. You should see
lookup_deliveryandrequest_delivery_holdwith their descriptions. If you see Connected · no tools available, check the endpoint's tool list and reconnect before setting permissions.
That's the dashboard list. During a turn the agent discovers connected tools with tools.search in mcp_execute, inspects the input shape with tools.describe.tool, and calls the exact path it finds. It doesn't need a copy of the tool schema in its prompt.
3. Make the write wait
In Tool permissions, set Default for new tools to Deny, set lookup_delivery to Allow, and set request_delivery_hold to Ask. Select Save permissions. That leaves the demo read available and stops new tools from running unless you explicitly allow them.
On iMessage, Ask creates a pending action. In an eligible direct conversation, Keiki can send a Vault approval card with Face ID; otherwise the agent asks in words. When the user approves, Keiki rechecks the connection and permission, then runs the stored call with the same arguments. A decline leaves the write unrun. This MCP setting doesn't require verified proof or add the scopes, previews or freshness checks available on some governed actions.
On WhatsApp, Keiki currently can't ask for this MCP approval, so the gated write does not run. Leave the tool on Ask rather than changing it to Allow just to make the WhatsApp test work.
4. Attach both channels and test from a phone
- In Channels on the agent, attach an iMessage line. If you don't have one yet, go to the dashboard's Channels page, select Add channel → iMessage, and purchase a line. On the new line, choose Assign to agent and select this agent.
- On the same agent, connect WhatsApp. For guided signup, choose Connect with WhatsApp, log in with Facebook, select your business and verify the number. If you already have a WhatsApp connection, see the other setup options in Channels.
- In an actual one-to-one thread on each channel, send “What's the status of delivery DEMO-42?” It should report Scheduled from the lookup. Also try a made-up ID and check that the agent says it couldn't find it.
- On iMessage, send “Put DEMO-42 on hold.” Check that Keiki asks first and the hold is still unset. Decline, then look up the delivery again; it should still be Scheduled. Make a fresh request, approve it, and look it up again; expect Hold requested.
- Restart the demo process to reset the fixture. On WhatsApp, ask for the same hold. In Logs → Activity, open that turn. Under Steps, expand Queried connected data. Find the step whose Arguments call
request_delivery_holdand check its Response forapproval_unavailable. A reply alone doesn't prove the tool was blocked. Look up the delivery again and confirm it's still Scheduled.
Use real test threads for the approval check: a playground turn doesn't ask for this approval.
FAQ
Can customers approve an MCP write on WhatsApp? Not with this setting. Keiki refuses an MCP tool set to Ask in a WhatsApp turn; customers can still use the tools you explicitly allow.
Can I keep my current model and prompt? Yes. If you already run an agent, bring it with an external harness and keep its model, prompt and MCP client in your app. The dashboard setup above is for a Keiki-hosted agent; don't assume its permissions gate tool calls made directly by your own runtime.
Do I have to build an MCP server if I already have an API? No. For a hosted agent, you can import an OpenAPI spec or write a TypeScript tool that calls your API. If your app calls Keiki's developer API, use its OpenAPI contract and an API key scoped to the operations it needs.
Is my server the same as Keiki's MCP endpoint? No. Your endpoint serves the delivery tools to the agent; Keiki's MCP endpoint lets an MCP client work with your Keiki organization. See how the MCP connections fit together for the distinction.
Sources
- Keiki: MCP connections, MCP actions, channels, and external harness.
- Model Context Protocol: TypeScript SDK 1.32.0 package metadata, retrieved 2026-11-26. The delivery server is an illustrative Keiki example.