---
title: "Groundsocial MCP in OpenAI Agents SDK"
description: "Use Groundsocial from the OpenAI Agents SDK (Python) with `MCPServerStreamableHttp` and a static tool filter."
canonical_url: https://groundsocial.dev/mcp/openai-agents-sdk
---
# Groundsocial MCP in OpenAI Agents SDK

> Use Groundsocial from the OpenAI Agents SDK (Python) with `MCPServerStreamableHttp` and a static tool filter.

Groundsocial’s hosted MCP server is `https://api.groundsocial.dev/mcp` (Streamable HTTP). It signs in with OAuth or takes your API key as a Bearer token. [Get a key](https://groundsocial.dev/app/sign-in?new=1) if you want one: it starts with `gs_live_` and comes with free credits.

## Set it up in OpenAI Agents SDK

```bash
pip install openai-agents
```

agent.py:

```python
import asyncio
import os

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp, create_static_tool_filter


async def main() -> None:
    async with MCPServerStreamableHttp(
        name="groundsocial",
        params={
            "url": "https://api.groundsocial.dev/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
            "timeout": 30,
        },
        cache_tools_list=True,
        client_session_timeout_seconds=60,
        tool_filter=create_static_tool_filter(
            allowed_tool_names=["reddit_search_posts", "reddit_post_get", "estimate_cost"]
        ),
    ) as server:
        agent = Agent(
            name="Researcher",
            instructions="Answer from Reddit threads. Link every post you cite.",
            mcp_servers=[server],
        )
        result = await Runner.run(agent, "What do people on Reddit use for self-hosted photo backup?")
        print(result.final_output)


asyncio.run(main())
```

We ran the connection, `list_tools()` (the filter left exactly the three tools) and an `estimate_cost` call with openai-agents 0.26.0 against the live server.

## Add your API key

Keep the key in an Authorization header, never in the URL. `client_session_timeout_seconds` defaults to 5 seconds, which is short for transcript calls; 60 is safer.

## Load fewer tools

The full server lists 593 tools, one per endpoint. Connect only the platforms you use and the agent sees fewer schemas: add `?platforms=` with ids from [the platform list](https://api.groundsocial.dev/v1/platforms), comma-separated.

```text
https://api.groundsocial.dev/mcp?platforms=reddit,youtube,hackernews
```

That URL lists 67 tools: Reddit, YouTube and Hacker News plus the free helpers (`list_endpoints`, `estimate_cost`, `account_balance`, `agent_signup`). OAuth sign-in and keys work the same with or without the filter.

`create_static_tool_filter(allowed_tool_names=…)` picks tools by name; the URL filter (`?platforms=`) also cuts what `list_tools` downloads. `cache_tools_list=True` avoids listing again on every run.

## First prompt to try

> “What do people on Reddit use for self-hosted photo backup? Link every post you cite.”

- “Before you start, use estimate_cost and tell me what this will cost.”
- “Search Reddit, Hacker News and YouTube for what developers say about Bun in 2026, and give me the three strongest arguments for and against.”
- “Get the 25 newest posts on r/startups and table them: title, score, comments, one-line summary.”

## Troubleshooting

### `McpError: Timed out`

Raise `client_session_timeout_seconds`.

### The model sees too many tools

Use `create_static_tool_filter` or a platform filter in the URL.

### Hosted MCP instead?

The Responses API’s hosted MCP tool (`HostedMCPTool`, `server_url`) also works with this URL; the SDK docs show the local client for custom headers.

Check what the server lists without a key: `curl -s https://api.groundsocial.dev/mcp -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'`. Every error says what to do next; codes are in [Errors](https://groundsocial.dev/docs/errors).

## Sources

- [OpenAI Agents SDK docs: Model context protocol (MCP)](https://openai.github.io/openai-agents-python/mcp/)

Checked 27 Nov 2026. Follow the links for the latest.

Reddit, X and every other platform named here are trademarks of their owners. We are not affiliated with or endorsed by any of them.

_Canonical HTML: https://groundsocial.dev/mcp/openai-agents-sdk_

## Site Navigation

### Global Hub
- [Home](https://groundsocial.dev/index.md)
- [Pricing](https://groundsocial.dev/pricing.md)
- [Endpoints](https://groundsocial.dev/endpoints.md)
- [For agents](https://groundsocial.dev/agents.md)
- [Docs](https://groundsocial.dev/docs.md)
- [Compare](https://groundsocial.dev/compare.md)
- [Blog](https://groundsocial.dev/blog.md)
- [Tutorials](https://groundsocial.dev/tutorials.md)
- [Changelog](https://groundsocial.dev/changelog.md)
- [llms.txt](https://groundsocial.dev/llms.txt)
- [Agent skill](https://groundsocial.dev/SKILL.md)

### On This Topic
- [For agents](https://groundsocial.dev/agents.md)
- [MCP setup for every client](https://groundsocial.dev/mcp.md)
- [Groundsocial MCP in Claude Code](https://groundsocial.dev/mcp/claude-code.md)
- [Groundsocial MCP in Claude Desktop and Claude.ai](https://groundsocial.dev/mcp/claude-desktop.md)
- [Groundsocial MCP in Cursor](https://groundsocial.dev/mcp/cursor.md)
- [Groundsocial MCP in VS Code (GitHub Copilot)](https://groundsocial.dev/mcp/vscode.md)
- [Groundsocial MCP in Windsurf (Devin Desktop)](https://groundsocial.dev/mcp/windsurf.md)
- [Groundsocial MCP in Cline](https://groundsocial.dev/mcp/cline.md)
- [Groundsocial MCP in Zed](https://groundsocial.dev/mcp/zed.md)
- [Groundsocial MCP in ChatGPT](https://groundsocial.dev/mcp/chatgpt.md)
- [Groundsocial MCP in Gemini CLI](https://groundsocial.dev/mcp/gemini-cli.md)
- [Groundsocial MCP in Codex CLI](https://groundsocial.dev/mcp/codex-cli.md)
- [Groundsocial MCP in Goose](https://groundsocial.dev/mcp/goose.md)
- [Groundsocial MCP in LibreChat](https://groundsocial.dev/mcp/librechat.md)

## Structured data

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://groundsocial.dev/"},{"@type":"ListItem","position":2,"name":"MCP setup","item":"https://groundsocial.dev/mcp"},{"@type":"ListItem","position":3,"name":"Groundsocial MCP in OpenAI Agents SDK","item":"https://groundsocial.dev/mcp/openai-agents-sdk"}]}
```
