MCP server for Ghost CMS with optimized field projection - reduces token usage by 90-98%
npm install mcp-ghost-optimizedServeur MCP pour Ghost CMS avec field projection pour réduire la consommation de tokens de 90-98%.
Le MCP officiel @fanyangmeng/ghost-mcp retourne ~14K tokens par appel. Ce MCP optimisé retourne ~200-1500 tokens selon le mode choisi.
``bashInstallation globale
claude mcp add ghost-optimized -e GHOST_URL=https://votre-blog.ghost.io -e GHOST_ADMIN_API_KEY=id:secret -- npx -y mcp-ghost-optimized
> Le nom
ghost-optimized évite les conflits si vous avez déjà un MCP Ghost installé.$3
Ajouter dans votre
.mcp.json :`json
{
"mcpServers": {
"ghost-optimized": {
"command": "npx",
"args": ["-y", "mcp-ghost-optimized"],
"env": {
"GHOST_URL": "https://votre-blog.ghost.io",
"GHOST_ADMIN_API_KEY": "id:secret"
}
}
}
}
`$3
`bash
git clone https://github.com/Mathunterix/mcp-ghost-perso.git
cd mcp-ghost-perso
npm install
npm run build
`Puis dans
.mcp.json :`json
{
"mcpServers": {
"ghost-optimized": {
"command": "node",
"args": ["/chemin/vers/mcp-ghost-perso/dist/index.js"],
"env": {
"GHOST_URL": "https://votre-blog.ghost.io",
"GHOST_ADMIN_API_KEY": "id:secret"
}
}
}
}
`Configuration
$3
| Variable | Obligatoire | Description |
|----------|-------------|-------------|
|
GHOST_URL | Oui | URL de votre blog Ghost |
| GHOST_ADMIN_API_KEY | Oui | Clé API Admin (format id:secret) |
| GHOST_DEFAULT_TEMPLATE | Non | Template par défaut pour les nouveaux posts |Tools disponibles
$3
| Tool | Description |
|------|-------------|
|
posts_browse | Liste les posts avec modes minimal, compact, standard |
| posts_read | Lit un post avec modes metadata, content, full |
| posts_add | Crée un post (supporte HTML via ?source=html) |
| posts_edit | Modifie un post (gère auto updated_at) |
| posts_delete | Supprime un post (requiert confirm: true + title) |$3
| Tool | Description |
|------|-------------|
|
tags_browse | Liste les tags avec modes minimal, standard |
| tags_read | Lit un tag par ID ou slug |$3
| Tool | Description |
|------|-------------|
|
images_upload | Upload une image depuis file_path ou url |Exemples d'utilisation
$3
`
posts_browse(status: "published", mode: "compact", limit: 10)
`$3
`
posts_browse(filter: "tag:finance+status:published")
`$3
`
posts_add(
title: "Mon article",
html: "Contenu de l'article
",
status: "draft",
tags: ["tech", "tutorial"]
)
`$3
`
Depuis un fichier local
images_upload(file_path: "/tmp/image.jpg")Depuis une URL
images_upload(url: "https://example.com/image.jpg", filename: "image.jpg")
`$3
`
posts_delete(id: "xxx", title: "Titre du post", confirm: true)
`Modes de réponse
$3
| Mode | Tokens/post | Champs |
|------|-------------|--------|
|
minimal | ~15 | id, title, slug, status |
| compact | ~50 | + published_at, updated_at |
| standard | ~150 | + tags, excerpt, reading_time |$3
| Mode | Tokens | Champs |
|------|--------|--------|
|
metadata | ~200 | Métadonnées sans contenu |
| content | ~500-2000 | + plaintext (HTML converti) |
| full | ~500-3000 | + HTML brut |Développement
`bash
npm run dev # Watch mode
npm run build # Compile TypeScript
`Structure
`
src/
├── index.ts # Entry point (stdio transport)
├── server.ts # Définition des tools MCP
├── api/
│ ├── auth.ts # Génération JWT
│ └── client.ts # Client HTTP avec field projection
└── utils/
├── fields.ts # Presets de champs par mode
└── html.ts # Conversion HTML → plaintext
``MIT