import { loadCLITools } from "../tools/cli.mjs";
import { loadDocsTools } from "../tools/docs.mjs";
import { readFileSync } from "node:fs";
import { dirname as dirname$1, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { isESModule } from "@intlayer/config";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";

//#region src/server/server.ts
const dirname = isESModule ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
const packageJson = JSON.parse(readFileSync(resolve(dirname, "../../../package.json"), "utf8"));
const loadServer = ({ isLocal }) => {
	const server = new McpServer({
		name: "intlayer",
		version: packageJson.version,
		capabilities: { resources: {} }
	});
	if (isLocal) try {
		loadCLITools(server);
	} catch (error) {
		console.error("Error loading CLI tools:", error);
	}
	try {
		loadDocsTools(server);
	} catch (error) {
		console.error("Error loading docs tools:", error);
	}
	return server;
};

//#endregion
export { dirname, loadServer };
//# sourceMappingURL=server.mjs.map