Then I asked it questions.

By Karen Spinner

Published: 2026-02-27

URL: https://wonderingaboutai.substack.com/p/i-connected-my-newsletter-archive


TL;DR: This is a a step-by-step guide to building your first MCP server. It covers how to pull your Substack articles into SQLite, connect them to Claude Desktop with MCP, and start asking questions about your own newsletter in plain English.


Disclosure: This article was written by me, a human, because apparently I can’t stop building tools to analyze my own content. Claude helped me query the database and organize the findings. All opinions, meta-commentary, and questionable decisions to build yet another thing are entirely my own.


Several readers have asked me to write about MCP (Model Context Protocol), and this article has been on my to-do list for a while now. The best way I know to explain how something something works is to build with it. I just needed the right starter project: something actually useful, easy to set up in a single session, and worth sharing with readers who might be MCP-curious but haven’t taken the plunge yet.

So I built a local SQLite database of every article I’ve published on Wondering About AI (all 39 of them) connected it to Claude Desktop via MCP, and started asking it questions about my own newsletter.

Now, to be clear, this project isn’t what I use for newsletter analytics. I already use StackContacts and my own Substack Newsletter Audit Chrome extension to track performance. But it turned out that transforming my archive into a conversational database was both a great way to learn MCP and a surprisingly fun way to discover patterns in my own writing that I hadn’t noticed before.

Total build time: one 20-minute session with Claude Code. Zero lines of code written by hand.

This article covers how I built it, what I learned about MCP along the way, and what the data revealed about Wondering About AI, plus how you can do the same thing with your own newsletter.

What is MCP, and why should you care?

If you’ve heard of MCP but haven’t used it yet, here’s the short version: MCP is how you give Claude access to your own data. It’s an open protocol that lets Claude connect to local databases, APIs, or files and query them conversationally. It works with Claude Desktop, Claude.ai, Claude Code, and a growing number of third-party tools. But for this project, I’m using Claude Desktop as the front end.

Think of it this way. You have data sitting in a SQLite file on your laptop. Normally, to ask questions about that data, you’d need to write SQL queries, build a dashboard, or export everything to a spreadsheet. With MCP, you wire up the database to Claude, and Claude becomes the interface. You ask questions in plain English, and Claude figures out which tools to call, retrieves the data, and reasons over it.

No web app to build. No UI to design. Claude is the front end, and it’s already built for you.

The architecture: three pieces, completely decoupled

The whole system has three parts:

1. An ingestion script that pulls my articles from Substack’s public, undocumented API and stores them in a SQLite database. This runs once (and can be re-run incrementally when I publish new articles).

2. An MCP server that exposes seven read-only tools over that database. These tools let Claude search articles by keyword, run full-text queries, fetch individual articles, pull engagement stats, and rank content by different metrics.

3. Claude Desktop, which connects to the MCP server and becomes the conversational interface over the entire archive.

That’s it. A Python script that fills a SQLite file, and a Python script that reads from it. Claude Desktop does the rest.

How to build this for your own newsletter

You’ve got two options here, depending on how you like to learn.

Option A: Clone the repo and run it. If you want it working in five minutes, grab the project from GitHub, change one line to point it at your newsletter, and follow the setup steps below.

Option B: Build it yourself with Claude Code (or another AI coding tool). If you want to actually learn how MCP works by building it piece by piece, give the URL for this article to Claude Code and explain that you want to create a database of your newsletter articles (or other content) and interrogate them using Claude desktop. Ask Claude to build a spec in /plan mode and explain its approach.

If you have writing on multiple websites, include them in your spec. Your database could encompass multiple content libraries. (You won’t need embeddings or more advanced techniques until you reach about 1,000 pieces of content or so.)

Either way, you’ll need:

  • Python 3.12+ installed on your machine (python.org if you don’t have it)
  • A Substack newsletter that you’re the author of

Step 1: Get the project files

If you cloned the repo (Option A):

Open Terminal (on Mac: search for "Terminal" in Spotlight; on Windows: search for "Command Prompt" or "PowerShell") and navigate to wherever you downloaded the project:

