website/api/mcp/README.md
This directory contains the Azure Function that implements the Model Context Protocol (MCP) server for validating oh-my-posh configurations.
POST /api/mcp - MCP server endpoint that handles validation requestsGET /api/mcp - Returns server information and available toolsValidate an oh-my-posh configuration.
Validate a segment snippet (individual prompt segment).
Configure your MCP client to connect to this server:
{
"mcpServers": {
"oh-my-posh-validator": {
"url": "https://ohmyposh.dev/api/mcp",
"transport": "http"
}
}
}
curl https://ohmyposh.dev/api/mcp
curl -X POST https://ohmyposh.dev/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
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\",\"blocks\":[]}",
"format": "json"
}
},
"id": 1
}'
curl -X POST https://ohmyposh.dev/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "validate_segment",
"arguments": {
"content": "{\"type\":\"path\",\"style\":\"powerline\",\"foreground\":\"#ffffff\",\"background\":\"#61AFEF\",\"template\":\" {{ .Path }} \"}",
"format": "json"
}
},
"id": 2
}'
The validation result includes:
valid: Boolean indicating if the configuration is validerrors: Array of validation errors (if any)warnings: Array of warnings (best practices, deprecations)detectedFormat: The detected or specified formatparsedConfig: The parsed configuration object (for debugging)Example response:
{
"jsonrpc": "2.0",
"result": {
"content": [
{
"type": "text",
"text": "{
\"valid\": true,
\"errors\": [],
\"warnings\": [
{
\"path\": \"$schema\",
\"message\": \"Consider adding \\\"$schema\\\" property for better editor support.\",
\"type\": \"recommendation\"
}
],
\"detectedFormat\": \"json\",
\"parsedConfig\": {...}
}"
}
]
},
"id": 1
}
To test locally:
cd website/api
npm install
npm start
Then send requests to http://localhost:7071/api/mcp
This server is published to the MCP Registry using GitHub Actions.
Publishing is triggered automatically when you push a version tag (same as oh-my-posh releases):
git tag v9.0.0
git push origin v9.0.0
The workflow will:
v9.0.0 → 9.0.0)server.json version to matchserver.json fileNote: The MCP server version will stay in sync with oh-my-posh versions automatically.
server.json - MCP Registry server configurationserver.schema.json - JSON schema for validationvalidate-server.js - Validation script.github/workflows/publish-mcp.yml - GitHub Actions workflowcd website/api
npm install
cd mcp
node validate-server.js