Blog-MCP
Provides MCP tools to interact with Dev.to, enabling searching, browsing, and publishing articles through natural language.
README
๐ Dev.to AI Agent using MCP & OpenAI Agents SDK
An intelligent Dev.to assistant powered by the OpenAI Agents SDK, Model Context Protocol (MCP), Chainlit, and OpenRouter LLMs.
This project demonstrates how AI Agents can dynamically discover and execute tools exposed through a custom MCP Server, enabling natural language interactions with Dev.to. Users can search articles, explore trending content, retrieve author-specific posts, and even generate and publish new blog articlesโall through a conversational interface.
๐ Overview
The Dev.to AI Agent acts as an intelligent bridge between users and the Dev.to platform.
Instead of hardcoding API calls directly into the application, all Dev.to operations are exposed as MCP tools through a custom MCP Server. The AI Agent analyzes user intent, discovers available tools, selects the appropriate tool, executes it, and returns a summarized response.
Example Use Cases
- Browse latest Dev.to articles
- Discover trending content
- Search articles by keyword
- Find articles by tag
- Explore articles by author
- Retrieve article details
- Generate and publish new blog posts
โจ Features
- ๐ค AI-powered Dev.to assistant
- ๐ MCP-based tool architecture
- ๐ฐ Browse latest Dev.to articles
- ๐ฅ Discover trending articles
- ๐ท๏ธ Search articles by tags
- ๐ Keyword-based article search
- ๐ค Find articles by author
- โ๏ธ AI-generated article creation
- โก Fully asynchronous architecture
- ๐ฌ Modern conversational UI with Chainlit
- ๐ง Intelligent tool selection using OpenAI Agents SDK
- ๐ Easily extensible MCP tool ecosystem
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Chainlit UI โ
โ (app.py) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenAI Agents SDK โ
โ (mcp_agent.py) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Dev.to AI Agent โ
โ Instruction Driven โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Server (STDIO) โ
โ (server.py) โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Tools โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Dev.to APIs โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ End-to-End Flow
User
โ
โผ
Chainlit Chat Interface
โ
โผ
OpenAI Agent SDK
โ
โผ
Dev.to AI Agent
โ
โผ
MCP Tool Discovery
โ
โผ
Tool Selection
โ
โผ
MCP Tool Execution
โ
โผ
Dev.to API
โ
โผ
Agent Summarization
โ
โผ
Response Displayed in UI
๐ฌ User Experience
The application uses Chainlit to provide a modern conversational interface.
Starter Prompts
Users can quickly explore the agent using built-in starter suggestions:
- ๐ฐ Latest Articles
- ๐ฅ Top Trending Articles
- ๐ Python Articles
- ๐ค AI Articles
- ๐ Search Articles
- โ๏ธ Generate New Article
These prompts help users immediately understand the capabilities of the agent.
โ๏ธ Agent Execution Lifecycle
Every request follows the same execution workflow:
1. User sends a message
2. Chainlit receives the request
3. Thinking indicator is displayed
4. AI Agent is invoked
5. MCP Server starts
6. Agent discovers available tools
7. Agent selects the appropriate tool
8. MCP Tool executes
9. Dev.to API returns data
10. Agent summarizes results
11. Response is displayed to the user
๐ ๏ธ Technology Stack
| Technology | Purpose |
|---|---|
| Python | Core programming language |
| Chainlit | Conversational AI interface |
| OpenAI Agents SDK | Agent orchestration and tool calling |
| MCP (Model Context Protocol) | Tool discovery and execution |
| OpenRouter | LLM provider |
| Qwen 3 235B | Foundation language model |
| AsyncIO | Asynchronous execution |
| MCPServerStdio | MCP communication layer |
| dotenv | Environment variable management |
๐ Project Structure
project/
โ
โโโ app.py
โโโ mcp_agent.py
โโโ server.py
โโโ .env
โโโ requirements.txt
โโโ README.md
๐ File Breakdown
app.py
This file contains the Chainlit user interface and handles all user interactions.
Responsibilities
- Displays the chat interface
- Registers starter prompts
- Receives user messages
- Displays agent progress
- Shows final responses
set_starters()
Registers predefined starter prompts displayed on an empty chat screen.
Purpose
- Improve user onboarding
- Demonstrate available capabilities
- Provide quick actions
on_chat_start()
Triggered whenever a new conversation begins.
Responsibilities
- Displays welcome message
- Introduces the assistant
- Explains supported actions
on_message()
Main message processing function.
Responsibilities
- Receives user input
- Displays thinking indicator
- Invokes AI agent
- Displays final response
Flow
User Message
โ
โผ
on_message()
โ
โผ
agent_main()
โ
โผ
Agent Execution
โ
โผ
Tool Execution
โ
โผ
Response Returned
โ
โผ
UI Updated
mcp_agent.py
This file contains the AI Agent orchestration logic.
It acts as the bridge between:
- User Queries
- Language Model
- MCP Server
- MCP Tools
setup_dev_agent()
Creates and configures the Dev.to Agent.
Responsibilities
- Defines agent instructions
- Connects MCP Server
- Attaches language model
- Configures tool usage behavior
The agent receives detailed instructions describing:
- Which tool should be used
- When it should be used
- How results should be formatted
This improves tool-calling reliability and response quality.
main()
Primary execution entry point for all requests.
Responsibilities
- Starts MCP Server
- Creates agent instance
- Executes agent workflow
- Returns final output
Flow
User Query
โ
โผ
Start MCP Server
โ
โผ
Create Agent
โ
โผ
Run Agent
โ
โผ
Tool Execution
โ
โผ
Final Response
server.py
This file contains the MCP Server implementation.
The server exposes Dev.to functionality as MCP-compatible tools that can be dynamically discovered and used by the AI Agent.
๐ MCP Tools
The MCP Server exposes multiple tools to the agent.
get_latest_articles()
Returns the latest articles from Dev.to.
get_top_articles()
Returns trending or top-performing articles.
get_articles_by_tag(tag)
Retrieves articles belonging to a specific tag.
Example
Python
JavaScript
AI
MachineLearning
Agents
search_articles(query)
Performs keyword-based article search.
Example
LangChain
Agentic AI
OpenAI
MCP
get_articles_by_username(username)
Returns articles published by a specific author.
get_article_details(article_id)
Retrieves detailed information for a specific article.
create_article()
Creates and publishes a new Dev.to article.
Parameters
title
body_markdown
tags
published
๐ค Intelligent Tool Selection
The AI Agent uses instruction-based reasoning to select the correct MCP tool.
Example 1
User:
Show me the latest articles
Agent:
Calls get_latest_articles()
Example 2
User:
Search for Agentic AI
Agent:
Calls search_articles("Agentic AI")
Example 3
User:
Show articles by ThePracticalDev
Agent:
Calls get_articles_by_username()
Example 4
User:
Create an article about MCP Servers
Agent:
Generates content
โ
Calls create_article()
๐ Why MCP?
This project intentionally uses Model Context Protocol (MCP) rather than directly integrating APIs into the agent.
Benefits
- Standardized tool interface
- Dynamic tool discovery
- Decoupled architecture
- Easier maintenance
- Reusable integrations
- Future multi-agent compatibility
- Scalable tool ecosystem
New tools can be added to the MCP Server without changing the core agent implementation.
๐ธ Screenshots
Home Screen
Add screenshot here
Agent Execution
Add screenshot here
Article Generation
Add screenshot here
๐ Example Queries
Show me the latest Dev.to articles
Show me the top trending articles
Find articles about Python
Find articles about AI agents
Search for machine learning articles
Show articles by ThePracticalDev
Create a blog about the latest advancements in Agentic AI
๐ฎ Future Enhancements
- Multi-agent workflows
- Medium integration
- Hashnode integration
- Memory-enabled agents
- Blog review agent
- SEO optimization agent
- Research assistant agent
- Content planning agent
- Analytics dashboard
- Streaming responses
- Human approval workflows
๐ฏ Learning Outcomes
This project demonstrates practical implementation of:
- OpenAI Agents SDK
- MCP (Model Context Protocol)
- Tool Calling Agents
- Agent Instructions Engineering
- Async Python Development
- OpenRouter Integration
- Chainlit Applications
- AI-Powered Content Automation
- Agentic AI Workflows
๐ Getting Started
Clone the Repository
git clone https://github.com/Dharshini195/Blog-MCP.git
cd Blog-MCP
Install Dependencies
pip install -r requirements.txt
Configure Environment Variables
Create a .env file:
OPENROUTER_API_KEY=your_openrouter_api_key
Run the Application
chainlit run app.py
Open the provided local URL and start chatting with the Dev.to Assistant.
๐ License
This project is intended for educational, experimentation, and learning purposes. Feel free to fork, modify, and extend it for your own MCP and Agent Engineering projects.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.