blogger-cli-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@blogger-cli-mcpCreate a new draft post titled 'My first post' with content 'Hello'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Blogger Post CLI Script
A Python utility to create and publish posts on Blogger using the Google Blogger API v3 from the command line.
Features
Title and Content Specification: Create posts by passing raw HTML content strings or specifying a path to an HTML file.
Draft or Live Status: Save as a draft or publish immediately to your blog.
Labels Management: Attach comma-separated labels (tags) to your posts.
OAuth 2.0 Authentication: Automatically handles authorization via web browser and securely caches tokens locally.
Update and History Tracking: Update existing posts using
blogger_update.py. Post history is automatically saved topost_history.json.Fetch Post Information: Retrieve current live status, content, and other metadata of existing posts directly from Blogger using
blogger_get.py. Output can be dynamically filtered by specific fields.Module Support: Import modules into other Python scripts to programmatically create or update posts.
Multi-Blog Support: Dynamically route posts to different blogs based on genre or alias using the
--target_blogparameter.MCP Server Support: Includes
Blogger_mcp_server.py(FastMCP) allowing AI assistants to post or update articles directly.
Related MCP server: blogger-mcp
Setup Instructions
1. Install Dependencies
Create a Python 3.x virtual environment and install the required packages:
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install required packages
pip install -r requirements.txt2. Configure Environment Variables and Credentials
To run this tool, you need to set up two configuration files in the script directory:
.envFile Create a.envfile in the same directory as the script with the following content:BLOG_ID=YOUR_DEFAULT_BLOG_ID BLOG_ID_SITE1=YOUR_SITE1_BLOG_ID (Optional: links with --target_blog site1) BLOG_ID_SITE2=YOUR_SITE2_BLOG_ID (Optional: links with --target_blog site2) GCS_BUCKET_NAME=YOUR_GCS_BUCKET_NAME GCP_PROJECT_ID=YOUR_GCP_PROJECT_IDclient_secret.jsonFile Download your Desktop Application OAuth 2.0 client credentials JSON file from the Google Cloud Console, rename it toclient_secret.json, and place it in the script directory.GCS Authentication for Image Uploads (ADC) To use the image upload feature (
image_post.py), run the following command locally and complete the browser authentication for Application Default Credentials (ADC):gcloud auth application-default login
For security,.env, client_secret.json, and the auto-generated token.json are excluded from Git commits via .gitignore. Be careful not to expose your credentials.
Usage
Make sure your virtual environment is activated before running the script.
Create a Post (Save as Draft)
Provide a title and HTML string content to save a draft post:
python blogger_post.py \
--title "My First API Post" \
--content "<h1>Hello World</h1><p>This is a test post from Blogger API.</p>"Read from HTML File and Publish (Live Status)
Specify an HTML file path using --file and set --status live to publish the post immediately:
python blogger_post.py \
--title "Article Loaded from HTML File" \
--file "path/to/article.html" \
--status liveAdd Labels to Your Post
Pass labels as a comma-separated string using the --labels option:
python blogger_post.py \
--title "Post with Labels" \
--content "<p>Testing Blogger API v3 labels.</p>" \
--labels "Python, Blogger API, Test"Route Post to a Specific Blog (Multi-Blog Support)
If you have configured multiple blog IDs in your .env (e.g., BLOG_ID_SITE1), use the --target_blog argument to dynamically switch the destination:
python blogger_post.py \
--title "Site 1 News" \
--content "<p>This goes to the site1 blog.</p>" \
--target_blog "site1"Update an Existing Post
Use blogger_update.py to update an existing post by its post_id:
python blogger_update.py \
--post_id 1234567890123456789 \
--title "Updated Title" \
--content "<p>Updated content.</p>" \
--status liveNote: Successful posts and updates are automatically recorded in post_history.json.
Fetch Post Information
Use blogger_get.py to retrieve the current status, content, or other metadata of a specific post_id. You can extract only specific fields using the --fields argument.
Available Fields (--fields):
id: The ID of the posttitle: The title of the poststatus: The publication status (e.g.,LIVE,DRAFT,SCHEDULED)url: The public URL of the postlabels: A list of labels (tags) attached to the postcontent: The HTML content of the postpublished: The time the post was publishedupdated: The time the post was last updatedreplies: Comment informationauthor: Information about the author
python blogger_get.py \
--post_id 1234567890123456789 \
--fields "title,status,url"Use as a Module
You can also import the script into other Python projects:
from blogger_post import post_article
try:
url = post_article(
title="My API Post",
content="<p>This is posted via Python module.</p>",
labels=["Python", "Module"],
status="draft"
)
print(f"Posted successfully: {url}")
except Exception as e:
print(f"Failed to post: {e}")Use as an MCP Server
The included Blogger_mcp_server.py script runs a FastMCP server. By configuring your AI assistant (e.g., Claude) to use this script as an MCP server, it exposes the following tools:
post_to_blogger: Publish or draft new articles and automatically save the history locally. Acceptstarget_blogto route posts dynamically.update_blogger_post: Update existing articles by theirpost_idand sync the local history. Also acceptstarget_blog.upload_image_to_gcs: Uploads a single local image to GCS (automatically converts to WebP and resizes) and returns the public URL.replace_html_images_with_gcs: Reads local image links within an HTML document, uploads all of them to GCS, and returns a new HTML string with replaced image URLs.get_blogger_post: Retrieves the current information of a specific post directly from the Blogger API. You can specify which fields (e.g., status, url) to extract.
Note: Ensure the mcp, google-cloud-storage, Pillow, and beautifulsoup4 packages are installed (pip install -r requirements.txt) before running the MCP server.
Error Handling
If any issue occurs, the script catches the exception and outputs localized troubleshooting advice:
File Errors: Warns you if the HTML file is missing, lacks read permissions, or is not UTF-8 encoded.
Network Connection Errors: Catches failures when there is no internet connection, Google servers are unreachable, or the request times out (maximum 30-second socket timeout to prevent hanging).
HTTP Errors (403, 404, 500, etc.): Suggests causes and fixes depending on the status code (e.g. check Blogger API enablement for 403, verify BLOG_ID for 404, or wait for Google servers for 500).
Authentication Errors: Guides you if credentials are invalid or expired. This includes a 120-second timeout for the local browser OAuth flow; if it times out (common when your Google Cloud project is in "Testing" mode and the current account is not registered as a "Test User"), the script will abort and print steps to configure test users in Google Cloud Console.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This script is provided "AS IS", without warranty of any kind.
The authors are not responsible for any damage, data loss, or API quota consumption caused by using this software.
Please comply with Google's API terms of service when using this tool.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tai1mo/blogger-cli-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server