Skip to main content
This cookbook demonstrates how to build a real-time, LLM-powered content curation assistant using LangChain, Dappier MCP, and the lightweight mcp-use client. You’ll walk through creating a Smart Content Curator that fetches structured, AI-generated content recommendations across a variety of rich lifestyle and news domains — including sports, lifestyle, pet care, planet-friendly living, and local news — and presents them in clean, markdown-ready summaries. In this cookbook, you’ll explore:
  • LangChain + OpenAI: A flexible framework for developing LLM-based agents with tool calling, memory, and decision-making capabilities.
  • Dappier MCP: A Model Context Protocol server that connects your LLM agents to real-time, AI-powered tools — including dynamic recommendations, live summaries, and category-specific insights.
  • AI Recommendations: Use domain-specific AI models like iHeartDogs, iHeartCats, GreenMonster, and WISH-TV AI to pull curated content from verified sources such as One Green Planet, Home Life Media, and WISH-TV, tailored for responsible media, animal lovers, environmentalists, and local news readers.
  • mcp-use: A minimal Python client for integrating any MCP server using stdio or http, ideal for rapid prototyping and production.
  • Content Curation Assistant: A production-ready use case that outputs structured, high-quality summaries from live data — perfect for newsletters, editorial pipelines, or content automation dashboards.
Explore all available AI data models via the Dappier Marketplace.

📦 Installation

To get started, install the required tools and dependencies:
Step 1: Install uv (required to run the Dappier MCP server) macOS / Linux:
Windows:

Step 2: Create a Virtual Environment (Recommended) Create and activate a virtual environment to isolate dependencies. macOS / Linux:
Windows:

Step 3: Install Python Packages Install the necessary Python dependencies including LangChain and mcp-use.

🔑 Setting Up API Keys

You’ll need API keys for both Dappier and OpenAI to authenticate your requests and access tools.
Dappier API Key Visit Dappier to generate your API key. Dappier provides free credits to help you get started. You can set the API key as an environment variable in your terminal:
Or include it in a .env file at the root of your project:

OpenAI API Key Go to OpenAI to retrieve your API key. Set it in your terminal:
Or include it in your .env file:
In your Python script, load the .env file:
Python Python

⚙️ Import Dependencies

Start by importing the required modules to build the content curation agent. This includes components from mcp-use, LangChain, and environment configuration.
Python
These imports enable:
  • Loading environment variables using dotenv
  • Running asynchronous workflows with asyncio
  • Accessing OpenAI models through LangChain
  • Interacting with the Dappier MCP server using mcp-use to retrieve AI-powered content recommendations

📝 Define User Input

We’ll collect a natural language query from the user, allowing them to request multiple types of content in a single prompt — for example, “Give me today’s top sports and lifestyle stories” or “What’s new in pet care and the green planet space?”.
Python

🛰️ Run the Agent with Dappier MCP

This function sets up the MCP agent using mcp-use, formulates a content curation query, and executes it using Dappier’s AI-powered recommendation tools.
Python

🚦 Initialize and Launch the Workflow

The main() function collects the user’s natural language request and runs the content curation workflow using mcp-use and Dappier MCP.
Python
To start the agent, run the main function using asyncio:
Python

🌟 Highlights

This cookbook has guided you through building a real-time content curation assistant using LangChain, Dappier MCP, and the **mcp-use** Python client. By connecting your agent to AI-powered recommendation tools via MCP, you’ve enabled dynamic, markdown-formatted summaries sourced from high-quality, domain-specific data providers across lifestyle, news, pets, and sustainability. Key components of this workflow include:
  • LangChain + OpenAI: A modular framework for building LLM-powered assistants with external tool calling, memory, and decision-making capabilities.
  • Dappier MCP: A Model Context Protocol server that connects agents to real-time, rights-cleared content models such as:
    • Sports News and Lifestyle News from The Publisher Desk
    • WISH-TV AI for local and multicultural news
    • iHeartDogs AI and iHeartCats AI for expert-backed pet content
    • GreenMonster from One Green Planet for sustainable, planet-conscious living
  • mcp-use: A lightweight, open-source Python client that bridges any LLM to any MCP server using standard stdio or http transport — with no closed platform dependencies.
You can discover and integrate more real-time AI models through the Dappier Marketplace, unlocking endless possibilities for editorial automation, newsletter generation, and content personalization. This architecture is ideal for powering custom newsletter engines, editorial planning dashboards, and automated blog pipelines — all fueled by real-time, AI-curated insights.