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:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Step 2: Create a Virtual Environment (Recommended) Create and activate a virtual environment to isolate dependencies. macOS / Linux:
python3 -m venv venv
source venv/bin/activate
Windows:
python -m venv venv
venv\Scripts\activate

Step 3: Install Python Packages Install the necessary Python dependencies including LangChain and mcp-use.
pip install langchain-openai mcp-use python-dotenv

🔑 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:
export DAPPIER_API_KEY=your-dappier-api-key
Or include it in a .env file at the root of your project:
DAPPIER_API_KEY=your-dappier-api-key

OpenAI API Key Go to OpenAI to retrieve your API key. Set it in your terminal:
export OPENAI_API_KEY=your-openai-api-key
Or include it in your .env file:
OPENAI_API_KEY=your-openai-api-key
In your Python script, load the .env file:
Python Python
from dotenv import load_dotenv

load_dotenv()

⚙️ 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
import asyncio
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from mcp_use import MCPAgent, MCPClient
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
def get_user_input():
    query = input("What kind of curated content are you interested in? You can combine multiple topics (e.g., sports and lifestyle, pet care and green planet): ").strip()
    return query

🛰️ 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
async def run_content_curator(query: str):
    # Load environment variables
    load_dotenv()

    # Retrieve API key
    api_key = os.getenv("DAPPIER_API_KEY")
    if not api_key:
        raise ValueError("DAPPIER_API_KEY is not set")

    # MCPClient configuration using stdio transport (via uvx dappier-mcp)
    config = {
        "mcpServers": {
            "dappier": {
                "command": "uvx",
                "args": ["dappier-mcp"],
                "env": {
                    "DAPPIER_API_KEY": api_key
                }
            }
        }
    }

    # Create MCP client and LLM
    client = MCPClient.from_dict(config)
    llm = ChatOpenAI(model="gpt-4o")

    # Create the agent
    agent = MCPAgent(llm=llm, client=client, max_steps=30)

    try:
        # Formulate prompt
        full_prompt = f"""
        Act as a smart content curator. Use Dappier’s AI-powered tools to fetch the latest articles and recommendations based on this query: "{query}"

        For each topic:
        - Retrieve high-quality, AI-recommended articles
        - Provide a brief summary for each
        - Format everything as a clean, readable markdown newsletter

        Output structure:
        - Group articles by topic
        - Use markdown formatting (e.g., headlines, bullet points, bold)
        - Include direct links to sources where available
        """

        print("\n" + "-" * 40)
        print(f"Running content curation for: {query}")
        print("\n=== Response ===\n")

        result = await agent.run(full_prompt, max_steps=30)
        print(result)

    finally:
        # Clean up sessions
        if client.sessions:
            await client.close_all_sessions()

🚦 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
async def main():
    query = get_user_input()
    await run_content_curator(query)
To start the agent, run the main function using asyncio:
Python
if __name__ == "__main__":
    asyncio.run(main())
What kind of curated content are you interested in? You can combine multiple topics (e.g., sports and lifestyle, pet care and green planet): Please fetch latest content from sports, lifestyle and wishtv and present them in a blog format 

----------------------------------------
Running content curation for: Please fetch latest content from sports, lifestyle and wishtv and present them in a blog format

=== Response ===

[04/23/25 14:13:56] INFO     Processing request of type ListToolsRequest                                                                        server.py:534
                    INFO     Processing request of type ListToolsRequest                                                                        server.py:534
[04/23/25 14:13:58] INFO     Processing request of type CallToolRequest                                                                         server.py:534
[04/23/25 14:14:00] INFO     HTTP Request: POST https://api.dappier.com/app/v2/search?data_model_id=dm_01j0pb465keqmatq9k83dthx34 "HTTP/1.1   _client.py:1025
                             200 OK"                                                                                                                         
                    INFO     Processing request of type CallToolRequest                                                                         server.py:534
[04/23/25 14:14:01] INFO     HTTP Request: POST https://api.dappier.com/app/v2/search?data_model_id=dm_01j0q82s4bfjmsqkhs3ywm3x6y "HTTP/1.1   _client.py:1025
                             200 OK"                                                                                                                         
                    INFO     Processing request of type CallToolRequest                                                                         server.py:534
[04/23/25 14:14:02] INFO     HTTP Request: POST https://api.dappier.com/app/v2/search?data_model_id=dm_01jagy9nqaeer9hxx8z1sk1jx6 "HTTP/1.1   _client.py:1025
                             200 OK"                                                                                                                         
# Weekly News Digest

