/**
* Extracts stability information from README content.
* @param content The content of the README file
* @returns The stability status
*/
export function extractStability(content: string): string {
// First try to find stability in the autogenerated status section
const statusSectionMatch = content.match(/\| Status\s*\|\s*\|\s*\n\|-+\|-+\|\s*\n\|\s*Stability\s*\|\s*\[([^\]]+)\][^\n]*\|/);
if (statusSectionMatch) {
return statusSectionMatch[1].trim();
}
// Fallback to the old format
const stabilityMatch = content.match(/Stability:\s*([^\n]+)/);
if (stabilityMatch) {
return stabilityMatch[1].trim();
}
return 'Unknown';
}
/**
* Extracts description from README content.
* @param content The content of the README file
* @returns The component description
*/
export function extractDescription(content: string): string {
// Skip the autogenerated section if it exists
const contentWithoutStatus = content.replace(/<!-- status autogenerated section -->[\s\S]*?<!-- end autogenerated section -->\s*/g, '');
// Split content into lines and find the first non-empty paragraph after the title
const lines = contentWithoutStatus.split('\n');
let inDescription = false;
let description = [];
let foundTitle = false;
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
// Skip empty lines
if (line === '') {
if (inDescription) {
// If we were in a description and hit an empty line, we're done
break;
}
continue;
}
// Mark when we find the title
if (!foundTitle && line.startsWith('#') && !line.startsWith('##')) {
foundTitle = true;
continue;
}
// If we hit a section header, stop
if (line.startsWith('#')) {
break;
}
// Start collecting description after title
if (foundTitle && !inDescription) {
inDescription = true;
description.push(line);
} else if (inDescription) {
description.push(line);
}
}
if (description.length > 0) {
return description.join(' ');
}
return 'No description available';
}
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/mottibec/otelcol-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server