ydc-openai-agent-sdk-integration

0
0
Source

Integrate OpenAI Agents SDK with You.com MCP server - Hosted and Streamable HTTP support for Python and TypeScript. Use when developer mentions OpenAI Agents SDK, OpenAI agents, or integrating OpenAI with MCP.

Install

mkdir -p .claude/skills/ydc-openai-agent-sdk-integration && curl -L -o skill.zip "https://mcp.directory/api/skills/download/9151" && unzip -o skill.zip -d .claude/skills/ydc-openai-agent-sdk-integration && rm skill.zip

Installs to .claude/skills/ydc-openai-agent-sdk-integration

About this skill

Integrate OpenAI Agents SDK with You.com MCP

Interactive workflow to set up OpenAI Agents SDK with You.com's MCP server.

Workflow

  1. Ask: Language Choice

    • Python or TypeScript?
  2. Ask: MCP Configuration Type

    • Hosted MCP (OpenAI-managed with server URL): Recommended for simplicity
    • Streamable HTTP (Self-managed connection): For custom infrastructure
  3. Install Package

    • Python: pip install openai-agents
    • TypeScript: npm install @openai/agents
  4. Ask: Environment Variables

    For Both Modes:

    • YDC_API_KEY (You.com API key for Bearer token)
    • OPENAI_API_KEY (OpenAI API key)

    Have they set them?

  5. Ask: File Location

    • NEW file: Ask where to create and what to name
    • EXISTING file: Ask which file to integrate into (add MCP config)
  6. Create/Update File

    For NEW files:

    • Use the complete template code from the "Complete Templates" section below
    • User can run immediately with their API keys set

    For EXISTING files:

    • Add MCP server configuration to their existing code

    Hosted MCP configuration block (Python):

    from agents import Agent, Runner
    from agents.mcp import HostedMCPTool
    
    # Validate: ydc_api_key = os.getenv("YDC_API_KEY")
    agent = Agent(
        name="Assistant",
        instructions="Use You.com tools to answer questions.",
        tools=[
            HostedMCPTool(
                tool_config={
                    "type": "mcp",
                    "server_label": "ydc",
                    "server_url": "https://api.you.com/mcp",
                    "headers": {
                        "Authorization": f"Bearer {ydc_api_key}"
                    },
                    "require_approval": "never",
                }
            )
        ],
    )
    

    Hosted MCP configuration block (TypeScript):

    import { Agent, hostedMcpTool } from '@openai/agents';
    
    // Validate: const ydcApiKey = process.env.YDC_API_KEY;
    const agent = new Agent({
      name: 'Assistant',
      instructions: 'Use You.com tools to answer questions.',
      tools: [
        hostedMcpTool({
         serverLabel: 'ydc',
          serverUrl: 'https://api.you.com/mcp',
          headers: {
            Authorization: `Bearer ${ydcApiKey}`,
          },
        }),
      ],
    });
    

    Streamable HTTP configuration block (Python):

    from agents import Agent, Runner
    from agents.mcp import MCPServerStreamableHttp
    
    # Validate: ydc_api_key = os.getenv("YDC_API_KEY")
    async with MCPServerStreamableHttp(
        name="You.com MCP Server",
        params={
            "url": "https://api.you.com/mcp",
            "headers": {"Authorization": f"Bearer {ydc_api_key}"},
            "timeout": 10,
        },
        cache_tools_list=True,
        max_retry_attempts=3,
    ) as server:
        agent = Agent(
            name="Assistant",
            instructions="Use You.com tools to answer questions.",
            mcp_servers=[server],
        )
    

    Streamable HTTP configuration block (TypeScript):

    import { Agent, MCPServerStreamableHttp } from '@openai/agents';
    
    // Validate: const ydcApiKey = process.env.YDC_API_KEY;
    const mcpServer = new MCPServerStreamableHttp({
      url: 'https://api.you.com/mcp',
      name: 'You.com MCP Server',
      requestInit: {
        headers: {
          Authorization: `Bearer ${ydcApiKey}`,
        },
      },
    });
    
    const agent = new Agent({
      name: 'Assistant',
      instructions: 'Use You.com tools to answer questions.',
      mcpServers: [mcpServer],
    });
    

Complete Templates

Use these complete templates for new files. Each template is ready to run with your API keys set.

Python Hosted MCP Template (Complete Example)

"""
OpenAI Agents SDK with You.com Hosted MCP
Python implementation with OpenAI-managed infrastructure
"""

import os
import asyncio
from agents import Agent, Runner
from agents.mcp import HostedMCPTool

# Validate environment variables
ydc_api_key = os.getenv("YDC_API_KEY")
openai_api_key = os.getenv("OPENAI_API_KEY")

if not ydc_api_key:
    raise ValueError(
        "YDC_API_KEY environment variable is required. "
        "Get your key at: https://you.com/platform/api-keys"
    )

if not openai_api_key:
    raise ValueError(
        "OPENAI_API_KEY environment variable is required. "
        "Get your key at: https://platform.openai.com/api-keys"
    )


