This is an MCP (Model Context Protocol) server that allows you to analyze your Substack essays using Google's Gemini AI directly from Claude Desktop.
npx substack-analysis-mcp
The MCP server exposes three tools to Claude:
- fetch_substack_posts - Fetches the latest posts from your Substack RSS feed
- analyze_writing_summary - Generates a comprehensive analysis of your writing covering themes, style, and intellectual journey
- ask_about_writing - Ask specific questions about your essays and get answers based on the full text
- Node.js 18+ installed
- Python 3.x installed (for running the analyzer)
- A Google Gemini API key
- Claude Desktop app
First, install the Node.js dependencies:
cd mcp-server
npm install
Copy the example environment file and add your API key:
cp env.example .env
Edit .env
and add your Gemini API key:
GEMINI_API_KEY=your-actual-api-key-here
SUBSTACK_URL=https://jonathanpolitzki.substack.com/
You need to add this MCP server to your Claude Desktop configuration.
On macOS:
-
Open your Claude Desktop configuration file:
open ~/Library/Application\ Support/Claude/claude_desktop_config.json
-
Add the following to the
mcpServers
section (create it if it doesn't exist):{ "mcpServers": { "substack-analysis": { "command": "node", "args": [ "/Users/jonathanpolitzki/Desktop/Coding/Substack-Analysis/mcp-server/index.js" ], "env": { "GEMINI_API_KEY": "your-actual-gemini-api-key", "SUBSTACK_URL": "https://jonathanpolitzki.substack.com/" } } } }
Make sure to:
- Replace the path with the absolute path to your
mcp-server/index.js
file - Add your actual Gemini API key
- Update the Substack URL if needed
- Replace the path with the absolute path to your
-
Restart Claude Desktop for the changes to take effect
On Windows:
The config file is located at:
%APPDATA%\Claude\claude_desktop_config.json
You can test the server standalone:
node index.js
It should output: Substack Analyzer MCP server running
Once configured, you can use these commands in Claude:
-
Fetch your posts:
- "Fetch my Substack posts"
- "Get the latest posts from my Substack"
-
Analyze your writing:
- "Analyze my Substack writing and give me a summary"
- "What are the main themes in my essays?"
-
Ask questions:
- "What have I written about AI?"
- "Summarize my thoughts on technology"
- "How has my writing style evolved?"
The MCP server:
- Uses the existing Python scraper and analyzer code
- Spawns Python processes to run the analysis
- Caches fetched posts for 1 hour to avoid repeated API calls
- Returns results to Claude in a structured format
- Make sure Python 3 is installed and accessible as
python3
- Ensure all Python dependencies are installed in the parent directory:
cd .. pip install -r requirements.txt
- Make sure you've set up your
.env
file or added the API key to the Claude config
- Restart Claude Desktop after updating the configuration
- Check that the path in the config file is absolute and correct
- Verify the MCP server starts without errors
To run in development mode with auto-reload:
npm run dev
- The server caches posts for 1 hour. Use
force_refresh: true
to bypass the cache - RSS feeds typically only provide the ~20 most recent posts
- All analysis is done using Google's Gemini AI, so API usage costs apply