bash

cd newsletter-archive

If you’re building it yourself (Option B):

Create a new folder for the project, then use Claude Code or your preferred AI coding tool to develop a spec for your version based on this article and your unique requirements. The “Under the hood” section below gives you everything you need to describe the project. The key pieces are an ingestion script, a SQLite database with full-text search, and an MCP server with seven read-only tools.

Step 2: Set up your environment and install dependencies

This creates an isolated Python environment for the project so it doesn’t interfere with anything else on your machine:

bash

python3 -m venv .venv .venv/bin/pip install -r requirements.txt

If you’re on Windows, replace .venv/bin/pip with .venv\Scripts\pip.

Step 3: Configure your newsletter slug

Open config.py and change the slug to match your Substack URL. If your newsletter lives at yournewsletter.substack.com, then:

python

NEWSLETTER_SLUG = "yournewsletter"

Step 4: Ingest your articles

Run the ingestion script to pull all your articles from Substack into a local SQLite database:

bash

.venv/bin/python ingest_runner.py

You’ll see progress as each article is fetched:

Connecting to Substack: yournewsletter... OK Fetching article archive... found 39 articles [ 1/39] "Article Title" (2025-07-09)... saved ... Done: 39 saved, 0 skipped, 0 failed

This fetches metadata from Substack’s public API, then pulls the full text of each article individually. There’s a built-in delay between requests to be respectful of Substack’s servers. Subsequent runs are incremental — it only fetches articles that aren’t already in the database.

Step 5: Create the MCP server

This is the piece that actually connects your database to Claude. The MCP server is a Python file that tells Claude what tools are available, which may include things like “search my articles,” “get my top posts,” or “show me stats.”

If you cloned the repo (Option A): The server is already built for you at mcp\_server/server.py. You don’t need to change anything; it reads from the database you just created in Step 4.

If you’re building it yourself (Option B): This is where you ask Claude Code to create the MCP server. It’s a single Python file built with FastMCP, which handles all the protocol plumbing. You just write simple Python functions that describe what data Claude can access, and FastMCP turns them into tools.

Tell Claude Code you want a read-only MCP server with tools for searching articles, fetching full text, and getting engagement stats. The “Under the hood” section below has the full details on what each tool does.

Step 6: Connect it to Claude Desktop

This is where it all comes together. You need to tell Claude Desktop where your server is by editing a config file.

How to find the config file:

On Mac: Open Finder, click Go → Go to Folder, and paste this path:

~/Library/Application Support/Claude/claude_desktop_config.json

On Windows: Navigate to:

%APPDATA%\Claude\claude_desktop_config.json

If the file doesn’t exist yet, create it. Add this JSON block (or add the "my-newsletter" section to your existing "mcpServers" if you already have other MCP servers configured):

json

{ "mcpServers": { "my-newsletter": { "command": "/FULL/PATH/TO/newsletter-archive/.venv/bin/python", "args": ["/FULL/PATH/TO/newsletter-archive/mcp_server/server.py"], "env": { "DB_PATH": "/FULL/PATH/TO/newsletter-archive/newsletter.db" } } } }

Important: Replace /FULL/PATH/TO/newsletter-archive with the actual absolute path to where the project lives on your machine. For example, if you put it in your home folder on Mac, it might be /Users/yourname/newsletter-archive. Don’t use ~ or relative paths. Claude Desktop needs the full path to find your files.

Not sure what your full path is? In Terminal, navigate to the project folder and type pwd. It’ll print the full path you need.

Step 7: Restart Claude Desktop and start asking questions

Fully quit Claude Desktop (Cmd+Q on Mac, not just closing the window) and reopen it. The newsletter tools will appear automatically.

Now you can ask Claude things like:

  • “Which of my posts got the most engagement?”
  • “Show me everything I’ve written about [topic]”
  • “How has my average word count changed over time?”
  • “Summarize the key themes across my last 10 articles”
  • “What topics have I covered most frequently?”

This video shows how you can check your database connection and what the Q&A experience looks like:

Troubleshooting

