How to Publish Blog Posts to mcpm via CLI
You can publish blog posts and tutorials to mcpm.dev directly from your terminal. No browser needed after login. Here's the complete workflow.
Step 1: Login with GitHub
mcpm-dev login
Your browser opens. Click "Authorize" on GitHub. A CLI token is generated and stored at:
- macOS/Linux:
~/.mcpm/auth.json
- Windows:
%USERPROFILE%\.mcpm\auth.json
Step 2: Get Your Token
The token is stored in the auth file. Extract it:
cat ~/.mcpm/auth.json
Get-Content $env:USERPROFILE\.mcpm\auth.json
Or read it programmatically:
TOKEN=$(cat ~/.mcpm/auth.json | jq -r '.token')
Step 3: Write Your Post in Markdown
Create a .md file:
# My First mcpm Blog Post
Welcome to my first post on mcpm!
## Why I Love MCP
The Model Context Protocol makes AI agents truly useful...
Step 4: Publish via the Content API
Use curl with your token:
curl -X POST https://www.mcpm.dev/api/content -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{
"type": "blog",
"title": "My First mcpm Blog Post",
"description": "A short description shown in listings",
"tags": ["mcp", "community", "ai"],
"slug": "my-first-mcpm-post",
"content": "# My First mcpm Blog Post
Welcome to my first post on mcpm!
## Why I Love MCP
The Model Context Protocol makes AI agents truly useful..."
}'
Step 5: Verify
Check your post is live:
curl https://www.mcpm.dev/api/content/blog/my-first-mcpm-post
Or visit: https://www.mcpm.dev/blog/my-first-mcpm-post
Complete Script: Publish from a Markdown File
Save this as publish.sh:
#!/bin/bash
TOKEN=$(cat ~/.mcpm/auth.json | jq -r '.token')
FILE=$1
SLUG=$2
TITLE=$3
DESC=$4
TAGS=$5
if [ -z "$FILE" ] || [ -z "$SLUG" ]; then
echo "Usage: ./publish.sh <file.md> <slug> <title> <description> <tag1,tag2>"
exit 1
fi
CONTENT=$(cat "$FILE" | jq -Rs .)
TAGS_JSON=$(echo "$TAGS" | jq -R 'split(",")')
curl -X POST https://www.mcpm.dev/api/content -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "{
"type": "blog",
"title": "$TITLE",
"description": "$DESC",
"tags": $TAGS_JSON,
"slug": "$SLUG",
"content": $CONTENT
}"
echo ""
echo "✅ Published: https://www.mcpm.dev/blog/$SLUG"
Usage:
chmod +x publish.sh
./publish.sh my-post.md my-slug "My Title" "My description" "mcp,ai,community"
Python Version
Save as publish.py:
import json, sys, requests
from pathlib import Path
auth = json.loads(Path.home() / ".mcpm" / "auth.json").read_text())
token = json.loads(auth)["token"]
content = Path(sys.argv[1]).read_text()
resp = requests.post(
"https://www.mcpm.dev/api/content",
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
},
json={
"type": sys.argv[2],
"title": sys.argv[3],
"description": sys.argv[4],
"tags": sys.argv[5].split(","),
"slug": sys.argv[6],
"content": content
}
)
if resp.ok:
print(f"✅ Published: https://www.mcpm.dev/{sys.argv[2]}/{sys.argv[6]}")
else:
print(f"❌ Failed: {resp.text}")
sys.exit(1)
Usage:
python publish.py my-post.md blog "My Title" "My description" "mcp,ai" my-slug
Available Post Types
| Type |
URL Pattern |
Best For |
blog |
/blog/{slug} |
News, announcements, opinions |
tutorial |
/tutorials/{slug} |
Step-by-step guides, how-tos |
Tips
- Slugs must be unique — use kebab-case:
my-awesome-post
- Tags help discovery — up to 5 tags per post
- First paragraph matters — it becomes the listing description
- Write for AI agents too — some agents read mcpm posts as context
- Update a post — republish with the same slug to overwrite
Troubleshooting
| Problem |
Solution |
| "Not authenticated" |
Run mcpm-dev login again — tokens expire after 30 days |
| "Slug already taken" |
Choose a different slug or add a suffix |
| "Invalid JSON" |
Escape special characters in your content |
| Post not showing |
It may take a few seconds for the site to regenerate |
Now you can publish to mcpm entirely from your terminal. Happy writing!
#MCP #Tutorial #CLI #Publishing #mcpm
How to Publish Blog Posts to mcpm via CLI
You can publish blog posts and tutorials to mcpm.dev directly from your terminal. No browser needed after login. Here's the complete workflow.
Step 1: Login with GitHub
Your browser opens. Click "Authorize" on GitHub. A CLI token is generated and stored at:
~/.mcpm/auth.json%USERPROFILE%\.mcpm\auth.jsonStep 2: Get Your Token
The token is stored in the auth file. Extract it:
# macOS/Linux cat ~/.mcpm/auth.json # Windows (PowerShell) Get-Content $env:USERPROFILE\.mcpm\auth.jsonOr read it programmatically:
# Using jq TOKEN=$(cat ~/.mcpm/auth.json | jq -r '.token')Step 3: Write Your Post in Markdown
Create a
.mdfile:# My First mcpm Blog Post Welcome to my first post on mcpm! ## Why I Love MCP The Model Context Protocol makes AI agents truly useful...Step 4: Publish via the Content API
Use curl with your token:
curl -X POST https://www.mcpm.dev/api/content -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{ "type": "blog", "title": "My First mcpm Blog Post", "description": "A short description shown in listings", "tags": ["mcp", "community", "ai"], "slug": "my-first-mcpm-post", "content": "# My First mcpm Blog Post Welcome to my first post on mcpm! ## Why I Love MCP The Model Context Protocol makes AI agents truly useful..." }'Step 5: Verify
Check your post is live:
Or visit:
https://www.mcpm.dev/blog/my-first-mcpm-postComplete Script: Publish from a Markdown File
Save this as
publish.sh:#!/bin/bash # publish.sh — Publish a markdown file to mcpm TOKEN=$(cat ~/.mcpm/auth.json | jq -r '.token') FILE=$1 SLUG=$2 TITLE=$3 DESC=$4 TAGS=$5 if [ -z "$FILE" ] || [ -z "$SLUG" ]; then echo "Usage: ./publish.sh <file.md> <slug> <title> <description> <tag1,tag2>" exit 1 fi CONTENT=$(cat "$FILE" | jq -Rs .) TAGS_JSON=$(echo "$TAGS" | jq -R 'split(",")') curl -X POST https://www.mcpm.dev/api/content -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "{ "type": "blog", "title": "$TITLE", "description": "$DESC", "tags": $TAGS_JSON, "slug": "$SLUG", "content": $CONTENT }" echo "" echo "✅ Published: https://www.mcpm.dev/blog/$SLUG"Usage:
chmod +x publish.sh ./publish.sh my-post.md my-slug "My Title" "My description" "mcp,ai,community"Python Version
Save as
publish.py:#!/usr/bin/env python3 import json, sys, requests from pathlib import Path # Read token auth = json.loads(Path.home() / ".mcpm" / "auth.json").read_text()) token = json.loads(auth)["token"] # Read markdown file content = Path(sys.argv[1]).read_text() # Publish resp = requests.post( "https://www.mcpm.dev/api/content", headers={ "Authorization": f"Bearer {token}", "Content-Type": "application/json" }, json={ "type": sys.argv[2], # blog or tutorial "title": sys.argv[3], "description": sys.argv[4], "tags": sys.argv[5].split(","), "slug": sys.argv[6], "content": content } ) if resp.ok: print(f"✅ Published: https://www.mcpm.dev/{sys.argv[2]}/{sys.argv[6]}") else: print(f"❌ Failed: {resp.text}") sys.exit(1)Usage:
python publish.py my-post.md blog "My Title" "My description" "mcp,ai" my-slugAvailable Post Types
blog/blog/{slug}tutorial/tutorials/{slug}Tips
my-awesome-postTroubleshooting
mcpm-dev loginagain — tokens expire after 30 daysNow you can publish to mcpm entirely from your terminal. Happy writing!
#MCP #Tutorial #CLI #Publishing #mcpm