Welcome to this week's newsletter, providing you with the latest updates and insights from the world of sports, lifestyle, and local news from WISH-TV. Dive into exciting stories and stay informed with our carefully curated content.

## 🏈 Sports News

### What We Learned About the Minnesota Timberwolves
- *Published on:* [April 23, 2025](https://www.minnesotasportsfan.com/minnesota-timberwolves/what-we-learned-wolves-lakers-game-2-postgame-recap-nba-playoffs/)
- **Summary:** The Timberwolves faced an aggressive Lakers team in Game 2, ultimately suffering a 94-85 defeat. Despite the efforts of Anthony Edwards and Julius Randle, key foul troubles and strong opposition hindered their performance. As the series shifts to Target Center for Game 3, hopes for leveraging home advantage remain high.

### Matthew Tkachuk Lights Up Game 1
- *Published on:* [April 23, 2025](https://sportsnaut.com/nhl/matthew-tkachuks-2-goals-among-key-takeaways-from-panthers-6-2-game-1-win-against-lightning/)
- **Summary:** The Florida Panthers secured a commanding 6-2 victory over the Tampa Bay Lightning, with Matthew Tkachuk scoring twice on the power-play. This win sets a strong tone for the Panthers as they continue their championship defense.

### Dodgers Eye Possible Trade
- *Published on:* [April 23, 2025](https://www.lafbnetwork.com/mlb/la-dodgers/la-dodgers-rumors/mlb-trade-rumors-bobby-miller-los-angeles-dodgers/)
- **Summary:** The Dodgers explore trading pitcher Bobby Miller as they deal with roster constraints and returning injured players. These trades aim to balance the team’s lineup as they approach the season’s crucial stages.

## 🌟 Lifestyle News

### ‘Starship Troopers’ Reunion at C2E2 2025
- *Published on:* [April 23, 2025](https://boundingintocomics.com/movies/starship-troopers-cast-nukes-the-main-stage-on-the-final-day-of-c2e2-2025-with-the-only-good-bug-is-a-dead-bug-a-starship-troopers-reunion-panel/)
- **Summary:** The reunion panel for "Starship Troopers" evoked nostalgia and reflected on the film's historical impact and upcoming reboot. With cast members expressing mixed opinions about the reboot, fans are encouraged to revisit the original film.

### Nintendo Switch 2 Pre-Order Update
- *Published on:* [April 23, 2025](https://boundingintocomics.com/video-games/video-game-news/nintendo-switch-2-pre-orders-return-april-24th-console-and-game-prices-remain-accessory-prices-increase/)
- **Summary:** Nintendo announces the return of Switch 2 pre-orders with stable console and game prices but increased accessory costs. Nostalgia is leveraged through compatibility restrictions, sparking varied fan reactions.

### A Peek into ‘The Legend of Ochi’
- *Published on:* [April 23, 2025](https://boundingintocomics.com/movies/movie-reviews/the-legend-of-ochi-review-don-quiochi-of-carpathia/)
- **Summary:** This film presents stunning visuals and a compelling score but struggles with its narrative depth. Despite these challenges, its enchanting presentation captivates audiences.

## 📰 WISH-TV Local Updates

### Josef Newgarden Shares Insights at IMS Museum
- *Published on:* [April 23, 2025](https://www.wishtv.com/sports/motorsports/indianapolis-motor-speedway-museum-josef-newgarden-april-22-2025/)
- **Summary:** Two-time Indy 500 champion Josef Newgarden led an engaging discussion at the newly renovated IMS Museum. The event fostered a personal connection with fans and featured interactive elements, emphasizing Newgarden’s career and future aspirations.

### Pacers Lead Series Against Bucks
- *Published on:* [April 23, 2025](https://www.wishtv.com/sports/indiana-pacers/pacers-out-tough-bucks-take-2-0-series-lead/)
- **Summary:** The Indiana Pacers take a 2-0 series lead over the Milwaukee Bucks with key performances from Pascal Siakam and Tyrese Haliburton. Their strong home game sets the stage for the upcoming matches in Milwaukee.

### Devin Taylor’s Historic Home Run
- *Published on:* [April 23, 2025](https://www.wishtv.com/sports/indiana-devin-taylor-home-run-leader/)
- **Summary:** Devin Taylor becomes Indiana University's all-time home run leader, solidifying his status in college baseball during the NCAA tournament.

Stay informed and engaged with these top stories, providing valuable insights and analysis from the worlds of sports, lifestyle, and local news. Feel free to explore the full articles for more in-depth coverage and commentary!

🌟 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.