{
  "schemaVersion": "1.0",
  "item": {
    "slug": "ydc-claude-agent-sdk-integration",
    "name": "Integrate Claude Agent SDK with You.com MCP server",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/EdwardIrby/ydc-claude-agent-sdk-integration",
    "canonicalUrl": "https://clawhub.ai/EdwardIrby/ydc-claude-agent-sdk-integration",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/ydc-claude-agent-sdk-integration",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ydc-claude-agent-sdk-integration",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/ydc-claude-agent-sdk-integration"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/ydc-claude-agent-sdk-integration",
    "agentPageUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Integrate Claude Agent SDK with You.com MCP",
        "body": "Interactive workflow to set up Claude Agent SDK with You.com's HTTP MCP server."
      },
      {
        "title": "Workflow",
        "body": "Ask: Language Choice\n\nPython or TypeScript?\n\n\n\nIf TypeScript - Ask: SDK Version\n\nv1 (stable, generator-based) or v2 (preview, send/receive pattern)?\nNote: v2 requires TypeScript 5.2+ for await using support\n\n\n\nInstall Package\n\nPython: pip install claude-agent-sdk\nTypeScript: npm install @anthropic-ai/claude-agent-sdk\n\n\n\nAsk: Environment Variables\n\nUsing standard YDC_API_KEY and ANTHROPIC_API_KEY?\nOr custom names?\nHave they set them?\nIf NO: Guide to get keys:\n\nYDC_API_KEY: https://you.com/platform/api-keys\nANTHROPIC_API_KEY: https://console.anthropic.com/settings/keys\n\n\n\n\n\nAsk: File Location\n\nNEW file: Ask where to create and what to name\nEXISTING file: Ask which file to integrate into (add HTTP MCP config)\n\n\n\nCreate/Update File\nFor NEW files:\n\nUse the complete template code from the \"Complete Templates\" section below\nUser can run immediately with their API keys set\n\nFor EXISTING files:\n\n\nAdd HTTP MCP server configuration to their existing code\n\n\nPython configuration block:\nfrom claude_agent_sdk import query, ClaudeAgentOptions\n\noptions = ClaudeAgentOptions(\n    mcp_servers={\n        \"ydc\": {\n            \"type\": \"http\",\n            \"url\": \"https://api.you.com/mcp\",\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\nTypeScript configuration block:\nconst options = {\n  mcpServers: {\n    ydc: {\n      type: 'http' as const,\n      url: 'https://api.you.com/mcp',\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};"
      },
      {
        "title": "Complete Templates",
        "body": "Use these complete templates for new files. Each template is ready to run with your API keys set."
      },
      {
        "title": "Python Template (Complete Example)",
        "body": "\"\"\"\nClaude Agent SDK with You.com HTTP MCP Server\nPython implementation with async/await 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://you.com/platform/api-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://console.anthropic.com/settings/keys\"\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://api.you.com/mcp\",\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())"
      },
      {
        "title": "TypeScript v1 Template (Complete Example)",
        "body": "/**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v1 implementation with generator-based pattern\n */\n\nimport { query } from '@anthropic-ai/claude-agent-sdk';\n\n// 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://you.com/platform/api-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https://console.anthropic.com/settings/keys'\n  );\n}\n\n/**\n * Example: Search for AI news and get results from You.com MCP server\n */\nasync function main() {\n  // 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://api.you.com/mcp',\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  // 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);"
      },
      {
        "title": "TypeScript v2 Template (Complete Example)",
        "body": "/**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v2 implementation with send/receive pattern\n * Requires TypeScript 5.2+ for 'await using' support\n */\n\nimport { unstable_v2_createSession } from '@anthropic-ai/claude-agent-sdk';\n\n// 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://you.com/platform/api-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https://console.anthropic.com/settings/keys'\n  );\n}\n\n/**\n * Example: Search for AI news and get results from You.com MCP server\n */\nasync function main() {\n  // Create session with HTTP MCP configuration\n  // '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://api.you.com/mcp',\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  // Send message to Claude\n  await session.send('Search for the latest AI news from this week');\n\n  // 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);"
      },
      {
        "title": "HTTP MCP Server Configuration",
        "body": "All templates use You.com's HTTP MCP server for simplicity:\n\nPython:\n\nmcp_servers={\n    \"ydc\": {\n        \"type\": \"http\",\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\n            \"Authorization\": f\"Bearer {ydc_api_key}\"\n        }\n    }\n}\n\nTypeScript:\n\nmcpServers: {\n  ydc: {\n    type: 'http' as const,\n    url: 'https://api.you.com/mcp',\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`\n    }\n  }\n}\n\nBenefits of HTTP MCP:\n\n✅ No local installation required\n✅ Stateless request/response 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"
      },
      {
        "title": "Available You.com Tools",
        "body": "After configuration, Claude can discover and use:\n\nmcp__ydc__you_search - Web and news search\nmcp__ydc__you_express - AI-powered answers with web context\nmcp__ydc__you_contents - Web page content extraction"
      },
      {
        "title": "Environment Variables",
        "body": "Both API keys are required:\n\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\nGet your API keys:\n\nYou.com: https://you.com/platform/api-keys\nAnthropic: https://console.anthropic.com/settings/keys"
      },
      {
        "title": "Validation Checklist",
        "body": "Before completing:\n\nPackage installed: claude-agent-sdk (Python) or @anthropic-ai/claude-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://api.you.com/mcp)\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"
      },
      {
        "title": "Testing Your Integration",
        "body": "Python:\n\npython your-file.py\n\nTypeScript:\n\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"
      },
      {
        "title": "Common Issues",
        "body": "Install the package:\n\n# NPM\nnpm install @anthropic-ai/claude-agent-sdk\n\n# Bun\nbun add @anthropic-ai/claude-agent-sdk\n\n# Yarn\nyarn add @anthropic-ai/claude-agent-sdk\n\n# pnpm\npnpm add @anthropic-ai/claude-agent-sdk\n\nSet your You.com API key:\n\nexport YDC_API_KEY=\"your-api-key-here\"\n\nGet your key at: https://you.com/platform/api-keys\n\nSet your Anthropic API key:\n\nexport ANTHROPIC_API_KEY=\"your-api-key-here\"\n\nGet your key at: https://console.anthropic.com/settings/keys\n\nVerify your YDC_API_KEY is valid:\n\nCheck the key at https://you.com/platform/api-keys\nEnsure no extra spaces or quotes in the environment variable\nVerify the Authorization header format: Bearer ${YDC_API_KEY}\n\nEnsure allowedTools includes the correct tool names:\n\nmcp__ydc__you_search (not you_search)\nmcp__ydc__you_express (not you_express)\nmcp__ydc__you_contents (not you_contents)\n\nTool names must include the mcp__ydc__ prefix.\n\nThe v2 SDK requires TypeScript 5.2+ for await using syntax.\n\nSolution 1: Update TypeScript\n\nnpm install -D typescript@latest\n\nSolution 2: Use manual cleanup\n\nconst session = unstable_v2_createSession({ /* options */ });\ntry {\n  await session.send('Your query');\n  for await (const msg of session.receive()) {\n    // Process messages\n  }\n} finally {\n  session.close();\n}\n\nSolution 3: Use v1 SDK instead\nChoose v1 during setup for broader TypeScript compatibility."
      },
      {
        "title": "Additional Resources",
        "body": "You.com MCP Server: https://documentation.you.com/developer-resources/mcp-server\nClaude Agent SDK (Python): https://platform.claude.com/docs/en/agent-sdk/python\nClaude Agent SDK (TypeScript v1): https://platform.claude.com/docs/en/agent-sdk/typescript\nClaude Agent SDK (TypeScript v2): https://platform.claude.com/docs/en/agent-sdk/typescript-v2-preview\nAPI Keys:\n\nYou.com: https://you.com/platform/api-keys\nAnthropic: https://console.anthropic.com/settings/keys"
      }
    ],
    "body": "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\nWorkflow\n\nAsk: Language Choice\n\nPython or TypeScript?\n\nIf TypeScript - Ask: SDK Version\n\nv1 (stable, generator-based) or v2 (preview, send/receive pattern)?\nNote: v2 requires TypeScript 5.2+ for await using support\n\nInstall Package\n\nPython: pip install claude-agent-sdk\nTypeScript: npm install @anthropic-ai/claude-agent-sdk\n\nAsk: Environment Variables\n\nUsing standard YDC_API_KEY and ANTHROPIC_API_KEY?\nOr custom names?\nHave they set them?\nIf NO: Guide to get keys:\nYDC_API_KEY: https://you.com/platform/api-keys\nANTHROPIC_API_KEY: https://console.anthropic.com/settings/keys\n\nAsk: File Location\n\nNEW file: Ask where to create and what to name\nEXISTING file: Ask which file to integrate into (add HTTP MCP config)\n\nCreate/Update File\n\nFor NEW files:\n\nUse the complete template code from the \"Complete Templates\" section below\nUser can run immediately with their API keys set\n\nFor EXISTING files:\n\nAdd HTTP MCP server configuration to their existing code\n\nPython configuration block:\n\nfrom claude_agent_sdk import query, ClaudeAgentOptions\n\noptions = ClaudeAgentOptions(\n    mcp_servers={\n        \"ydc\": {\n            \"type\": \"http\",\n            \"url\": \"https://api.you.com/mcp\",\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\nTypeScript configuration block:\n\nconst options = {\n  mcpServers: {\n    ydc: {\n      type: 'http' as const,\n      url: 'https://api.you.com/mcp',\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\nComplete Templates\n\nUse these complete templates for new files. Each template is ready to run with your API keys set.\n\nPython Template (Complete Example)\n\"\"\"\nClaude Agent SDK with You.com HTTP MCP Server\nPython implementation with async/await 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://you.com/platform/api-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://console.anthropic.com/settings/keys\"\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://api.you.com/mcp\",\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\nTypeScript v1 Template (Complete Example)\n/**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v1 implementation with generator-based pattern\n */\n\nimport { query } from '@anthropic-ai/claude-agent-sdk';\n\n// 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://you.com/platform/api-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https://console.anthropic.com/settings/keys'\n  );\n}\n\n/**\n * Example: Search for AI news and get results from You.com MCP server\n */\nasync function main() {\n  // 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://api.you.com/mcp',\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  // 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\nTypeScript v2 Template (Complete Example)\n/**\n * Claude Agent SDK with You.com HTTP MCP Server\n * TypeScript v2 implementation with send/receive pattern\n * Requires TypeScript 5.2+ for 'await using' support\n */\n\nimport { unstable_v2_createSession } from '@anthropic-ai/claude-agent-sdk';\n\n// 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://you.com/platform/api-keys'\n  );\n}\n\nif (!anthropicApiKey) {\n  throw new Error(\n    'ANTHROPIC_API_KEY environment variable is required. ' +\n      'Get your key at: https://console.anthropic.com/settings/keys'\n  );\n}\n\n/**\n * Example: Search for AI news and get results from You.com MCP server\n */\nasync function main() {\n  // Create session with HTTP MCP configuration\n  // '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://api.you.com/mcp',\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  // Send message to Claude\n  await session.send('Search for the latest AI news from this week');\n\n  // 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\nHTTP MCP Server Configuration\n\nAll templates use You.com's HTTP MCP server for simplicity:\n\nPython:\n\nmcp_servers={\n    \"ydc\": {\n        \"type\": \"http\",\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\n            \"Authorization\": f\"Bearer {ydc_api_key}\"\n        }\n    }\n}\n\n\nTypeScript:\n\nmcpServers: {\n  ydc: {\n    type: 'http' as const,\n    url: 'https://api.you.com/mcp',\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`\n    }\n  }\n}\n\n\nBenefits of HTTP MCP:\n\n✅ No local installation required\n✅ Stateless request/response 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\nAvailable You.com Tools\n\nAfter configuration, Claude can discover and use:\n\nmcp__ydc__you_search - Web and news search\nmcp__ydc__you_express - AI-powered answers with web context\nmcp__ydc__you_contents - Web page content extraction\nEnvironment Variables\n\nBoth API keys are required:\n\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\nGet your API keys:\n\nYou.com: https://you.com/platform/api-keys\nAnthropic: https://console.anthropic.com/settings/keys\nValidation Checklist\n\nBefore completing:\n\n Package installed: claude-agent-sdk (Python) or @anthropic-ai/claude-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://api.you.com/mcp)\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\nTesting Your Integration\n\nPython:\n\npython your-file.py\n\n\nTypeScript:\n\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\nCommon Issues\n<details> <summary><strong>Cannot find module @anthropic-ai/claude-agent-sdk</strong></summary>\n\nInstall the package:\n\n# NPM\nnpm install @anthropic-ai/claude-agent-sdk\n\n# Bun\nbun add @anthropic-ai/claude-agent-sdk\n\n# Yarn\nyarn add @anthropic-ai/claude-agent-sdk\n\n# pnpm\npnpm add @anthropic-ai/claude-agent-sdk\n\n</details> <details> <summary><strong>YDC_API_KEY environment variable is required</strong></summary>\n\nSet your You.com API key:\n\nexport YDC_API_KEY=\"your-api-key-here\"\n\n\nGet your key at: https://you.com/platform/api-keys\n\n</details> <details> <summary><strong>ANTHROPIC_API_KEY environment variable is required</strong></summary>\n\nSet your Anthropic API key:\n\nexport ANTHROPIC_API_KEY=\"your-api-key-here\"\n\n\nGet your key at: https://console.anthropic.com/settings/keys\n\n</details> <details> <summary><strong>MCP connection fails with 401 Unauthorized</strong></summary>\n\nVerify your YDC_API_KEY is valid:\n\nCheck the key at https://you.com/platform/api-keys\nEnsure no extra spaces or quotes in the environment variable\nVerify the Authorization header format: Bearer ${YDC_API_KEY}\n</details> <details> <summary><strong>Tools not available or not being called</strong></summary>\n\nEnsure allowedTools includes the correct tool names:\n\nmcp__ydc__you_search (not you_search)\nmcp__ydc__you_express (not you_express)\nmcp__ydc__you_contents (not you_contents)\n\nTool names must include the mcp__ydc__ prefix.\n\n</details> <details> <summary><strong>TypeScript error: Cannot use 'await using'</strong></summary>\n\nThe v2 SDK requires TypeScript 5.2+ for await using syntax.\n\nSolution 1: Update TypeScript\n\nnpm install -D typescript@latest\n\n\nSolution 2: Use manual cleanup\n\nconst session = unstable_v2_createSession({ /* options */ });\ntry {\n  await session.send('Your query');\n  for await (const msg of session.receive()) {\n    // Process messages\n  }\n} finally {\n  session.close();\n}\n\n\nSolution 3: Use v1 SDK instead Choose v1 during setup for broader TypeScript compatibility.\n\n</details>\nAdditional Resources\nYou.com MCP Server: https://documentation.you.com/developer-resources/mcp-server\nClaude Agent SDK (Python): https://platform.claude.com/docs/en/agent-sdk/python\nClaude Agent SDK (TypeScript v1): https://platform.claude.com/docs/en/agent-sdk/typescript\nClaude Agent SDK (TypeScript v2): https://platform.claude.com/docs/en/agent-sdk/typescript-v2-preview\nAPI Keys:\nYou.com: https://you.com/platform/api-keys\nAnthropic: https://console.anthropic.com/settings/keys"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/EdwardIrby/ydc-claude-agent-sdk-integration",
    "publisherUrl": "https://clawhub.ai/EdwardIrby/ydc-claude-agent-sdk-integration",
    "owner": "EdwardIrby",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration",
    "downloadUrl": "https://openagent3.xyz/downloads/ydc-claude-agent-sdk-integration",
    "agentUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ydc-claude-agent-sdk-integration/agent.md"
  }
}