[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78WXPWZ07BEWJN7NBVZACKY":3,"skill-same:01M78WXPWZ07BEWJN7NBVZACKY":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":13,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M78WXPWZ07BEWJN7NBVZACKY","ydc-claude-agent-sdk-integration",null,"Integrate Claude Agent SDK with You.com HTTP MCP server for Python and TypeScript. Use when developer mentions Claude Agent SDK, Anthropic Agent SDK, or integrating Claude with MCP tools.","meghal86\u002Fstacksignal","meghal86","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F37388715?v=4","01M6CS2EW8SK89GH52R2ZEN8QQ","01M728J5CGY456EETEFG6HJBTM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-claude-agent-sdk-integration\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ydc-claude-agent-sdk-integration\ndescription: Integrate Claude Agent SDK with You.com HTTP MCP server for Python and TypeScript. Use when developer mentions Claude Agent SDK, Anthropic Agent SDK, or integrating Claude with MCP tools.\nlicense: MIT\ncompatibility: Python 3.10+ or TypeScript 5.2+ (for v2), Node.js 18+\nmetadata:\n  author: youdotcom-oss\n  category: sdk-integration\n  version: \"1.0.0\"\n  keywords: claude,anthropic,claude-agent-sdk,agent-sdk,mcp,you.com,integration,http-mcp,web-search,python,typescript\n---\n\n# Integrate Claude Agent SDK with You.com MCP\n\nInteractive workflow to set up Claude Agent SDK with You.com's HTTP MCP server.\n\n## Workflow\n\n1. **Ask: Language Choice**\n   * Python or TypeScript?\n\n2. **If TypeScript - Ask: SDK Version**\n   * v1 (stable, generator-based) or v2 (preview, send\u002Freceive pattern)?\n   * Note: v2 requires TypeScript 5.2+ for `await using` support\n\n3. **Install Package**\n   * Python: `pip install claude-agent-sdk`\n   * TypeScript: `npm install @anthropic-ai\u002Fclaude-agent-sdk`\n\n4. **Ask: Environment Variables**\n   * Using standard `YDC_API_KEY` and `ANTHROPIC_API_KEY`?\n   * Or custom names?\n   * Have they set them?\n   * If NO: Guide to get keys:\n     - YDC_API_KEY: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n     - ANTHROPIC_API_KEY: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n5. **Ask: File Location**\n   * NEW file: Ask where to create and what to name\n   * EXISTING file: Ask which file to integrate into (add HTTP MCP config)\n\n6. **Create\u002FUpdate File**\n\n   **For NEW files:**\n   * Use the complete template code from the \"Complete Templates\" section below\n   * User can run immediately with their API keys set\n\n   **For EXISTING files:**\n   * Add HTTP MCP server configuration to their existing code\n   * Python configuration block:\n     ```python\n     from claude_agent_sdk import query, ClaudeAgentOptions\n\n     options = ClaudeAgentOptions(\n         mcp_servers={\n             \"ydc\": {\n                 \"type\": \"http\",\n                 \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n                 \"headers\": {\n                     \"Authorization\": f\"Bearer {os.getenv('YDC_API_KEY')}\"\n                 }\n             }\n         },\n         allowed_tools=[\n             \"mcp__ydc__you_search\",\n             \"mcp__ydc__you_express\",\n             \"mcp__ydc__you_contents\"\n         ]\n     )\n     ```\n\n   * TypeScript configuration block:\n     ```typescript\n     const options = {\n       mcpServers: {\n         ydc: {\n           type: 'http' as const,\n           url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n           headers: {\n             Authorization: `Bearer ${process.env.YDC_API_KEY}`\n           }\n         }\n       },\n       allowedTools: [\n         'mcp__ydc__you_search',\n         'mcp__ydc__you_express',\n         'mcp__ydc__you_contents'\n       ]\n     };\n     ```\n\n## Complete Templates\n\nUse these complete templates for new files. Each template is ready to run with your API keys set.\n\n### Python Template (Complete Example)\n\n```python\n\"\"\"\nClaude Agent SDK with You.com HTTP MCP Server\nPython implementation with async\u002Fawait pattern\n\"\"\"\n\nimport os\nimport asyncio\nfrom claude_agent_sdk import query, ClaudeAgentOptions\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nanthropic_api_key = os.getenv(\"ANTHROPIC_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\"\n    )\n\nif not anthropic_api_key:\n    raise ValueError(\n        \"ANTHROPIC_API_KEY environment variable is required. \"\n        \"Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news and get results from You.com MCP server\n    \"\"\"\n    # Configure Claude Agent with HTTP MCP server\n    options = ClaudeAgentOptions(\n        mcp_servers={\n            \"ydc\": {\n                \"type\": \"http\",\n                \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n                \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n            }\n        },\n        allowed_tools=[\n            \"mcp__ydc__you_search\",\n            \"mcp__ydc__you_express\",\n            \"mcp__ydc__you_contents\",\n        ],\n        model=\"claude-sonnet-4-5-20250929\",\n    )\n\n    # Query Claude with MCP tools available\n    async for message in query(\n        prompt=\"Search for the latest AI news from this week\",\n        options=options,\n    ):\n        # Handle different message types\n        if message.type == \"text\":\n            print(message.content)\n        elif message.type == \"tool_use\":\n            print(f\"\\n[Tool: {message.name}]\")\n            print(f\"Input: {message.input}\")\n        elif message.type == \"tool_result\":\n            print(f\"Result: {message.content}\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### TypeScript v1 Template (Complete Example)\n\n```typescript\n\u002F**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v1 implementation with generator-based pattern\n *\u002F\n\nimport { query } from '@anthropic-ai\u002Fclaude-agent-sdk';\n\n\u002F\u002F Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst anthropicApiKey = process.env.ANTHROPIC_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys'\n  );\n}\n\n\u002F**\n * Example: Search for AI news and get results from You.com MCP server\n *\u002F\nasync function main() {\n  \u002F\u002F Query Claude with HTTP MCP configuration\n  const result = query({\n    prompt: 'Search for the latest AI news from this week',\n    options: {\n      mcpServers: {\n        ydc: {\n          type: 'http' as const,\n          url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n          headers: {\n            Authorization: `Bearer ${ydcApiKey}`,\n          },\n        },\n      },\n      allowedTools: [\n        'mcp__ydc__you_search',\n        'mcp__ydc__you_express',\n        'mcp__ydc__you_contents',\n      ],\n      model: 'claude-sonnet-4-5-20250929',\n    },\n  });\n\n  \u002F\u002F Process messages as they arrive\n  for await (const msg of result) {\n    if (msg.type === 'text') {\n      console.log(msg.content);\n    } else if (msg.type === 'tool_use') {\n      console.log(`\\n[Tool: ${msg.name}]`);\n      console.log(`Input: ${JSON.stringify(msg.input, null, 2)}`);\n    } else if (msg.type === 'tool_result') {\n      console.log(`Result: ${msg.content}`);\n    }\n  }\n}\n\nmain().catch(console.error);\n```\n\n### TypeScript v2 Template (Complete Example)\n\n```typescript\n\u002F**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v2 implementation with send\u002Freceive pattern\n * Requires TypeScript 5.2+ for 'await using' support\n *\u002F\n\nimport { unstable_v2_createSession } from '@anthropic-ai\u002Fclaude-agent-sdk';\n\n\u002F\u002F Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst anthropicApiKey = process.env.ANTHROPIC_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys'\n  );\n}\n\n\u002F**\n * Example: Search for AI news and get results from You.com MCP server\n *\u002F\nasync function main() {\n  \u002F\u002F Create session with HTTP MCP configuration\n  \u002F\u002F 'await using' ensures automatic cleanup when scope exits\n  await using session = unstable_v2_createSession({\n    mcpServers: {\n      ydc: {\n        type: 'http' as const,\n        url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n        headers: {\n          Authorization: `Bearer ${ydcApiKey}`,\n        },\n      },\n    },\n    allowedTools: [\n      'mcp__ydc__you_search',\n      'mcp__ydc__you_express',\n      'mcp__ydc__you_contents',\n    ],\n    model: 'claude-sonnet-4-5-20250929',\n  });\n\n  \u002F\u002F Send message to Claude\n  await session.send('Search for the latest AI news from this week');\n\n  \u002F\u002F Receive and process messages\n  for await (const msg of session.receive()) {\n    if (msg.type === 'text') {\n      console.log(msg.content);\n    } else if (msg.type === 'tool_use') {\n      console.log(`\\n[Tool: ${msg.name}]`);\n      console.log(`Input: ${JSON.stringify(msg.input, null, 2)}`);\n    } else if (msg.type === 'tool_result') {\n      console.log(`Result: ${msg.content}`);\n    }\n  }\n}\n\nmain().catch(console.error);\n```\n\n## HTTP MCP Server Configuration\n\nAll templates use You.com's **HTTP MCP server** for simplicity:\n\n**Python:**\n```python\nmcp_servers={\n    \"ydc\": {\n        \"type\": \"http\",\n        \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n        \"headers\": {\n            \"Authorization\": f\"Bearer {ydc_api_key}\"\n        }\n    }\n}\n```\n\n**TypeScript:**\n```typescript\nmcpServers: {\n  ydc: {\n    type: 'http' as const,\n    url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`\n    }\n  }\n}\n```\n\n**Benefits of HTTP MCP:**\n- ✅ No local installation required\n- ✅ Stateless request\u002Fresponse model\n- ✅ Always up-to-date with latest version\n- ✅ Consistent across all environments\n- ✅ Production-ready and scalable\n- ✅ Works with existing HTTP infrastructure\n\n## Available You.com Tools\n\nAfter configuration, Claude can discover and use:\n- `mcp__ydc__you_search` - Web and news search\n- `mcp__ydc__you_express` - AI-powered answers with web context\n- `mcp__ydc__you_contents` - Web page content extraction\n\n## Environment Variables\n\nBoth API keys are required:\n\n```bash\n# Add to your .env file or shell profile\nexport YDC_API_KEY=\"your-you-api-key-here\"\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\n```\n\n**Get your API keys:**\n- You.com: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n- Anthropic: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n## Validation Checklist\n\nBefore completing:\n\n- [ ] Package installed: `claude-agent-sdk` (Python) or `@anthropic-ai\u002Fclaude-agent-sdk` (TypeScript)\n- [ ] Environment variables set: `YDC_API_KEY` and `ANTHROPIC_API_KEY`\n- [ ] Template copied or configuration added to existing file\n- [ ] HTTP MCP server configured (`https:\u002F\u002Fapi.you.com\u002Fmcp`)\n- [ ] Authorization header includes `Bearer ${YDC_API_KEY}`\n- [ ] Allowed tools list includes You.com tools\n- [ ] File is executable (Python) or can be compiled (TypeScript)\n- [ ] Ready to test with example query\n\n## Testing Your Integration\n\n**Python:**\n```bash\npython your-file.py\n```\n\n**TypeScript:**\n```bash\n# With tsx (recommended for quick testing)\nnpx tsx your-file.ts\n\n# Or compile and run\ntsc your-file.ts && node your-file.js\n```\n\n## Common Issues\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Cannot find module @anthropic-ai\u002Fclaude-agent-sdk\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nInstall the package:\n\n```bash\n# NPM\nnpm install @anthropic-ai\u002Fclaude-agent-sdk\n\n# Bun\nbun add @anthropic-ai\u002Fclaude-agent-sdk\n\n# Yarn\nyarn add @anthropic-ai\u002Fclaude-agent-sdk\n\n# pnpm\npnpm add @anthropic-ai\u002Fclaude-agent-sdk\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>YDC_API_KEY environment variable is required\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nSet your You.com API key:\n\n```bash\nexport YDC_API_KEY=\"your-api-key-here\"\n```\n\nGet your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>ANTHROPIC_API_KEY environment variable is required\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nSet your Anthropic API key:\n\n```bash\nexport ANTHROPIC_API_KEY=\"your-api-key-here\"\n```\n\nGet your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>MCP connection fails with 401 Unauthorized\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nVerify your YDC_API_KEY is valid:\n1. Check the key at https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n2. Ensure no extra spaces or quotes in the environment variable\n3. Verify the Authorization header format: `Bearer ${YDC_API_KEY}`\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Tools not available or not being called\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nEnsure `allowedTools` includes the correct tool names:\n- `mcp__ydc__you_search` (not `you_search`)\n- `mcp__ydc__you_express` (not `you_express`)\n- `mcp__ydc__you_contents` (not `you_contents`)\n\nTool names must include the `mcp__ydc__` prefix.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>TypeScript error: Cannot use 'await using'\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nThe v2 SDK requires TypeScript 5.2+ for `await using` syntax.\n\n**Solution 1: Update TypeScript**\n```bash\nnpm install -D typescript@latest\n```\n\n**Solution 2: Use manual cleanup**\n```typescript\nconst session = unstable_v2_createSession({ \u002F* options *\u002F });\ntry {\n  await session.send('Your query');\n  for await (const msg of session.receive()) {\n    \u002F\u002F Process messages\n  }\n} finally {\n  session.close();\n}\n```\n\n**Solution 3: Use v1 SDK instead**\nChoose v1 during setup for broader TypeScript compatibility.\n\n\u003C\u002Fdetails>\n\n\n\n## Additional Resources\n\n* You.com MCP Server: https:\u002F\u002Fdocumentation.you.com\u002Fdeveloper-resources\u002Fmcp-server\n* Claude Agent SDK (Python): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Fpython\n* Claude Agent SDK (TypeScript v1): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Ftypescript\n* Claude Agent SDK (TypeScript v2): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Ftypescript-v2-preview\n* API Keys:\n  - You.com: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n  - Anthropic: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n","# Integrate Claude Agent SDK with You.com MCP\n\nInteractive workflow to set up Claude Agent SDK with You.com's HTTP MCP server.\n\n## Workflow\n\n1. **Ask: Language Choice**\n   * Python or TypeScript?\n\n2. **If TypeScript - Ask: SDK Version**\n   * v1 (stable, generator-based) or v2 (preview, send\u002Freceive pattern)?\n   * Note: v2 requires TypeScript 5.2+ for `await using` support\n\n3. **Install Package**\n   * Python: `pip install claude-agent-sdk`\n   * TypeScript: `npm install @anthropic-ai\u002Fclaude-agent-sdk`\n\n4. **Ask: Environment Variables**\n   * Using standard `YDC_API_KEY` and `ANTHROPIC_API_KEY`?\n   * Or custom names?\n   * Have they set them?\n   * If NO: Guide to get keys:\n     - YDC_API_KEY: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n     - ANTHROPIC_API_KEY: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n5. **Ask: File Location**\n   * NEW file: Ask where to create and what to name\n   * EXISTING file: Ask which file to integrate into (add HTTP MCP config)\n\n6. **Create\u002FUpdate File**\n\n   **For NEW files:**\n   * Use the complete template code from the \"Complete Templates\" section below\n   * User can run immediately with their API keys set\n\n   **For EXISTING files:**\n   * Add HTTP MCP server configuration to their existing code\n   * Python configuration block:\n     ```python\n     from claude_agent_sdk import query, ClaudeAgentOptions\n\n     options = ClaudeAgentOptions(\n         mcp_servers={\n             \"ydc\": {\n                 \"type\": \"http\",\n                 \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n                 \"headers\": {\n                     \"Authorization\": f\"Bearer {os.getenv('YDC_API_KEY')}\"\n                 }\n             }\n         },\n         allowed_tools=[\n             \"mcp__ydc__you_search\",\n             \"mcp__ydc__you_express\",\n             \"mcp__ydc__you_contents\"\n         ]\n     )\n     ```\n\n   * TypeScript configuration block:\n     ```typescript\n     const options = {\n       mcpServers: {\n         ydc: {\n           type: 'http' as const,\n           url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n           headers: {\n             Authorization: `Bearer ${process.env.YDC_API_KEY}`\n           }\n         }\n       },\n       allowedTools: [\n         'mcp__ydc__you_search',\n         'mcp__ydc__you_express',\n         'mcp__ydc__you_contents'\n       ]\n     };\n     ```\n\n## Complete Templates\n\nUse these complete templates for new files. Each template is ready to run with your API keys set.\n\n### Python Template (Complete Example)\n\n```python\n\"\"\"\nClaude Agent SDK with You.com HTTP MCP Server\nPython implementation with async\u002Fawait pattern\n\"\"\"\n\nimport os\nimport asyncio\nfrom claude_agent_sdk import query, ClaudeAgentOptions\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nanthropic_api_key = os.getenv(\"ANTHROPIC_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\"\n    )\n\nif not anthropic_api_key:\n    raise ValueError(\n        \"ANTHROPIC_API_KEY environment variable is required. \"\n        \"Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news and get results from You.com MCP server\n    \"\"\"\n    # Configure Claude Agent with HTTP MCP server\n    options = ClaudeAgentOptions(\n        mcp_servers={\n            \"ydc\": {\n                \"type\": \"http\",\n                \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n                \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n            }\n        },\n        allowed_tools=[\n            \"mcp__ydc__you_search\",\n            \"mcp__ydc__you_express\",\n            \"mcp__ydc__you_contents\",\n        ],\n        model=\"claude-sonnet-4-5-20250929\",\n    )\n\n    # Query Claude with MCP tools available\n    async for message in query(\n        prompt=\"Search for the latest AI news from this week\",\n        options=options,\n    ):\n        # Handle different message types\n        if message.type == \"text\":\n            print(message.content)\n        elif message.type == \"tool_use\":\n            print(f\"\\n[Tool: {message.name}]\")\n            print(f\"Input: {message.input}\")\n        elif message.type == \"tool_result\":\n            print(f\"Result: {message.content}\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### TypeScript v1 Template (Complete Example)\n\n```typescript\n\u002F**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v1 implementation with generator-based pattern\n *\u002F\n\nimport { query } from '@anthropic-ai\u002Fclaude-agent-sdk';\n\n\u002F\u002F Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst anthropicApiKey = process.env.ANTHROPIC_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys'\n  );\n}\n\n\u002F**\n * Example: Search for AI news and get results from You.com MCP server\n *\u002F\nasync function main() {\n  \u002F\u002F Query Claude with HTTP MCP configuration\n  const result = query({\n    prompt: 'Search for the latest AI news from this week',\n    options: {\n      mcpServers: {\n        ydc: {\n          type: 'http' as const,\n          url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n          headers: {\n            Authorization: `Bearer ${ydcApiKey}`,\n          },\n        },\n      },\n      allowedTools: [\n        'mcp__ydc__you_search',\n        'mcp__ydc__you_express',\n        'mcp__ydc__you_contents',\n      ],\n      model: 'claude-sonnet-4-5-20250929',\n    },\n  });\n\n  \u002F\u002F Process messages as they arrive\n  for await (const msg of result) {\n    if (msg.type === 'text') {\n      console.log(msg.content);\n    } else if (msg.type === 'tool_use') {\n      console.log(`\\n[Tool: ${msg.name}]`);\n      console.log(`Input: ${JSON.stringify(msg.input, null, 2)}`);\n    } else if (msg.type === 'tool_result') {\n      console.log(`Result: ${msg.content}`);\n    }\n  }\n}\n\nmain().catch(console.error);\n```\n\n### TypeScript v2 Template (Complete Example)\n\n```typescript\n\u002F**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v2 implementation with send\u002Freceive pattern\n * Requires TypeScript 5.2+ for 'await using' support\n *\u002F\n\nimport { unstable_v2_createSession } from '@anthropic-ai\u002Fclaude-agent-sdk';\n\n\u002F\u002F Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst anthropicApiKey = process.env.ANTHROPIC_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys'\n  );\n}\n\n\u002F**\n * Example: Search for AI news and get results from You.com MCP server\n *\u002F\nasync function main() {\n  \u002F\u002F Create session with HTTP MCP configuration\n  \u002F\u002F 'await using' ensures automatic cleanup when scope exits\n  await using session = unstable_v2_createSession({\n    mcpServers: {\n      ydc: {\n        type: 'http' as const,\n        url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n        headers: {\n          Authorization: `Bearer ${ydcApiKey}`,\n        },\n      },\n    },\n    allowedTools: [\n      'mcp__ydc__you_search',\n      'mcp__ydc__you_express',\n      'mcp__ydc__you_contents',\n    ],\n    model: 'claude-sonnet-4-5-20250929',\n  });\n\n  \u002F\u002F Send message to Claude\n  await session.send('Search for the latest AI news from this week');\n\n  \u002F\u002F Receive and process messages\n  for await (const msg of session.receive()) {\n    if (msg.type === 'text') {\n      console.log(msg.content);\n    } else if (msg.type === 'tool_use') {\n      console.log(`\\n[Tool: ${msg.name}]`);\n      console.log(`Input: ${JSON.stringify(msg.input, null, 2)}`);\n    } else if (msg.type === 'tool_result') {\n      console.log(`Result: ${msg.content}`);\n    }\n  }\n}\n\nmain().catch(console.error);\n```\n\n## HTTP MCP Server Configuration\n\nAll templates use You.com's **HTTP MCP server** for simplicity:\n\n**Python:**\n```python\nmcp_servers={\n    \"ydc\": {\n        \"type\": \"http\",\n        \"url\": \"https:\u002F\u002Fapi.you.com\u002Fmcp\",\n        \"headers\": {\n            \"Authorization\": f\"Bearer {ydc_api_key}\"\n        }\n    }\n}\n```\n\n**TypeScript:**\n```typescript\nmcpServers: {\n  ydc: {\n    type: 'http' as const,\n    url: 'https:\u002F\u002Fapi.you.com\u002Fmcp',\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`\n    }\n  }\n}\n```\n\n**Benefits of HTTP MCP:**\n- ✅ No local installation required\n- ✅ Stateless request\u002Fresponse model\n- ✅ Always up-to-date with latest version\n- ✅ Consistent across all environments\n- ✅ Production-ready and scalable\n- ✅ Works with existing HTTP infrastructure\n\n## Available You.com Tools\n\nAfter configuration, Claude can discover and use:\n- `mcp__ydc__you_search` - Web and news search\n- `mcp__ydc__you_express` - AI-powered answers with web context\n- `mcp__ydc__you_contents` - Web page content extraction\n\n## Environment Variables\n\nBoth API keys are required:\n\n```bash\n# Add to your .env file or shell profile\nexport YDC_API_KEY=\"your-you-api-key-here\"\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\n```\n\n**Get your API keys:**\n- You.com: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n- Anthropic: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n## Validation Checklist\n\nBefore completing:\n\n- [ ] Package installed: `claude-agent-sdk` (Python) or `@anthropic-ai\u002Fclaude-agent-sdk` (TypeScript)\n- [ ] Environment variables set: `YDC_API_KEY` and `ANTHROPIC_API_KEY`\n- [ ] Template copied or configuration added to existing file\n- [ ] HTTP MCP server configured (`https:\u002F\u002Fapi.you.com\u002Fmcp`)\n- [ ] Authorization header includes `Bearer ${YDC_API_KEY}`\n- [ ] Allowed tools list includes You.com tools\n- [ ] File is executable (Python) or can be compiled (TypeScript)\n- [ ] Ready to test with example query\n\n## Testing Your Integration\n\n**Python:**\n```bash\npython your-file.py\n```\n\n**TypeScript:**\n```bash\n# With tsx (recommended for quick testing)\nnpx tsx your-file.ts\n\n# Or compile and run\ntsc your-file.ts && node your-file.js\n```\n\n## Common Issues\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Cannot find module @anthropic-ai\u002Fclaude-agent-sdk\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nInstall the package:\n\n```bash\n# NPM\nnpm install @anthropic-ai\u002Fclaude-agent-sdk\n\n# Bun\nbun add @anthropic-ai\u002Fclaude-agent-sdk\n\n# Yarn\nyarn add @anthropic-ai\u002Fclaude-agent-sdk\n\n# pnpm\npnpm add @anthropic-ai\u002Fclaude-agent-sdk\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>YDC_API_KEY environment variable is required\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nSet your You.com API key:\n\n```bash\nexport YDC_API_KEY=\"your-api-key-here\"\n```\n\nGet your key at: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>ANTHROPIC_API_KEY environment variable is required\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nSet your Anthropic API key:\n\n```bash\nexport ANTHROPIC_API_KEY=\"your-api-key-here\"\n```\n\nGet your key at: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>MCP connection fails with 401 Unauthorized\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nVerify your YDC_API_KEY is valid:\n1. Check the key at https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n2. Ensure no extra spaces or quotes in the environment variable\n3. Verify the Authorization header format: `Bearer ${YDC_API_KEY}`\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Tools not available or not being called\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nEnsure `allowedTools` includes the correct tool names:\n- `mcp__ydc__you_search` (not `you_search`)\n- `mcp__ydc__you_express` (not `you_express`)\n- `mcp__ydc__you_contents` (not `you_contents`)\n\nTool names must include the `mcp__ydc__` prefix.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>TypeScript error: Cannot use 'await using'\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nThe v2 SDK requires TypeScript 5.2+ for `await using` syntax.\n\n**Solution 1: Update TypeScript**\n```bash\nnpm install -D typescript@latest\n```\n\n**Solution 2: Use manual cleanup**\n```typescript\nconst session = unstable_v2_createSession({ \u002F* options *\u002F });\ntry {\n  await session.send('Your query');\n  for await (const msg of session.receive()) {\n    \u002F\u002F Process messages\n  }\n} finally {\n  session.close();\n}\n```\n\n**Solution 3: Use v1 SDK instead**\nChoose v1 during setup for broader TypeScript compatibility.\n\n\u003C\u002Fdetails>\n\n\n\n## Additional Resources\n\n* You.com MCP Server: https:\u002F\u002Fdocumentation.you.com\u002Fdeveloper-resources\u002Fmcp-server\n* Claude Agent SDK (Python): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Fpython\n* Claude Agent SDK (TypeScript v1): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Ftypescript\n* Claude Agent SDK (TypeScript v2): https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagent-sdk\u002Ftypescript-v2-preview\n* API Keys:\n  - You.com: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n  - Anthropic: https:\u002F\u002Fconsole.anthropic.com\u002Fsettings\u002Fkeys\n",{"name":5,"license":14,"metadata":23,"description":7,"compatibility":28},{"author":24,"version":25,"category":26,"keywords":27},"youdotcom-oss","1.0.0","sdk-integration","claude,anthropic,claude-agent-sdk,agent-sdk,mcp,you.com,integration,http-mcp,web-search,python,typescript","Python 3.10+ or TypeScript 5.2+ (for v2), Node.js 18+","main","54afe4b75ed2eb8f0feabb2f5b57dfa4bcbb3c44",".agents\u002Fskills\u002Fydc-claude-agent-sdk-integration","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal","https:\u002F\u002Fgithub.com\u002Fmeghal86","2026-05-17 14:11:28",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add meghal86\u002Fstacksignal --skill ydc-claude-agent-sdk-integration",{"tool":41,"command":42},"bunx","bunx skills add meghal86\u002Fstacksignal --skill ydc-claude-agent-sdk-integration",{"tool":44,"command":45},"pnpm","pnpm dlx skills add meghal86\u002Fstacksignal --skill ydc-claude-agent-sdk-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-claude-agent-sdk-integration\u002FSKILL.md",true,[49],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"_meta.json","REFERENCE","参考文档",338,"https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-claude-agent-sdk-integration\u002F_meta.json",[56,64,72,80,88,95],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":60,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M78XH0FRP65NYEDHF2BT7NB1","zvukogram","Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M78XEND5ASXYB6MN8AQQGJAF","zohomail","Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels.\nUse this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M78XEBBV3C6DRZFAJXP6RDKS","zoho-recruit","Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows.\nUse this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M78XE5CQG75DZWYSKGXFR99T","zoho-people","Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave.\nUse this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M78XDZKMZAJYFJJFT7MR5ZN2","zoho-mail","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":99,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":18},"01M78XDST8JK0WVDA1F3VPNWXD","zoho-inventory","Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments.\nUse this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FSKILL.md",[],[]]