Claude Agent SDK
Give an agent built with the Claude Agent SDK its own calendar. The SDK speaks MCP, so you add the Chronary MCP server (@chronary/mcp) to query() and Claude gets Chronary’s calendar tools. There is no Chronary package to install in your project.
Install
Section titled “Install”npm install @anthropic-ai/claude-agent-sdkThe Chronary MCP server runs with npx -y @chronary/mcp, which downloads it on first use. It needs Node.js 18 or later.
Authenticate
Section titled “Authenticate”Create an API key in the console and set it as CHRONARY_API_KEY. An Organization key (chr_sk_) or an Agent key (chr_ak_) both work. See Authentication. The SDK also needs ANTHROPIC_API_KEY.
Claude sees each Chronary tool as mcp__chronary__<tool>, for example mcp__chronary__create_event. Two options control them:
allowedTools: ['mcp__chronary__*']lets every Chronary tool run without a permission prompt.--toolson the MCP server exposes only the tools you list. Without it, the server exposes all 65.
Full agent
Section titled “Full agent”The agent books on the first agent and its first calendar, so the account needs an agent with at least one calendar. A new account has none: create them in the console first.
import { query } from '@anthropic-ai/claude-agent-sdk';
const today = new Date().toISOString().slice(0, 10);
for await (const message of query({ prompt: 'Find a free 30-minute slot tomorrow afternoon (UTC), book "Project sync" in it, then list tomorrow’s events.', options: { // The model has no clock: tell it today's date so "tomorrow" is right. systemPrompt: `Today is ${today} (UTC). Use the first agent and its first calendar.`, mcpServers: { chronary: { command: 'npx', args: [ '-y', '@chronary/mcp', '--tools', 'list_agents,list_calendars,get_availability,create_event,list_events', ], env: { CHRONARY_API_KEY: process.env.CHRONARY_API_KEY! }, }, }, tools: [], // no built-in tools such as Bash or Edit // Ignore your local Claude settings, plugins and other MCP servers: only the calendar. settingSources: [], strictMcpConfig: true, allowedTools: ['mcp__chronary__*'], },})) { if (message.type === 'result' && message.subtype === 'success') { console.log(message.result); }}Use the hosted server instead
Section titled “Use the hosted server instead”To skip the local process, point the entry at the hosted MCP server. It has the same tools:
mcpServers: { chronary: { type: 'http', url: 'https://api.chronary.ai/mcp', headers: { Authorization: `Bearer ${process.env.CHRONARY_API_KEY}` }, },},Runnable example
Section titled “Runnable example”claude-agent-sdk-scheduler is this agent as a complete project: it checks availability, books a meeting, lists tomorrow’s events and prints each tool call.
Next steps
Section titled “Next steps”- All frameworks
- MCP Tools Reference: the full 65-tool surface
- MCP Setup: every way to connect, including Claude Desktop and Claude Code