“No newsletter data found” — Run ingest\_runner.py first (Step 4). The MCP server reads from the database, so it needs to exist before Claude can query it.

Claude Desktop doesn’t show the newsletter tools — Double-check that the paths in your config file are correct absolute paths. The most common mistake is using relative paths or ~. Fully quit Claude Desktop (Cmd+Q) and reopen it after any config changes.

Ingestion finds fewer articles than expected — Substack’s API can be inconsistent with pagination. The script uses small page sizes (12 articles per request) to work around this. If articles are still missing, try running with --full to re-fetch everything: .venv/bin/python ingest\_runner.py --full

Under the hood: how the pieces work

If you cloned the repo and just want to use the tool, you can skip this section entirely. But if you’re building it yourself with Claude Code, or if you’re curious about how MCP servers work, here’s what each piece does.

The ingestion script

Substack has a public, undocumented API endpoint that returns your article archive as JSON:

https://YOURNEWSLETTER.substack.com/api/v1/archive?sort=new&limit=12&offset=0

This returns titles, dates, slugs, reaction counts, word counts, and more — everything except the article body. The ingestion script paginates through this endpoint in small batches (I’d recommend sticking with limit=12 because larger limits can return inconsistent engagement counts), then fetches the full HTML content for each article individually.

One important filter: set type=newsletter to skip restacks and only capture your original articles.

Since you want clean, readable text in your database (not raw HTML), the script converts each article’s HTML to plain text using BeautifulSoup. This preserves paragraph structure while stripping all the formatting cruft.

Here’s the fetcher code:

python

import json import time import requests from substack_api.post import Post def fetch_archive(slug: str) -> list[dict]: """Fetch all post metadata from the Substack archive API. Returns a list of raw post dicts for newsletter articles only (no restacks). Uses a small page size because the Substack API returns inconsistent counts with larger limits, and always fetches until a truly empty page. """ base_url = f"https://{slug}.substack.com" all_posts = [] offset = 0 limit = 12 # Small pages — API returns inconsistent counts with limit=25+ while True: resp = requests.get( f"{base_url}/api/v1/archive", params={"sort": "new", "offset": offset, "limit": limit}, headers={"Accept": "application/json"}, timeout=30, ) resp.raise_for_status() posts = resp.json() if not posts: break all_posts.extend(posts) offset += len(posts) time.sleep(2) # Rate limit

# Filter to newsletter articles only (exclude restacks, etc.)

all_posts = [p for p in all_posts if p.get("type") == "newsletter"] return all_posts

And here’s the HTML-to-text converter:

python

