1. Prepare a key for your code
Sign in to Pear, connect iCloud or Microsoft 365, and create an API key in Settings for this project. Load it from the environment as PEAR_API_KEY; never commit it or send it to a browser.
A Pear API key belongs to one Pear account. If you are building something for other people, do not run it with your key. Each person needs their own Pear account and connection.
None of these three SDKs signs a user in to Pear for you. The Claude Agent SDK and OpenAI Responses API run no interactive OAuth flow, and Pear has no OAuth client registered for your application, so these examples use the API key.
2. Claude Agent SDK
Add Pear under mcpServers with type: 'http' and an Authorization header. MCP tools are named mcp__pear__<tool>. Listing them in allowedTools approves them automatically, so list only the tools your agent should run without asking, and start with reads.
import { query } from '@anthropic-ai/claude-agent-sdk';
for await (const message of query({
prompt: 'Call pear_provider_status and list my ready accounts. Do not change anything.',
options: {
mcpServers: {
pear: {
type: 'http',
url: 'https://pearmcp.com/api/mcp',
headers: { Authorization: `Bearer ${process.env.PEAR_API_KEY}` },
},
},
allowedTools: [
'mcp__pear__pear_provider_status',
'mcp__pear__pear_list_calendars',
'mcp__pear__pear_list_events',
],
},
})) {
if (message.type === 'result' && message.subtype === 'success') {
console.log(message.result);
}
}Check the system init message: Pear's status should be connected. A failed or needs-auth status means the header is missing or the key is wrong.
3. OpenAI Responses API
Pass Pear as a remote MCP tool. OpenAI calls Pear on your behalf, so tool arguments and results pass through OpenAI's API and its data retention settings. The authorization value is not stored, so send it with every request. Pear accepts the key with or without a Bearer prefix.
import OpenAI from 'openai';
const client = new OpenAI();
const response = await client.responses.create({
model: process.env.OPENAI_MODEL,
tools: [
{
type: 'mcp',
server_label: 'pear',
server_url: 'https://pearmcp.com/api/mcp',
authorization: process.env.PEAR_API_KEY,
allowed_tools: ['pear_provider_status', 'pear_list_calendars', 'pear_list_events'],
require_approval: 'always',
},
],
input: 'Call pear_provider_status and list my ready accounts. Do not change anything.',
});
console.log(response.output);OpenAI asks for approval before sharing data with a server by default. With require_approval: 'always', the response contains mcp_approval_request items; your code answers each one with an mcp_approval_response in a follow-up request. Keep approvals on for Pear write tools.
4. Vercel AI SDK
Create an MCP client with the HTTP transport from @ai-sdk/mcp, pick the Pear tools you want, and close the client when you are done.
import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, stepCountIs } from 'ai';
const pear = await createMCPClient({
transport: {
type: 'http',
url: 'https://pearmcp.com/api/mcp',
headers: { Authorization: `Bearer ${process.env.PEAR_API_KEY}` },
},
});
try {
const { pear_provider_status, pear_list_events } = await pear.tools();
const { text } = await generateText({
model: process.env.AI_MODEL,
tools: { pear_provider_status, pear_list_events },
stopWhen: stepCountIs(5),
prompt: 'Call pear_provider_status and list my ready accounts. Do not change anything.',
});
console.log(text);
} finally {
await pear.close();
}The AI SDK does not turn MCP tool annotations into an approval policy. If you pass Pear write tools, add your own approval step before they run.
5. Check one real result
Run the example and confirm the output lists your ready accounts and services from pear_provider_status. Then ask for one day of events from a named calendar with an explicit timezone and compare it with your calendar app. An answer that never called a Pear tool is not a read of your account.
Python agent walkthroughs
Read a calendar with Pydantic AI using a filtered toolset, or list mailbox folders with Strands Agents before giving a model access to mail.
Writes from code
Pear writes use pear_draft_write to prepare an exact change and pear_execute_approved_write to run it once. Build your agent so a person sees the draft (account, recipients, dates, content) before execution, and reuse the same idempotency key only when retrying the identical action.
Troubleshooting and removing access
A 401 response means the key is missing, inactive or sent in a header other than Authorization. A missing tool usually means the provider or permission is not ready in Pear. Pear uses Streamable HTTP; do not configure an SSE transport.
To remove access, revoke the key in Pear. Rotating the key stops every deployment that uses it, so give each project its own key.
Choose a useful first workflow
Start with a read. Ask which calendars are connected, find an event in a specific date range, or search a mail folder for a message you already know. Specify the account and timezone when they matter.
For Apple accounts, see iCloud setup and services and iCloud Mail workflows. For Microsoft accounts, see Microsoft 365 setup, Outlook Mail, and Microsoft To Do.
Apple Reminders availability depends on the Apple account. For Apple, Pear can read and write only the legacy reminder lists Apple still exposes through CalDAV. If the account has been upgraded to Apple's newer Reminders store, Pear cannot access those native lists and does not copy them into a separate reminder store. Apple may instead return compatibility placeholders, such as repeated "Where are my reminders?" items; Pear did not create them. Pear's safe fallback hides known placeholders and blocks writes to affected lists. Reconnecting iCloud or replacing the App-Specific Password will not change this Apple limitation. Calendar, Contacts, and Mail are unaffected, and Microsoft To Do uses Microsoft Graph and is unaffected. Full modern Apple Reminders access would require an Apple-platform companion using EventKit with the user's permission; Pear does not currently provide one. Google Workspace remains coming soon.
Pear exposes tools allowed by your account and permissions. Your AI client decides when to call them. Review recipients, dates, and content before approving writes. Read how Pear handles your data and the current plans before expanding the workflow.
Sources and compatibility status
Documentation checked on 25 November 2026. Setup guide available; a complete Pear authentication, tool-list, read, and approved-write test with each SDK is still pending. The examples use TypeScript and leave the model to your environment.
Claude Agent SDK: MCP · OpenAI: remote MCP servers · AI SDK: MCP tools

