Skip to main content
Glama
by zegh6389
live_demo.pyโ€ข3.19 kB
#!/usr/bin/env python3 """ Live Instagram Demo Script Creates and publishes a real Instagram post using the MCP server """ import asyncio import sys import os from pathlib import Path # Setup paths properly project_root = Path(__file__).parent src_dir = project_root / 'src' # Add to Python path sys.path.insert(0, str(project_root)) sys.path.insert(0, str(src_dir)) # Change to project directory os.chdir(project_root) # Import the MCP server sys.path.insert(0, str(src_dir)) from mcp_server import NewsInstagramMCPServer async def live_instagram_demo(): """Run a live demo creating and publishing an Instagram post""" print('๐ŸŽฏ Live Instagram Demo - Creating Real Post!') print('=' * 50) try: server = NewsInstagramMCPServer() # Step 1: Scrape recent news print('\n๐Ÿ“ฐ Step 1: Scraping recent news...') await server._scrape_news_tool({'source': 'globalnews', 'limit': 5}) print('โœ… News scraped successfully') # Step 2: Analyze content print('\n๐Ÿ” Step 2: Analyzing content...') await server._analyze_content_tool({'limit': 3}) print('โœ… Content analyzed') # Step 3: Check if we have articles to work with articles = server.db_manager.get_recent_articles(limit=1) if articles: article = articles[0] print(f'\n๐Ÿ“ Found article: {article.headline[:50]}...') # Step 4: Generate Instagram post print('\n๐ŸŽจ Step 3: Generating Instagram post...') await server._generate_post_tool({ 'article_id': article.id, 'template_type': 'breaking', 'caption_style': 'engaging' }) print('โœ… Post generated successfully') # Step 5: Publish to Instagram print('\n๐Ÿ“ฑ Step 4: Publishing to Instagram...') result = await server._publish_post_tool({ 'post_id': None, # Will use the latest generated post 'caption_override': 'Live demo post from News Instagram MCP Server! ๐Ÿš€ #NewsAutomation #MCP' }) print('๐ŸŽ‰ SUCCESS: Post published to Instagram!') for content in result: print(f'๐Ÿ“„ Result: {content.text}') else: print('\nโš ๏ธ No articles found to create post from') print('Creating demo post with sample content...') result = await server._publish_post_tool({ 'post_id': None, 'caption_override': '๐Ÿš€ Live Demo: News Instagram MCP Server is now integrated with Claude Desktop! This automated system can scrape news, analyze content, and post to Instagram. #AI #Automation #MCP #NewsBot' }) if result: print('๐ŸŽ‰ SUCCESS: Demo post published!') for content in result: print(f'๐Ÿ“„ Result: {content.text}') except Exception as e: print(f'โŒ Error during demo: {e}') if __name__ == "__main__": asyncio.run(live_instagram_demo())

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zegh6389/news-instagram-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server