Serveur MCP
Cette page a été traduite par PageTurner AI (bêta). Non approuvée officiellement par le projet. Vous avez trouvé une erreur ? Signaler un problème →
Qu'est-ce que le serveur MCP Oh My Posh ?
Le serveur MCP (Model Context Protocol) d'Oh My Posh est un service de validation qui vous permet de vérifier vos configurations de thèmes oh-my-posh par rapport au schéma JSON officiel. Il prend en charge les formats JSON, YAML et TOML, et fournit des rapports d'erreur détaillés pour vous aider à créer des configurations valides.
Fonctionnalités
-
Support multi-format : Valide les configurations JSON, YAML et TOML
-
Rapports d'erreur détaillés : Obtenez des erreurs de validation précises avec les chemins JSON
-
Détection automatique du format : Détecte automatiquement le format de votre configuration
-
Avertissements & recommandations : Recevez des suggestions de bonnes pratiques et des avertissements de dépréciation
-
Basé sur des standards : Utilise le schéma JSON officiel d'oh-my-posh
-
Accès distant : Aucune installation requise - accessible via HTTPS
Utilisation
Avec les clients MCP
Configurez votre client compatible MCP (comme Claude Desktop, Cline ou d'autres assistants IA) pour utiliser le validateur :
{
"mcpServers": {
"oh-my-posh-validator": {
"url": "https://ohmyposh.dev/api/mcp",
"transport": "http"
}
}
}
Demandez ensuite à votre assistant IA de valider votre configuration oh-my-posh.
API HTTP directe
Vous pouvez également utiliser le validateur directement via des requêtes HTTP.
Obtenir les informations du serveur
curl https://ohmyposh.dev/api/mcp
Lister les outils disponibles
curl -X POST https://ohmyposh.dev/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
Valider une configuration
curl -X POST https://ohmyposh.dev/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "validate_config",
"arguments": {
"content": "{\"$schema\":\"https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\",\"version\":4,\"blocks\":[]}",
"format": "json"
}
},
"id": 1
}'
Paramètres des outils
validate_config
Paramètres :
| Parameter | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | The configuration content as a string (JSON, YAML, or TOML) |
| format | string | No | The format: json, yaml, toml, or auto (default: auto) |
Retourne :
{
"valid": true,
"errors": [],
"warnings": [
{
"path": "$schema",
"message": "Consider adding \"$schema\" property for better editor support.",
"type": "recommendation"
}
],
"detectedFormat": "json",
"parsedConfig": { ... }
}
Champs de réponse
| Field | Type | Description |
|---|---|---|
| valid | boolean | Whether the configuration is valid |
| errors | array | List of validation errors (empty if valid) |
| warnings | array | List of warnings and recommendations |
| detectedFormat | string | The detected or specified format |
| parsedConfig | object | The parsed configuration object |
Format des erreurs
Chaque erreur dans le tableau errors contient :
| Field | Type | Description |
|---|---|---|
| path | string | JSON path to the problematic property |
| message | string | Human-readable error message |
| keyword | string | The validation keyword that failed |
| params | object | Additional parameters about the error |
| data | any | The actual data that failed validation |
Exemples
Configuration valide
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 4,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "path",
"style": "powerline",
"background": "blue",
"foreground": "white"
}
]
}
]
}
Exemple de configuration invalide
{
"blocks": [
{
"type": "invalid-type"
}
]
}
Résultat de la validation :
{
"valid": false,
"errors": [
{
"path": "/blocks/0/type",
"message": "Value must be one of: prompt, rprompt, line",
"keyword": "enum"
}
]
}
Exemples d'intégration
Claude Desktop
Ajoutez à votre configuration Claude Desktop (~/Library/Application Support/Claude/config.json sur macOS) :
{
"mcpServers": {
"oh-my-posh-validator": {
"url": "https://ohmyposh.dev/api/mcp",
"transport": "http"
}
}
}
Demandez ensuite à Claude : "Peux-tu valider cette configuration oh-my-posh pour moi ?" et collez votre configuration.
Cline (extension VS Code)
Configurez Cline pour utiliser le serveur MCP, et il validera automatiquement les configurations lorsque vous travaillez sur des thèmes oh-my-posh.
Formats pris en charge
JSON
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 4,
"blocks": []
}
YAML
$schema: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version: 4
blocks: []
TOML
version = 4
blocks = []
Confidentialité et sécurité
-
Le contenu de votre configuration n'est pas stocké ni journalisé
-
Toute la validation est effectuée en mémoire et supprimée après traitement
-
Le serveur ne lit que le schéma officiel depuis le dépôt
-
Aucune authentification requise - entièrement anonyme
Code source
Le serveur MCP est open source et fait partie du dépôt oh-my-posh :
Résolution des problèmes
Format non détecté correctement
Si la détection automatique échoue, spécifiez explicitement le format :
{
"arguments": {
"content": "...",
"format": "yaml"
}
}
Erreurs d'analyse
Si vous obtenez des erreurs d'analyse, vérifiez que votre configuration a une syntaxe JSON/YAML/TOML valide avant de valider le schéma.
Erreurs de schéma
Le validateur utilise le schéma le plus récent de la branche principale. Si vous utilisez une version antérieure d'oh-my-posh, certaines propriétés récentes pourraient ne pas être reconnues.
Contribuer
Vous avez trouvé un bug ou une suggestion ? Veuillez ouvrir un ticket sur GitHub.