async def main():
    """
    Example: Search for AI news using You.com hosted MCP tools
    """
    # Configure agent with hosted MCP tools
    agent = Agent(
        name="AI News Assistant",
        instructions="Use You.com tools to search for and answer questions about AI news.",
        tools=[
            HostedMCPTool(
                tool_config={
                    "type": "mcp",
                    "server_label": "ydc",
                    "server_url": "https://api.you.com/mcp",
                    "headers": {
                        "Authorization": f"Bearer {ydc_api_key}"
                    },
                    "require_approval": "never",
                }
            )
        ],
    )

    # Run agent with user query
    result = await Runner.run(
        agent,
        "Search for the latest AI news from this week"
    )

    print(result.final_output)


if __name__ == "__main__":
    asyncio.run(main())

Python Streamable HTTP Template (Complete Example)

"""
OpenAI Agents SDK with You.com Streamable HTTP MCP
Python implementation with self-managed connection
"""

import os
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

# Validate environment variables
ydc_api_key = os.getenv("YDC_API_KEY")
openai_api_key = os.getenv("OPENAI_API_KEY")

if not ydc_api_key:
    raise ValueError(
        "YDC_API_KEY environment variable is required. "
        "Get your key at: https://you.com/platform/api-keys"
    )

if not openai_api_key:
    raise ValueError(
        "OPENAI_API_KEY environment variable is required. "
        "Get your key at: https://platform.openai.com/api-keys"
    )


async def main():
    """
    Example: Search for AI news using You.com streamable HTTP MCP server
    """
    # Configure streamable HTTP MCP server
    async with MCPServerStreamableHttp(
        name="You.com MCP Server",
        params={
            "url": "https://api.you.com/mcp",
            "headers": {"Authorization": f"Bearer {ydc_api_key}"},
            "timeout": 10,
        },
        cache_tools_list=True,
        max_retry_attempts=3,
    ) as server:
        # Configure agent with MCP server
        agent = Agent(
            name="AI News Assistant",
            instructions="Use You.com tools to search for and answer questions about AI news.",
            mcp_servers=[server],
        )

        # Run agent with user query
        result = await Runner.run(
            agent,
            "Search for the latest AI news from this week"
        )

        print(result.final_output)


if __name__ == "__main__":
    asyncio.run(main())

TypeScript Hosted MCP Template (Complete Example)

/**
 * OpenAI Agents SDK with You.com Hosted MCP
 * TypeScript implementation with OpenAI-managed infrastructure
 */

import { Agent, run, hostedMcpTool } from '@openai/agents';

// Validate environment variables
const ydcApiKey = process.env.YDC_API_KEY;
const openaiApiKey = process.env.OPENAI_API_KEY;

if (!ydcApiKey) {
  throw new Error(
    'YDC_API_KEY environment variable is required. ' +
      'Get your key at: https://you.com/platform/api-keys'
  );
}

if (!openaiApiKey) {
  throw new Error(
    'OPENAI_API_KEY environment variable is required. ' +
      'Get your key at: https://platform.openai.com/api-keys'
  );
}

/**
 * Example: Search for AI news using You.com hosted MCP tools
 */
async function main() {
  // Configure agent with hosted MCP tools
  const agent = new Agent({
    name: 'AI News Assistant',
    instructions:
      'Use You.com tools to search for and answer questions about AI news.',
    tools: [
      hostedMcpTool({
        serverLabel: 'ydc',
        serverUrl: 'https://api.you.com/mcp',
        headers: {
          Authorization: `Bearer ${ydcApiKey}`,
        },
      }),
    ],
  });

  // Run agent with user query
  const result = await run(
    agent,
    'Search for the latest AI news from this week'
  );

  console.log(result.finalOutput);
}

main().catch(console.error);

TypeScript Streamable HTTP Template (Complete Example)

/**
 * OpenAI Agents SDK with You.com Streamable HTTP MCP
 * TypeScript implementation with self-managed connection
 */

import { Agent, run, MCPServerStreamableHttp } from '@openai/agents';

// Validate environment variables
const ydcApiKey = process.env.YDC_API_KEY;
const openaiApiKey = process.env.OPENAI_API_KEY;

if (!ydcApiKey) {
  throw new Error(
    'YDC_API_KEY environment variable is required. ' +
      'Get your key at: https://you.com/platform/api-keys'
  );
}

if (!openaiApiKey) {
  throw new Error(
    'OPENAI_API_KEY environment variable is required. ' +
      'Get your key at: https://platform.openai.com/api-keys'
  );
}

/**
 * Example: Search for AI news using You.com streamable HTTP MCP server
 */
async function main() {
  // Configure streamable HTTP MCP server
  const mcpServer = new MCPServerStreamableHttp({
    url: 'https://api.you.com/mcp',
    name: 'You.com MCP Server',
    requestInit: {
      headers: {
        Authorization: `Bearer ${ydcApiKey}`,
      },
    },
  });

  try {
    // Connect to MCP server
    await mcpServer.connect();

    // Configure agent with MCP server
    const agent = new Agent({
      name: 'AI News Assistant',
      instructions:
        'Use You.com tools to search for 

---

*Content truncated.*

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,4071,302

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,2201,024

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

9001,013

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

958658

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

970608

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,033496

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.