Build a Free AI Blog Writing Agent with Claude Code
AI blog writing tools cost $30-100/month. Jasper charges $49/month for their Creator plan. Copy.ai wants $49/month. Writesonic starts at $20/month. That’s $240-1,200/year just to generate blog posts.
Here’s the thing: you can build a better system yourself in 30 minutes. For free.
This tutorial shows you how to create a fully-automated AI blog writing agent using Claude Code and MCP. The result: a system that researches keywords, analyzes competitors, and generates SEO-optimized posts—all from a single command.

No subscriptions. Full control. Unlimited usage. And because you own the system, you can customize every aspect: the voice, the structure, the output format, even which AI model powers it.
What You’ll Build
Let’s be specific about what this system does. By the end of this tutorial, you’ll have:
SEO Research Integration
Your blog writer will connect to real SEO data through the Model Context Protocol. This means:
- Keyword difficulty scores - Know how hard it is to rank before you write
- Search volume estimates - Target keywords people actually search for
- SERP analysis - See what’s ranking and why
- Competitor domain ratings - Understand the authority you’re competing against
This isn’t estimates or projections. It’s the same data SEO professionals pay hundreds of dollars per month to access through tools like Ahrefs or SEMrush.
Automated 6-Phase Workflow
The system runs a complete content creation pipeline:
- Keyword Research - Find the best keyword to target
- Competitive Analysis - Analyze what’s ranking and find gaps
- Content Depth Analysis - Measure competitor word counts and structure
- Content Brief - Create an outline optimized for the target keyword
- Article Generation - Write the full post in your brand voice
- Quality Control - Validate SEO requirements before saving
Each phase feeds into the next. The keyword research informs the competitive analysis. The competitive analysis sets the content depth targets. The depth targets guide the writing. It’s a closed loop that produces consistently high-quality output.
Content Depth Matching
✗ Static Word Counts
“Write 2,000 words” — but what if the #1 result has 6,500 words, 10 sections, and an FAQ? You’ll lose.
✓ Dynamic Depth Analysis
Analyze top 3 ranking articles, match their structure, include all elements they have. Write to compete.
Before writing a single word, the agent:
- Fetches the top 3 ranking articles for your keyword
- Analyzes their word count, section structure, and content elements
- Sets dynamic targets based on what’s actually ranking
- Writes to match or exceed the top competitor
Multi-Format Output
Every article is saved in multiple formats:
- Markdown (.md) - With Hugo/Astro-compatible frontmatter for your blog
- Word Document (.docx) - For sharing with editors or clients
- HTML (.html) - For quick preview or direct publishing
Each article gets its own folder with all formats included.
Brand Voice Enforcement
The system includes a voice guide that enforces your brand’s tone across every article. Define rules like:
- Use imperatives (Build, Ship, Launch)
- Lead with outcomes
- No buzzwords
- Specific timelines and costs
The agent checks its output against these rules before saving.
Prerequisites
Before we start building, make sure you have these installed:
1. Claude Code — Anthropic’s official CLI tool
npm install -g @anthropic-ai/claude-code 2. Python 3.10+ — For the SEO research MCP
3. CapSolver API Key — Free tier handles hundreds of lookups. Sign up at capsolver.com
Optional (But Helpful)
- A static site generator (Hugo, Astro, Next.js) - For publishing the markdown output
- Node.js 18+ - For generating DOCX files
- pandoc - For converting markdown to HTML (
brew install pandoc)
Understanding MCP: The Power Behind the System
MCP (Model Context Protocol) is a standard that lets AI assistants connect to external tools and data sources. Think of it as a plugin system for Claude.
Without MCP, Claude can only work with what’s in the conversation. With MCP, Claude can:
- Query live SEO databases
- Fetch web pages
- Read and write files
- Connect to APIs
- Access databases
For our blog writer, MCP provides the bridge between Claude’s writing ability and real-world SEO data.
How MCP Differs from Web Search
Web Search
Returns unstructured snippets. Can’t get keyword difficulty or search volume. Agent has to guess and parse.
✓ SEO MCP
Returns structured JSON. Exact difficulty scores (0-100). Monthly volume estimates. Domain ratings and traffic.
Web search tells you what ranks. MCP tells you why it ranks and how hard it is to compete.
The MCP Architecture
Here’s how the pieces fit together:
┌─────────────────────────────────────────────────────┐
│ YOU │
│ "Write a blog post about AI agents" │
└──────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ CLAUDE CODE (the agent) │
│ - Interprets your request │
│ - Loads the blog-writer skill │
│ - Executes the 6-phase workflow │
│ - Calls MCP tools when needed │
│ - Writes the final output │
└──────────────────────┬──────────────────────────────┘
│ calls
▼
┌─────────────────────────────────────────────────────┐
│ SEO RESEARCH MCP (tool server) │
│ - keyword_generator() │
│ - keyword_difficulty() │
│ - get_traffic() │
│ - get_backlinks_list() │
└─────────────────────────────────────────────────────┘ Claude Code is the brain. MCP is the hands. The skill file is the instructions that tell the brain how to use the hands.
Install the SEO Research MCP
Now let’s set up the SEO data connection.
Step 1: Install the MCP Package
pip install seo-mcp This installs the SEO research MCP server. It’s a Python package that runs locally and connects to SEO data APIs.
Step 2: Configure the MCP in Claude Code
Add the MCP to Claude Code:
claude mcp add seo-research When prompted for the configuration, enter:
{
"command": "python",
"args": ["-m", "seo_mcp"],
"env": {
"CAPSOLVER_API_KEY": "your-actual-key-here"
}
} Replace your-actual-key-here with the CapSolver API key you got earlier. Without a valid key, keyword lookups will fail.
Step 3: Verify the Installation
Let’s make sure everything works. Start Claude Code:
claude Then test the MCP:
What's the keyword difficulty for "ai writing tools"? You should get back something like:
Keyword: ai writing tools
Difficulty: 72
SERP Results:
1. jasper.ai (DR: 71, traffic: 12,400)
2. copy.ai (DR: 68, traffic: 8,200)
3. writesonic.com (DR: 65, traffic: 6,800)
... If you see difficulty scores and SERP data, the MCP is working.
Step 4: Understand the Available Tools
The SEO MCP provides four tools:
| Tool | Input | Output | Use Case |
|---|---|---|---|
keyword_generator | Seed keyword | Related keywords with volumes | Finding opportunities |
keyword_difficulty | Target keyword | Difficulty score, SERP analysis | Evaluating competition |
get_traffic | Domain name | Traffic estimates, top pages | Analyzing competitors |
get_backlinks_list | Domain name | Backlink sources with authority | Understanding rankings |
For blog writing, you’ll primarily use keyword_difficulty—it gives you both the competition data and the URLs you need for content depth analysis.
Create the Blog Writer Skill
Claude Code uses “skills” to define specialized workflows. A skill is just a markdown file with instructions that Claude follows. Think of it as a recipe for complex tasks.
Step 1: Create the Skill Directory
mkdir -p .claude/skills/blog-writer/assets This creates the folder structure:
.claude/
└── skills/
└── blog-writer/
├── skill.md # Main skill file (we'll create this)
└── assets/
├── voice-guide.md # Brand voice rules
└── post-template.md # Output template Step 2: Create the Main Skill File
Create .claude/skills/blog-writer/skill.md with this content:
---
name: blog-writer
description: Automated SEO blog writer. Takes a seed keyword and generates optimized articles in multiple formats.
---
# Blog Writer
Input a seed keyword, get a complete blog post optimized for search.
## WORKFLOW
### Phase 1: Keyword Research
1. Call `keyword_generator(seed_keyword)` for related keywords
2. Call `keyword_difficulty(top_candidate)` for SERP analysis
3. Select primary keyword (volume 500-5000, difficulty <40 preferred)
4. Identify 3-5 secondary keywords
### Phase 2: Competitive Analysis + Content Depth
1. Get top 3 URLs from keyword_difficulty results
2. Fetch each URL with WebFetch
3. Analyze:
- Word count
- Number of sections (H2/H3)
- FAQ present? How many questions?
- Code examples?
- Step-by-step guides?
4. Set targets:
- Word count: Match or exceed top educational article
- Sections: Match structure of #1 result
- Include all elements found in top 3
### Phase 3: Content Brief
- Hook that differentiates from competitors
- Outline matching target structure
- Key points for each section
- Statistics to include (with sources)
### Phase 4: Write the Article
- Match word count target from Phase 2
- Include all structural elements identified
- Follow voice guide
- Add FAQ if competitors have one
### Phase 5: Output
Save to `/blog-articles/{slug}/`:
- {slug}.md (with frontmatter)
- {slug}.docx (via docx skill)
- {slug}.html (via pandoc) This is a simplified version. The full skill file has more detail—you can expand each phase as needed.
Step 3: Create the Voice Guide
Create .claude/skills/blog-writer/assets/voice-guide.md:
# Brand Voice Guide
Write like a builder talking to another builder. Direct, specific, no fluff.
## DO
### Use Imperatives
- Build, Ship, Launch, Deploy, Create
- "Build your first agent" not "You could consider building an agent"
### Lead with Outcomes
- "Ship in 2 weeks, not 2 months"
- "Cut deploy time from 4 hours to 15 minutes"
### Give Specifics
- Tool names: "Use Supabase for auth"
- Timelines: "Setup takes 30 minutes"
- Costs: "Free tier handles 10K requests/month"
## DON'T
### No Buzzwords
Banned: revolutionary, game-changing, cutting-edge, best-in-class, synergy, leverage, unlock, unleash, empower
### No Vague Promises
Avoid: "unlock your potential", "transform your business", "take it to the next level"
### No Fluffy Intros
Never start with: "In today's fast-paced world...", "Have you ever wondered...", "It's no secret that..." Step 4: Create the Post Template
Create .claude/skills/blog-writer/assets/post-template.md:
# Post Template
## Frontmatter
---
title: "{title}"
description: "{150-160 char description}"
date: {YYYY-MM-DD}
slug: "{slug}"
author: "Your Name"
tags:
- {tag1}
- {tag2}
seo:
primary_keyword: "{keyword}"
secondary_keywords:
- {kw1}
- {kw2}
competitor_benchmark:
top_word_count: {number}
target_word_count: {number}
---
## Structure
1. Hook (2-3 sentences, specific stat or bold claim)
2. Overview of what reader will achieve
3. Sections (match competitor depth)
4. FAQ (if competitors have one)
5. Conclusion with CTA Test the Blog Writer
Let’s run it. Open Claude Code:
claude Then invoke the skill:
Write a blog post about building chatbots with Claude The system will:
- Research keywords - Query the MCP for difficulty and volume
- Fetch competitors - Get the top 3 ranking URLs
- Analyze depth - Count words and sections in each
- Set targets - Determine optimal length and structure
- Write the post - Generate content matching targets
- Save files - Output to
/blog-articles/{slug}/
Watch the process. You’ll see each phase execute, with the agent showing its work.
How the Content Depth Analysis Works
This is the key innovation that makes this system competitive with paid tools. Before writing a single word, the blog writer analyzes what’s actually ranking—and writes to beat it.
The Problem with Static Word Counts
Most AI writing tools say “write 2,000 words” or “write a long-form article.” But what if:
- The top result for your keyword is 6,500 words?
- The #1 article has 10 sections and yours has 4?
- Every competitor has an FAQ and you don’t?
You’ll lose. Google rewards comprehensive content that matches search intent.
The Solution: Analyze Before Writing
1. Gets SERP data from the MCP
keyword_difficulty("ai blog writer free")
→ Returns top 10 URLs with domain ratings 2. Fetches the top 3 articles
WebFetch(url1) → content analysis
WebFetch(url2) → content analysis
WebFetch(url3) → content analysis 3. Measures each article
For each competitor, the agent counts:
- Total word count
- Number of H2 sections
- Number of H3 subsections
- FAQ present? How many questions?
- Code examples present?
- Tables/comparisons present?
4. Creates a benchmark table
| Rank | URL | Words | Sections | FAQs | Code |
|---|---|---|---|---|---|
| #1 | ryrob.com | 6,500 | 10 | 6 | Yes |
| #2 | hubspot.com | 1,200 | 4 | 0 | No |
| #3 | grammarly.com | 1,400 | 5 | 4 | No |
5. Sets dynamic targets
The agent identifies that ryrob.com is an educational article (our type) while hubspot.com and grammarly.com are product pages (different intent).
So the target becomes: 6,500+ words, 10+ sections, 6 FAQs, code examples.
Customize the System for Your Brand
The skill files are just markdown. Edit them to match your needs.
Change the Target Audience
Update the voice guide for your audience:
## Our Audience
- Technical founders building AI products
- Prefer code examples over screenshots
- Assume familiarity with APIs and CLIs
- Don't over-explain basics Add Topic Restrictions
## Topic Guidelines
- Focus: AI agents, automation, developer productivity
- Avoid: Crypto, politics, medical advice
- Always include: Working code examples, GitHub links Modify the Output Format
Change the frontmatter for your CMS:
# For Next.js MDX
---
title: "{title}"
publishedAt: "{date}"
summary: "{description}"
image: "/blog/{slug}/cover.png"
--- Extend with More MCPs
The SEO MCP is just the beginning. You can add more tools:
Web Search MCP
For real-time research and fact-checking:
claude mcp add web-search Now your agent can search the web during the research phase to find statistics, quotes, and recent developments.
Database MCP
Store and query past articles:
claude mcp add sqlite Use this to track which keywords you’ve already targeted and find internal linking opportunities.
Image Generation MCP
Auto-generate cover images:
claude mcp add image-gen Add to your skill:
### Phase 6: Cover Image
Generate a cover image using the article title and save to {slug}/cover.png Troubleshooting Common Issues
If Claude says it can’t access SEO data:
- Check
claude mcp list— is it listed? - Re-add if missing:
claude mcp remove seo-research && claude mcp add seo-research - Verify your CapSolver key is correct
Keyword Data Returns Empty
Causes:
- CapSolver credits exhausted
- Very niche keyword with no data
- API rate limiting
Fixes:
- Check CapSolver dashboard for remaining credits
- Try a broader keyword
- Wait a few minutes and retry
Content Comes Out Too Short
Solution: Add explicit length requirements to skill file:
## Length Requirements
- If target is 5,000+ words, each H2 section must be 500+ words
- FAQ section must have 6+ questions with detailed answers
- Include at least 5 code examples Voice Doesn’t Match Brand
Solution: Add more examples to voice guide:
## Examples
WRONG: "This innovative solution leverages cutting-edge AI."
RIGHT: "This tool uses Claude's API. Here's the code."
WRONG: "In today's competitive landscape..."
RIGHT: "Your competitors ship faster. Here's how to catch up." Frequently Asked Questions
How much does this cost to run?
$0/month for the infrastructure. You only pay for Claude API usage:
- ~$0.01-0.03 per blog post for Claude Sonnet
- ~$0.05-0.15 per blog post for Claude Opus
Compare to $49-100/month for Jasper or Copy.ai.
Can I use a different AI model?
Yes. Claude Code supports multiple models:
claude config set model claude-3-opus Options: claude-3-sonnet (default), claude-3-opus (higher quality), claude-3-haiku (fastest)
How does this compare to ChatGPT + plugins?
ChatGPT + Plugins
Limited plugin selection. Manual content depth analysis. Copy/paste output. $20/month + API costs.
✓ This System
Real-time SEO data. Automated depth analysis. Multi-format output. Full control. API usage only.
Is the content original?
Yes. Claude generates original content based on your keyword, competitor structure (not content), and your brand voice guide. It doesn’t copy competitor text—it matches their depth while creating original content.
Can I use this for client work?
Absolutely. Create one skill per client (with their voice guide), generate drafts in bulk, export DOCX for client review.
What You’ve Built
Let’s recap. You now have a blog writing system that:
Researches like a pro — Real keyword difficulty, search volume, competitor analysis
Writes to rank — Dynamic word counts, structure matching, FAQ sections when competitors have them
Outputs professionally — Markdown with frontmatter, DOCX for sharing, HTML for preview
Costs nothing — No subscriptions, no per-article fees, full ownership
Compare to the alternatives:
| Tool | Monthly Cost | Your System |
|---|---|---|
| Jasper | $49-125 | $0 |
| Copy.ai | $49+ | $0 |
| Writesonic | $20-99 | $0 |
| Content at Scale | $250+ | $0 |
Start Writing Today
1. Install Claude Code (5 min)
npm install -g @anthropic-ai/claude-code && claude auth 2. Get CapSolver key (5 min) — Sign up at capsolver.com
3. Install SEO MCP (5 min)
pip install seo-mcp && claude mcp add seo-research 4. Create skill files (10 min) — Copy from this article
5. Generate your first post (5 min)
claude
> Write a blog post about [your topic]First Week
- Generate 3-5 articles to test the system
- Refine your voice guide based on output quality
- Adjust the skill workflow for your needs
- Set up your blog to accept the markdown output
First Month
- Publish consistently using the system
- Monitor rankings for your target keywords
- Iterate on the process based on results
- Add more MCPs as needed
The Builder’s Advantage
Most people will read this article and think “that’s cool” but never build it.
You’re different. You’re a builder. You see a system that can be constructed, and you construct it.
Thirty minutes from now, you could have a blog writing system that rivals $100/month tools. Six months from now, you could have a library of ranking content—all generated by a system you own and control.
The best time to start was yesterday. The second best time is now.
Open your terminal. Run the commands. Build the system. Ship the content.
Want to build more AI-powered systems?
code:zero teaches you to ship AI products from day one. No theory, just building. Join a Ship Sprint in Penang and launch your product in 4 weeks.