Skip to content

Show HN: MCP-Compatible OpenAI Agents SDK

5 pointssaqadri2 comments
On HN

Hey HN,

OpenAI released the Agents SDK yesterday, which is great because of its simplicity. I just added MCP support for it, which is currently available as a fork here: https://github.com/lastmile-ai/openai-agents-mcp (and on pypi as the openai-agents-mcp package).

You can specify the names of MCP servers to give an Agent access to by setting its `mcp_servers` property.

The Agent will then automatically aggregate tools from the MCP servers, as well as any `tools` specified, and create a single extended list of tools. This means you can seamlessly use MCP servers, local tools, OpenAI-hosted tools, and other kinds of Agent SDK tools through a single unified syntax -- and have them interact in the same Agent run loop!

Everything else stays exactly the same.

```

agent = Agent( name="MCP Assistant",

    instructions="You are a helpful assistant with access to MCP tools.",

    tools=[your_other_tools], # Regular tool use for Agent SDK

    mcp_servers=["fetch", "filesystem"]  # Names of MCP servers from your config file (see below)
)

```

The servers are configured in an `mcp_agent.config.yaml` file, very similar to how they are configured for Claude Desktop:

```

$schema: "https://raw.githubusercontent.com/lastmile-ai/mcp-agent/main..."

mcp:

  servers:

    fetch:

      command: "uvx"

      args: ["mcp-server-fetch"]

    filesystem:

      command: "npx"

      args: ["-y", "@modelcontextprotocol/server-filesystem", "."]

    slack:

      command: "npx"

      args: ["-y", "@modelcontextprotocol/server-slack"]
```

I have submitted an issue and PR into the openai-agents-python repo [2], and my plan is instead of a fork, I will create an extension package for MCP support (coming later today).

I was able to do this pretty quickly (got it working yesterday) because I've been building the mcp-agent library (https://github.com/lastmile-ai/mcp-agent), which makes MCP server aggregation/connection really easy. I did a Show HN about it a few weeks ago [3].

Wanted to share here to get community feedback on whether this is useful, which will help me decide if I should dedicate more time to it.

[1] - https://github.com/lastmile-ai/mcp-agent

[2] - https://github.com/openai/openai-agents-python/issues/23

[3] - https://news.ycombinator.com/item?id=42867050

Comments

Do you there is a chance that openai accept this change? It would be awesome if this became part of the library

You should comment on the issue! I would love native support as well, but I also understand the desire to keep the framework lightweight. It should be fairly straightforward to add an extension package

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.