@yeepay/awesome-components-mcp
Version:
MCP server providing access to awesome-components documentation and integration guides with dual-mode operation: direct fetch and GitLab MCP instruction generation
61 lines (48 loc) • 2.38 kB
text/typescript
/**
* Awesome Components MCP Server
*
* This is the main entry point for the Awesome Components MCP (Model Context Protocol) server.
* The server provides access to the awesome-components documentation and integration guides.
*/
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { config } from './config';
import { componentsDiscoveryTool } from './tools/componentsDiscovery';
import { getComponentsGuideTool, getComponentsGuideSchema } from './tools/getComponentsGuide';
async function main() {
console.log('Awesome Components MCP Server starting...');
// Create MCP server instance
const server = new McpServer({
name: config.name,
version: config.version
});
console.log(`MCP Server "${config.name}" v${config.version} initialized`);
// Register the components_discovery tool
server.tool(
"components_discovery",
"Discover and categorize all available components from the main llms.txt file. Use this tool to get an overview of all components, their types, and paths. Returns structured JSON data with component metadata and categorization. This tool is ideal for exploring what components are available before retrieving specific component guides.",
{},
componentsDiscoveryTool
);
// Register the get_components_guide tool
server.tool(
"get_components_guide",
"Retrieve detailed integration guide for a specific component. Use this tool when you need the complete documentation, setup instructions, or implementation details for a particular component. Provide the component path (e.g., 'yeepay/dynamicpassword/llms.txt') to get its comprehensive guide. Supports both relative paths from the repository and absolute URLs for external components.",
{
path: getComponentsGuideSchema.shape.path
},
getComponentsGuideTool
);
console.log('Registered tools: components_discovery, get_components_guide');
// Create stdio transport for command-line usage
const transport = new StdioServerTransport();
// Connect server to transport
await server.connect(transport);
console.log(`MCP Server running and listening for requests`);
}
// Start the server
main().catch((error) => {
console.error('Failed to start MCP server:', error);
process.exit(1);
});