llms-txt-generator
Version:
A powerful CLI tool and MCP server for generating standardized llms.txt and llms-full.txt documentation files to help AI models better understand project structures
39 lines • 1.35 kB
JavaScript
;
/*
* MCP Server
*/
Object.defineProperty(exports, "__esModule", { value: true });
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const zod_1 = require("zod");
const utils_1 = require("../llm/utils");
// Create an MCP server
const server = new mcp_js_1.McpServer({
name: 'Generate LLMs',
version: '1.0.0',
});
server.tool('generate-llms', `Use this tool whenever the task is to create llms.txt and llms-full.txt files for the current project.`, {
prompt: zod_1.z.string(),
}, async ({ prompt }) => {
try {
const generateMcpPrompt = await (0, utils_1.loadPrompt)('generate');
return {
content: [{ type: 'text', text: `${generateMcpPrompt}\n\nUser's requirement: \n${prompt}` }],
};
}
catch (error) {
console.error(`Error reading prompt file: ${error}`);
return {
content: [{ type: 'text', text: `Error reading prompt file: ${error}` }],
};
}
});
async function main() {
// Start receiving messages on stdin and sending messages on stdout
const transport = new stdio_js_1.StdioServerTransport();
await server.connect(transport);
console.log('Server started');
}
main();
//# sourceMappingURL=server.js.map