// tools/create-spec/mcp-layer-adapter.ts
// Adapter for create_spec that suggests MCP server layer when a project is a candidate.
import { scoreMcpCandidate, detectAppDomains, } from '../../engine/detectors/mcp-candidate-detector.js';
/**
 * Check if we should suggest an MCP server layer for this project.
 */
export function shouldSuggestMcpLayer(knowledge) {
    if (!knowledge) {
        return false;
    }
    const score = scoreMcpCandidate(knowledge);
    return score.isStrongCandidate || score.isSoftCandidate;
}
/**
 * Build a markdown section suggesting MCP server creation.
 * Included in technical.md when shouldSuggestMcpLayer() returns true.
 */
export function buildMcpLayerSection(knowledge, _description) {
    const score = scoreMcpCandidate(knowledge);
    const domains = detectAppDomains(knowledge);
    const lines = [];
    lines.push('## MCP Server Opportunity');
    lines.push('');
    if (score.isStrongCandidate) {
        lines.push('> **Strong candidate**: This project would significantly benefit from an MCP server layer.');
    }
    else {
        lines.push('> **Potential candidate**: This project could benefit from an MCP server layer.');
    }
    lines.push('');
    // Reasons
    lines.push('### Why this project is a candidate');
    lines.push('');
    for (const reason of score.reasons) {
        lines.push(`- ${reason}`);
    }
    lines.push('');
    // Detected domains
    if (domains.length > 0) {
        lines.push(`### Detected app domains: ${domains.join(', ')}`);
        lines.push('');
        lines.push('Based on the detected domains, an MCP server could expose tools for:');
        lines.push('');
        for (const domain of domains) {
            lines.push(`- **${domain}**: CRUD operations, search, domain-specific queries`);
        }
        lines.push('');
    }
    // Suggestion
    lines.push('### Recommended next step');
    lines.push('');
    lines.push('Run `suggest_mcp_server` to get a detailed recommendation with specific tools,');
    lines.push('resources, auth strategy, and transport selection for your MCP server.');
    lines.push('');
    return lines.join('\n');
}
//# sourceMappingURL=mcp-layer-adapter.js.map