#!/usr/bin/env node /** * Bilagun MCP server — local mode (stdio), for Claude Desktop / Claude Code on your computer. * * Env: BILAGUN_URL (https://…), BILAGUN_USER, BILAGUN_APP_PASSWORD * For the remote (HTTP) server see http.js. */ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { createWpClient, basicAuth } from './src/wp.js'; import { createBilagunServer } from './src/tools.js'; const BASE = (process.env.BILAGUN_URL || '').replace(/\/+$/, ''); const USER = process.env.BILAGUN_USER || ''; const PASS = process.env.BILAGUN_APP_PASSWORD || ''; if (!BASE || !USER || !PASS) { console.error('Set BILAGUN_URL, BILAGUN_USER and BILAGUN_APP_PASSWORD.'); process.exit(1); } const { api } = createWpClient({ baseUrl: BASE, authorization: basicAuth(USER, PASS) }); const server = createBilagunServer({ api, publicUrl: BASE, remote: false }); await server.connect(new StdioServerTransport());