import re from bs4 import BeautifulSoup def html_to_text(html: str | None) -> str: """Convert HTML to clean plain text with paragraph breaks preserved.""" if not html: return "" soup = BeautifulSoup(html, "html.parser") for br in soup.find_all("br"): br.replace_with("\n") for tag in soup.find_all( ["p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "li", "blockquote"] ): tag.insert_before("\n\n") tag.insert_after("\n\n") text = soup.get_text() text = re.sub(r"[^\S\n]+", " ", text) text = re.sub(r"\n{3,}", "\n\n", text) return text.strip()

The database

The SQLite database has two tables and a full-text search index:

A newsletter table with a single row containing publication metadata (name, author, URL, description, and when the data was last fetched).

An articles table with one row per post, storing the title, subtitle, URL, published date, full article text, word count, audience type (free vs. paid), reaction count, comment count, reaction breakdown, categories, and featured image URL.

An articles\_fts table using SQLite’s FTS5 extension for full-text search across titles, subtitles, and article content. This is auto-synced with triggers on every INSERT, UPDATE, and DELETE — so the search index stays current without extra work.

The MCP server

The MCP server is a single Python file built with FastMCP, a lightweight framework that makes it easy to create MCP servers. If you’ve never heard of it, think of FastMCP as the glue between your data and Claude Desktop. You write simple Python functions that describe what data Claude can access (like “search my articles” or “get my top posts”), and FastMCP handles all the plumbing — turning those functions into tools that Claude knows how to call. You don’t have to understand the MCP protocol itself; FastMCP abstracts it away.

The server exposes seven read-only tools:

  • get\newsletter\info: Returns the newsletter name, author, total articles, date range, and engagement summary.
  • search\_articles: Filters articles by keyword in the title, date range, and audience type.
  • full\text\search: Runs FTS5 queries across all article content and returns matching snippets.
  • get\_article: Fetches the full text and metadata for a single article by ID.
  • get\articles\batch: Fetches full text for up to five articles at once.
  • get\_stats: Returns aggregate statistics including totals, averages, and free vs. paid breakdown.
  • get\top\articles: Ranks articles by reactions, comments, or word count.

The key design decision here is tiered retrieval. Claude searches metadata first (which is cheap on tokens), then fetches full text only for the specific articles it needs. This keeps conversations fast and efficient.

The stack at a glance

The whole thing uses: Substack’s public /api/v1/archive endpoint for data, BeautifulSoup for HTML-to-text conversion, SQLite with FTS5 for storage and search, FastMCP for the server (it handles the connection between your data and Claude), and Claude Desktop as the front end.

No embeddings. No vector database. No API keys. For a corpus of ~40 articles, full-text search plus Claude’s reasoning is more than sufficient.

What I learned about Wondering About AI

Once the system was wired up, I started asking questions. And the data told me some things I knew intuitively, some things I suspected, and a few things that genuinely surprised me.

A quick note on what the data includes and doesn’t include: The database captures reactions (likes) and comments for each article, but it does not include subscriber counts, open rates, or click-through rates. (To access this information, you’d need to access different API endpoints while passing your Substack authentication cookie to the API.)

So the analysis below is based on engagement (reactions + comments), word count, and publication timing. If you’re looking for subscriber growth data, you’ll need to pull that from your Substack dashboard manually.

The numbers at a glance

Across 39 articles published between July 2025 and February 2026, Wondering About AI has accumulated 2,953 reactions and 1,681 comments. The average article is about 2,455 words long, gets roughly 76 reactions, and generates 43 comments. Every article has been published free to all readers.

“I built a thing” is the formula that works

This was the finding I suspected but hadn’t quantified. When I looked at my top 10 articles by reactions, nine of the ten start with “I built,” “I used,” “I tried,” or “I shut down”—first-person narratives about making something and sharing what happened.

My #1 article by reactions (139 likes, 78 comments) is “I used machine learning to make sense of 39,000 Substack articles.” My #2 (133 likes, 90 comments) is “I built a Chrome extension to manage my 1,200+ Substack subscriptions.” My #6 (112 likes, 72 comments) is “[I shut down my AI-powered startup.

What went wrong?](https://wonderingaboutai.substack.com/p/i-shut-down-my-ai-powered-startup)“

The pattern is clear: readers respond to building-in-public narratives where there’s a real project, real challenges, and honest outcomes, including failures. The StackDigest shutdown article outperformed most of my how-to posts, which tells me that vulnerability and transparency resonate more than polished success stories.

Specific numbers in titles drive engagement

Looking at the top performers, there’s a strong correlation between titles containing specific numbers and higher engagement. “39,000 Substack articles,” “1,200+ Substack subscriptions,” “1,400 screenshots,” “415 Reddit posts,” “11,303 research papers”—these all landed in the top half of my articles by engagement.

The specificity signals that there’s real data behind the story, not just opinions. It’s the difference between “I analyzed some Reddit posts” and “I analyzed 415 Reddit posts about AI in schools.” The second version tells the reader they’re about to get something substantive.

Chrome extension articles are consistently strong

I’ve written four articles about building Chrome extensions, and all four performed above the newsletter average. The Substack Reader article (133 reactions, 90 comments) is my second most-liked article ever, and the Prompt Collector article (98 reactions, 73 comments) also did well. Both of those articles explained how to build an extension and then offered it for free.

This makes sense given my audience. People reading a newsletter called “Wondering About AI” are likely building things themselves, and Chrome extensions are an accessible, practical project that many readers can actually try. The articles also follow the building-in-public format; here’s the problem, here’s how I built the solution, here are the bugs I found, here’s the code.

Longer articles don’t hurt (up to a point)

My average word count is 2,455 words, and my highest-performing articles tend to be slightly above average. The StackDigest shutdown article (3,680 words, 112 reactions), the machine learning analysis (2,892 words, 139 reactions), and the Chrome extension subscription manager (2,987 words, 133 reactions) are all in the 2,800–3,700 word range.

But the relationship isn’t linear. My earliest, shortest articles (under 1,000 words) performed significantly worse, but that’s also when I had the smallest audience. “How I edit AI-generated copy” at 1,547 words got 113 reactions, proving that a well-structured, actionable shorter piece can hold its own.

The takeaway isn’t necessarily “write longer.” It’s “write as long as the story needs to be, and don’t pad it.”

Comments track with reactions, but not perfectly

Most of my articles show a roughly 2:1 ratio of reactions to comments. But a few articles break this pattern in interesting ways. The Moltbook Lurker Bot article (92 reactions, 84 comments) has a near-1:1 ratio, suggesting the topic sparked genuine debate. The CarouselBot React article (105 reactions, 83 comments) is similar, probably because readers were sharing their own experiences both with creating LinkedIn carousels and building similar tools.

Articles that are more informational (like the data analysis pieces) tend to get more reactions than comments. Articles that are more experiential or invite opinions tend to get more discussion.

The early articles barely registered

My first three articles—a brainrot video experiment (8 reactions), a link post about AI slop (6 reactions), and a fake soda ad experiment (4 reactions)—got almost no engagement. This is partly an audience-size issue (I was just getting started), but it’s also a content issue. These were short, experimental posts without the building-in-public structure that would later become my signature format.

I found my voice around article five or six, when I shifted to longer, project-driven narratives. The engagement difference is dramatic: my July 2025 articles averaged about 50 reactions, while my articles from October onward average closer to 90.

Research collaborations and data-driven pieces stand out

When I look at articles that punch above their weight, several involve original data or research partnerships. “I analyzed 415 Reddit posts about AI in schools” (82 reactions, 46 comments) included an interview with an education technology expert. “10,000 TikTok comments say people love AI therapists” (80 reactions, 40 comments) combined data scraping with academic research.

These articles take more effort to produce, but they offer something readers can’t get elsewhere—original analysis rather than recycled takes.

The meta-analysis: Using AI to analyze writing about AI

There’s something delightfully recursive about using Claude to analyze a newsletter about AI. But beyond the meta-humor, this project validated something I’ve been saying for a while: MCP turns any database into a conversational interface, and Claude Desktop makes a surprisingly good analytics front end.

I didn’t have to build a dashboard. I didn’t have to learn a visualization library. I just asked Claude questions like “which of my articles about Chrome extensions got the most comments?” and “how has my average word count changed over time?” and got immediate, reasoned answers with specific data points.

For a corpus of ~40 articles, this is probably the right level of tooling. I don’t need a vector database or embedding-powered semantic search for my own newsletter. SQLite’s FTS5 handles keyword search, and Claude handles the reasoning. If my archive grows to hundreds of articles, I might revisit that decision. But right now, the simplicity is a feature, not a limitation.

Make it your own

The pattern I’ve described here generalizes to any data source. You could build the same thing for your blog, your email archive, a knowledge base, research notes, bookmarks, or even your commit history. The steps are always the same:

  1. Ingest your data into SQLite (or any local store).
  1. Expose it via MCP tools that Claude can call (read-only).
  1. Connect Claude Desktop to your server via the config file.

If you try this with your own newsletter, I’d love to hear what patterns you find. Drop a comment or DM me; I’m always curious what other builders discover when they turn their tools inward.


From my TBR list

Some articles from my very long reading list that are worth your time:


Like this kind of project? Paid subscribers to Wondering About AI get early access to tools and projects like this one, deep-dive tutorials with full code walkthroughs, and live builds where we build together.

If you want to go deeper than what I can fit into a free post, consider upgrading.