Skip to content

joshyorko/yo-dawg

Repository files navigation

Yo Dawg Sema4ai Action Server/MCP

This project is an advanced Sema4ai Action Server that automatically generates and posts custom "Yo Dawg" meme comments (with images) on LinkedIn posts using the Model Context Protocol (MCP).

Sample Yo Dawg Meme

Features

  • πŸ€– Autonomous meme generation and posting
  • πŸ–ΌοΈ AI-generated meme images with custom captions
  • πŸ“‘ Powered by Model Context Protocol (MCP)
  • 🎯 Official signature for every comment
  • Robust browser automation using Playwright via Robocorp

How It Works

  1. The action visits a LinkedIn post URL.
  2. It extracts the post content and generates a "Yo Dawg" meme caption using AI.
  3. It creates a meme image with the caption and uploads it as a comment.
  4. The comment includes an official signature:

    🎯 This content was generated by The Yo Dawg Sema4ai Action Server πŸ“‘ Powered by Model Context Protocol (MCP) πŸ€– Autonomous meme generation system active

Available Actions

This action server exposes several callable actions via MCP:

1. generate_yo_dawg_quote_only

Generate only the Yo Dawg meme caption from provided content. Parameters:

  • yo_dawg_content (str): The content to transform into a Yo Dawg meme caption.
  • model (str, required): Model name to use for generation (e.g., gpt-4o-mini, ollama:phi4). Returns: Caption string.

2. rich_mans_yo_dawg_comment

Generate and post a Yo Dawg meme comment on LinkedIn by creating a new image. Parameters:

  • post_url (str, optional): The LinkedIn post URL to comment on.
  • custom_context (str, optional): Custom context string for meme generation.
  • append_custom_context (bool): If true, appends custom context to LinkedIn post content.
  • model (str, required): Model id to use for caption/image generation. No default. Returns: Result message and generated image.

3. poor_mans_yo_dawg_comment

Generate and post a Yo Dawg meme comment on LinkedIn by overlaying text on a static image. Parameters:

  • post_url (str, optional): The LinkedIn post URL to comment on.
  • custom_context (str, optional): Custom context string for meme generation.
  • append_custom_context (bool): If true, appends custom context to LinkedIn post content.
  • model (str, required): Model id to use for caption generation (OpenAI or ollama:<name>). No default. Returns: Result message and generated image.

4. Internal Utilities

  • Meme image and caption generation (yo_dawg_generator, YoDawgImageGenerator)
  • LinkedIn post content extraction
  • Browser automation for posting comments

Usage

  • See src/yodawg/yo-dawg-actions.py for main action logic and all callable actions.
  • Actions can be triggered via MCP endpoints or Sema4ai agent tool access.
  • Images are saved in the yo-dawg-images/ directory.

Requirements

Example

action-server start

Project Structure

  • src/yodawg/yo-dawg-actions.py: Main action logic and all MCP actions
  • src/yodawg/image_generation.py: Meme caption and image generation
  • src/yodawg/models.py: Data models
  • yo-dawg-images/: Generated meme images

License

See LICENSE for details.

Using MCP and SSE Endpoints in Sema4ai Action Server

Overview

Sema4ai Action Server exposes your Python actions as MCP tools, resources, and prompts, making them accessible to AI agents via standardized endpoints. The server automatically generates an OpenAPI spec and provides both synchronous and streaming access.

Endpoints

  • /mcp: Standard MCP protocol over HTTP. Synchronous requests for tool, resource, and prompt calls.
  • /sse: MCP protocol over Server-Sent Events. Streaming, real-time responses for agents needing live updates or long-running calls.

How to Use

  1. Start the Action Server:

    action-server start

    By default, endpoints are available at http://localhost:8000/mcp and http://localhost:8000/sse.

  2. Authentication:

    • If started with --api-key, include Authorization: Bearer <api-key> in your requests.
  3. Calling Tools, Resources, and Prompts:

    • List available tools:
      • HTTP: POST http://localhost:8000/mcp with { "method": "tools/list" }
      • SSE: Connect to http://localhost:8000/sse and send { "method": "tools/list" }
    • Call a tool:
      • HTTP: POST http://localhost:8000/mcp with { "method": "tools/call", "params": { "name": "your_tool_name", "arguments": { ... } } }
    • Read a resource:
      • HTTP: POST http://localhost:8000/mcp with { "method": "resources/read", "params": { "uri": "resource_uri" } }
    • Get a prompt:
      • HTTP: POST http://localhost:8000/mcp with { "method": "prompts/get", "params": { "name": "prompt_name", "arguments": { ... } } }
  4. SSE Streaming Example (Python):

    import requests
    import sseclient
    
    url = "http://localhost:8000/sse"
    headers = {"Authorization": "Bearer <api-key>"}
    response = requests.post(url, headers=headers, data='{"method": "tools/list"}', stream=True)
    client = sseclient.SSEClient(response)
    for event in client.events():
        print(event.data)

Notes

Accessing MCP Actions & Endpoints

How to Reach the MCP Endpoint

  1. Start the Action Server:

    action-server start

    This will expose the MCP endpoint URL and a bearer token in your terminal output.

  2. Connect your agent or client:

    • Use the exposed MCP endpoint URL and bearer token to authenticate requests.
    • Most Sema4ai agents and tools support direct connection via the "Connect Action Server" workflow.
  3. Call Actions Remotely:

    • Use the MCP endpoint to invoke any of the documented actions (see above) from your agent, automation, or external tool.
    • Supported transports include HTTP and Server-Sent Events (SSE) for real-time tool access.

Example MCP Call

curl -X POST \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{"action": "generate_yo_dawg_quote_only", "yo_dawg_content": "Your text here"}' \
  <your_mcp_endpoint_url>/mcp/

Notes

  • MCP integration enables your AI agents to access a growing ecosystem of tools and data sources, including community and enterprise actions.
  • You can deploy the server locally or remotely, and connect agents (like Claude, GPT, etc.) to automate meme generation and posting.
  • For more details, see Sema4ai Actions documentation.

For more information, see the Sema4ai Actions documentation.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors