@chainlink/mcp-server
Version:
Prototype MCP Server for CLL
68 lines • 2.46 kB
JavaScript
;
/**
* @fileoverview Main entry point for the Chainlink MCP Server
*
* This MCP (Model Context Protocol) server provides AI models with access to
* Chainlink documentation and knowledge through various tools and services.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
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 dotenv_1 = __importDefault(require("dotenv"));
const tools_1 = require("./tools");
const logger_1 = require("./utils/logger");
// Load environment variables from .env file
dotenv_1.default.config();
/**
* MCP Server instance configured for Chainlink documentation services
*
* Provides capabilities for:
* - CCIP chain configuration management // TODO @dev: Expand to support VRF, Data Feeds, Functions, Automation
* - Knowledge base querying and retrieval
* - Document processing and vector search
*/
const mcpServer = new mcp_js_1.McpServer({
name: "chainlink-mcp-server",
version: "0.0.1",
capabilities: tools_1.capabilities,
prompts: {},
logging: true,
});
/**
* Initialize all MCP tools and services
*
* Sets up the server with available tools for AI model interaction.
* Each tool provides specific functionality for Chainlink ecosystem queries.
*
* @param server - The MCP server instance to configure
* @throws {Error} When tool initialization fails
*/
async function init(server) {
await (0, tools_1.startChainlinkDeveloperAssistant)(server);
}
/**
* Main application entry point
*
* Initializes the MCP server, connects to stdio transport, and starts
* listening for requests from AI models. The server will continue running
* until explicitly terminated or an unrecoverable error occurs.
*
* @throws {Error} When server initialization or connection fails
*/
async function main() {
await init(mcpServer);
const transport = new stdio_js_1.StdioServerTransport();
await mcpServer.connect(transport);
logger_1.Logger.info("MCP Server running on stdio");
}
// Start the server with error handling
main().catch((error) => {
logger_1.Logger.error(`Fatal error in main(): ${String(error)}`);
mcpServer.close();
process.exit(1);
});
//# sourceMappingURL=index.js.map