{"id":51548797,"url":"https://github.com/sharethis-github/predactiv-mcp-python-samples","last_synced_at":"2026-07-09T21:30:33.366Z","repository":{"id":368468755,"uuid":"1285178181","full_name":"sharethis-github/predactiv-mcp-python-samples","owner":"sharethis-github","description":"Sample code to demonstrate how to use Predactiv MCP","archived":false,"fork":false,"pushed_at":"2026-06-30T17:30:04.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-30T19:05:48.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharethis-github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-30T14:52:31.000Z","updated_at":"2026-06-30T14:54:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sharethis-github/predactiv-mcp-python-samples","commit_stats":null,"previous_names":["sharethis-github/predactiv-mcp-python-samples"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sharethis-github/predactiv-mcp-python-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharethis-github%2Fpredactiv-mcp-python-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharethis-github%2Fpredactiv-mcp-python-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharethis-github%2Fpredactiv-mcp-python-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharethis-github%2Fpredactiv-mcp-python-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharethis-github","download_url":"https://codeload.github.com/sharethis-github/predactiv-mcp-python-samples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharethis-github%2Fpredactiv-mcp-python-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35313755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-09T21:30:32.725Z","updated_at":"2026-07-09T21:30:33.361Z","avatar_url":"https://github.com/sharethis-github.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Predactiv MCP — AI Agent Samples in Python\n\nSample code demonstrating how to connect AI agents to the **Predactiv MCP server**\n(`https://mcp.predactiv.com`) from Python.\n\nThe [Predactiv Data Platform](https://predactiv.com) is exposed as a set of tools over the\n[Model Context Protocol (MCP)](https://modelcontextprotocol.io). These samples show how to\nauthenticate, discover those tools at runtime, and let a large language model use them to\nwork with your audiences, datasets, datasources, destinations, and more.\n\n## What the Predactiv MCP server can do\n\nPredactiv MCP server (`https://mcp.predactiv.com`) turns the Predactiv Data Platform into an\nAI agent-native toolset over MCP, letting an LLM go from raw data to modeled, deliverable\naudiences without leaving the conversation. The toolset spans a few broad areas (and grows\nover time):\n\n- **Audience intelligence** — build, preview, and refine audience segments with live size\n  estimates, then deliver them to downstream platforms. Segments can be assembled from\n  natural-language intent, predictive signals, and rich filters.\n- **Data + ML modeling** — datasets aren't just stored, they're activated. First-party data\n  feeds a library of machine-learning models that enrich and expand reach: **audience\n  enrichment**, **lookalike modeling**, **URL-similarity / contextual models**, and more —\n  with the catalog of model types expanding over time.\n- **Signals \u0026 discovery** — explore thousands of predictor signals, filter metadata, data\n  sources, and delivery destinations (e.g. LiveRamp, The Trade Desk) to target precisely.\n- **Insights** — surface demographic, behavioral, and geographic breakdowns of an audience\n  with share and index analytics.\n\nTools are discovered dynamically at runtime (`tools/list`), so agents always see the latest\ncapabilities, and every call is OAuth2 bearer-authenticated — see\n[`oauth-token-lib`](oauth-token-lib).\n\n## What's in this repo\n\nEach directory is a self-contained sample built on a different framework, plus a shared\nauthentication helper:\n\n| Directory | What it shows | LLM (for demo) |\n| --- | --- | --- |\n| [`langchain/`](langchain) | Agent built with [LangChain](https://python.langchain.com/) + `langchain-mcp-adapters`, client-side tool-calling loop | OpenAI |\n| [`claude/`](claude) | Agent using [Anthropic Claude](https://www.anthropic.com/) via the native server-side MCP connector | Anthropic Claude |\n| [`openai/`](openai) | Agent using [OpenAI](https://platform.openai.com/) GPT via the native server-side MCP connector | OpenAI |\n| [`mcp-sdk/`](mcp-sdk) | Direct use of the [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), client-side tool-calling loop with no framework | OpenAI |\n| [`oauth-token-lib/`](oauth-token-lib) | Shared OAuth2 authentication helper used by all samples | — |\n\n\u003e **The LLM column is just what each sample happens to use for demonstration — not a requirement.** The framework-based samples are model-agnostic: [`langchain/`](langchain) and [`mcp-sdk/`](mcp-sdk) can run on any LLM that supports tool calling (OpenAI, Anthropic, or others) by swapping the client and the `*_MODEL` constant at the top of `agent.py`. The two **connector** samples are tied to their provider by design — [`claude/`](claude) demonstrates Anthropic's native MCP connector and [`openai/`](openai) demonstrates OpenAI's, so each only makes sense with that provider. Predactiv MCP itself is LLM-agnostic; the choice of model is entirely yours.\n\n## How the samples work\n\nEvery sample follows the same three steps:\n\n1. **Authenticate** — [`oauth-token-lib`](oauth-token-lib) exchanges your `CLIENT_ID` and\n   `CLIENT_SECRET` for an OAuth2 bearer token (client-credentials flow).\n2. **Connect \u0026 discover tools** — the sample connects to the Predactiv MCP server over\n   HTTP and fetches the available tools dynamically (nothing is hardcoded).\n3. **Run the agent** — the MCP tools are bound to an LLM, which calls them to accomplish a\n   natural-language goal.\n\n\u003e The [`claude/`](claude) and [`openai/`](openai) samples are a variation on steps 2–3:\n\u003e instead of fetching tools and running the loop client-side, they hand the MCP server\n\u003e definition to the provider's API (Anthropic's Messages API / OpenAI's Responses API), and\n\u003e the provider connects to the server and runs the tool-calling loop server-side. See each\n\u003e sample's README for details.\n\n## Getting started\n\n1. **Get credentials.** You'll need a Predactiv `CLIENT_ID` and `CLIENT_SECRET`.\n   Contact [Predactiv](https://predactiv.com/contact-us/) if you don't have them.\n2. **Pick a sample.** [`langchain/`](langchain) is a good starting point.\n3. **Follow that sample's README** for setup, configuration, and run instructions.\n\n```bash\ncd langchain\n\n# (recommended) create and activate a virtual environment\npython -m venv .venv\nsource .venv/bin/activate        # on Windows: .venv\\Scripts\\activate\n\npip install -r requirements.txt\nexport CLIENT_ID=your-predactiv-client-id\nexport CLIENT_SECRET=your-predactiv-client-secret\npython agent.py\n```\n\n## Prerequisites\n\n- Python 3.9+ (the [`mcp-sdk/`](mcp-sdk) sample requires Python 3.10+, per the MCP Python SDK)\n- Predactiv OAuth2 API credentials (`CLIENT_ID` / `CLIENT_SECRET`)\n- An LLM provider API key, depending on the sample:\n  - `OPENAI_API_KEY` — [`langchain/`](langchain), [`openai/`](openai), [`mcp-sdk/`](mcp-sdk)\n  - `ANTHROPIC_API_KEY` — [`claude/`](claude)\n\n  See each sample's README for details.\n\n## Learn more\n\n- Predactiv: https://predactiv.com\n- Predactiv MCP server: `https://mcp.predactiv.com`\n- Predactiv OAuth2 token url: `https://platform-api.predactiv.com/v2/oauth/token`\n- Model Context Protocol: https://modelcontextprotocol.io\n\n## License\n\nSee [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharethis-github%2Fpredactiv-mcp-python-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharethis-github%2Fpredactiv-mcp-python-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharethis-github%2Fpredactiv-mcp-python-samples/lists"}