Skip to main content
This example shows how to create an MCP server for Substack, a popular newsletter and publishing platform. This demonstrates how to work with content platforms and manage subscriptions.

What You’ll Build

An MCP server that enables AI assistants to:
  • Browse and search Substack publications
  • Read newsletter posts and articles
  • Navigate author profiles
  • Discover trending publications
  • Search content across Substack

Generate the Server

Create the MCP server for Substack:
mcpkit create https://substack.com
For a specific Substack publication, you can use the publication’s URL instead (e.g., https://example.substack.com)
1

URL Analysis

MCPKit analyzes Substack and discovers browsing capabilities.
🔨 MCP Server Generator
📍 Analyzing: https://substack.com
🚀 Starting browser session...
2

Action Discovery

The AI discovers actions for browsing and reading content:
🔍 Discovering actions...
✅ Found 8 actions:
  - search_publications
  - view_publication
  - read_post
  - view_author_profile
  - browse_categories
  - get_trending
  - search_posts
  - view_post_comments
3

Server Generation

Your MCP server is generated:
📁 mcp-stagehand-substack.com/
├── src/
│   └── index.ts
├── package.json
└── tsconfig.json

Available Tools

The generated server typically includes:

Content Discovery

Search for Substack publications by topic or name.Parameters:
query
string
required
Search query (e.g., “tech”, “politics”, “cooking”)
Example usage:
User: Find Substack newsletters about AI and machine learning
AI: [Uses search_publications with query "AI machine learning"]
Returns: List of publications with titles, descriptions, and URLs
Browse Substack publications by category.Parameters:
category
string
required
Category name (e.g., “Technology”, “Culture”, “Politics”)
Example:
{
  "category": "Technology"
}

Reading Content

View details and recent posts from a specific publication.Parameters:
publicationUrl
string
required
URL of the Substack publication
Example:
{
  "publicationUrl": "https://stratechery.com"
}
Returns: Publication details, recent posts, subscriber count
Read the full content of a specific post.Parameters:
postUrl
string
required
URL of the post to read
Example usage:
User: Read the latest post from Platformer
AI: [Uses view_publication to get latest post URL, then read_post]
Returns: Post title, author, date, full content, and images
View comments and discussions on a post.Parameters:
postUrl
string
required
URL of the post
Returns: Comments with author names and timestamps
Search for specific posts across Substack.Parameters:
query
string
required
Search query
author
string
Filter by specific author (optional)
Example:
{
  "query": "GPT-4",
  "author": "Casey Newton"
}
View an author’s profile and their publications.Parameters:
authorName
string
required
Author’s name or profile URL
Returns: Bio, publications, social links

Setup and Testing

Build the Server

cd mcp-stagehand-substack.com
npm install
npm run build

Test with MCP Inspector

npx @modelcontextprotocol/inspector node dist/index.js

Add to Claude Code

claude mcp add --transport stdio "substack" -- node /absolute/path/to/dist/index.js

Example Use Cases

  • Content Curation
  • Research
  • Author Discovery
  • Trend Analysis
Prompt: “Find the top 5 tech newsletters on Substack and summarize their latest posts”What happens:
  1. Uses search_publications with query “technology”
  2. For top 5 results, uses view_publication
  3. For each publication, uses read_post for latest post
  4. Summarizes findings

Authentication (Optional)

For full access including subscriber-only content:
# Authenticate to access premium content
mcpkit contexts create substack.com
Benefits of authentication:
  • Read subscriber-only posts
  • Access full comment threads
  • View analytics (for your publications)
  • Manage your subscriptions

Customization Ideas

Add Newsletter Digest

{
  name: "create_weekly_digest",
  description: "Create a weekly digest from favorite publications",
  inputSchema: {
    type: "object",
    properties: {
      publications: {
        type: "array",
        items: { type: "string" },
        description: "List of publication URLs"
      }
    }
  }
}

Track Specific Topics

{
  name: "track_topic",
  description: "Monitor Substack for posts about a specific topic",
  inputSchema: {
    type: "object",
    properties: {
      topic: { type: "string" },
      frequency: {
        type: "string",
        enum: ["daily", "weekly"]
      }
    }
  }
}

Export to Markdown

// Add to read_post implementation
const markdown = `# ${post.title}

By ${post.author} on ${post.date}

${post.content}

---
Source: ${post.url}
`;

// Save or return markdown
await fs.writeFile(`posts/${post.slug}.md`, markdown);

Common Workflows

Newsletter Aggregation

Combine multiple newsletters into a single feed:
"Create a summary of this week's posts from my favorite tech newsletters:
Stratechery, Platformer, and The Generalist"

Content Research

Research a topic across multiple publications:
"Search all Substack posts about Web3 from the past 3 months and
identify the main themes and controversies"

Author Tracking

Follow specific authors across their publications:
"Track all posts from Ben Thompson and create a monthly summary
of his analysis on Big Tech companies"

Troubleshooting

Some content is subscriber-only. To access:
  1. Authenticate:
    mcpkit contexts create substack.com
    
  2. Subscribe to publications you want to read
  3. Regenerate the server with authentication
If search returns limited results:
  1. Use broader queries - Try general terms first
  2. Search specific publications - Use view_publication then search within
  3. Try author names - Search by author for better targeting
Substack pages can be content-heavy:
  1. Be patient - Allow time for page loads
  2. Use specific URLs - Direct links are faster than searching
  3. Cache results - Store frequently accessed content

Best Practices

Recommendations

Tips for effective automation with Substack:
  1. Respect Rate Limits - Don’t make rapid-fire requests
  2. Cache Content - Store posts you’ve already read
  3. Use Specific URLs - Direct links are more reliable than searches
  4. Attribute Sources - Always credit authors and link to originals
  5. Subscribe to Support - If you regularly read a publication, subscribe

Advanced Features

Content Analysis

case "analyze_publication_style": {
  // Read multiple posts
  const posts = await getRecentPosts(publicationUrl);

  // Extract text
  const content = posts.map(p => p.content).join("\n\n");

  // Analyze with AI
  const analysis = await analyzeWritingStyle(content);

  return {
    content: [{
      type: "text",
      text: JSON.stringify(analysis, null, 2)
    }]
  };
}

Recommendation Engine

case "get_recommendations": {
  const { interests } = args as { interests: string[] };

  // Search for publications matching interests
  const results = await Promise.all(
    interests.map(interest =>
      searchPublications(interest)
    )
  );

  // Rank and dedupe
  const recommendations = rankPublications(results.flat());

  return {
    content: [{
      type: "text",
      text: JSON.stringify(recommendations, null, 2)
    }]
  };
}

Next Steps

Real-World Applications

Create a daily digest from your favorite newsletters:
  • Aggregate posts from multiple publications
  • Summarize key points
  • Filter by topics of interest
  • Deliver via email or Slack
Research topics across Substack:
  • Search for specific themes
  • Track emerging trends
  • Identify key voices
  • Export findings to notes
Analyze successful Substack content:
  • Study popular writers’ styles
  • Identify trending topics
  • Research similar publications
  • Generate content ideas