@littlebigbrain/mcp 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/http.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { createMcpHttpServer } from "./http-server.js";
3
+ const port = Number(process.env.PORT ?? 8080);
4
+ if (!Number.isInteger(port) || port < 0 || port > 65_535) {
5
+ throw new Error("PORT must be an integer between 0 and 65535");
6
+ }
7
+ // Bind loopback by default; exposing the key-bearer edge to a network is an
8
+ // explicit decision (LBB_MCP_HOST=0.0.0.0) that should sit behind your own
9
+ // auth/edge. When bound to loopback, DNS-rebinding protection defaults to
10
+ // loopback host names; override with LBB_MCP_ALLOWED_HOSTS /
11
+ // LBB_MCP_ALLOWED_ORIGINS (comma-separated) when fronting it deliberately.
12
+ const host = process.env.LBB_MCP_HOST ?? "127.0.0.1";
13
+ const LOOPBACK_HOSTS = ["127.0.0.1", "localhost", "::1", "[::1]"];
14
+ const isLoopback = LOOPBACK_HOSTS.includes(host);
15
+ function csv(value) {
16
+ const items = value
17
+ ?.split(",")
18
+ .map((item) => item.trim())
19
+ .filter(Boolean);
20
+ return items && items.length > 0 ? items : undefined;
21
+ }
22
+ const mcpPath = process.env.LBB_MCP_PATH ?? "/mcp";
23
+ const httpServer = createMcpHttpServer({
24
+ baseUrl: process.env.LBB_BASE_URL ?? "https://db.eu.littlebigbrain.com",
25
+ mcpPath,
26
+ allowedHosts: csv(process.env.LBB_MCP_ALLOWED_HOSTS) ??
27
+ (isLoopback ? LOOPBACK_HOSTS : undefined),
28
+ allowedOrigins: csv(process.env.LBB_MCP_ALLOWED_ORIGINS),
29
+ onError: (error) => console.error(error),
30
+ });
31
+ httpServer.listen(port, host, () => {
32
+ console.error(`lbb MCP (streamable-http) listening on ${host}:${port}${mcpPath}`);
33
+ });
@@ -0,0 +1,3 @@
1
+ export { registerLbbTools } from "./tools.js";
2
+ export { buildLbbServer } from "./server.js";
3
+ export { createMcpHttpServer, type McpHttpServerOptions, } from "./http-server.js";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { registerLbbTools } from "./tools.js";
2
+ export { buildLbbServer } from "./server.js";
3
+ export { createMcpHttpServer, } from "./http-server.js";
@@ -0,0 +1,4 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { LbbClient } from "@littlebigbrain/client";
3
+ /** Build an MCP server exposing the Little Big Brain tool belt, bound to one client. */
4
+ export declare function buildLbbServer(client: LbbClient): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,8 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { registerLbbTools } from "./tools.js";
3
+ /** Build an MCP server exposing the Little Big Brain tool belt, bound to one client. */
4
+ export function buildLbbServer(client) {
5
+ const server = new McpServer({ name: "lbb", version: "0.1.0" });
6
+ registerLbbTools(server, client);
7
+ return server;
8
+ }
package/dist/stdio.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { LbbClient } from "@littlebigbrain/client";
4
+ import { buildLbbServer } from "./server.js";
5
+ /**
6
+ * Local stdio entrypoint (`npx @littlebigbrain/mcp`). Reads the connection from the
7
+ * environment and serves the Little Big Brain tools over stdio, the transport every
8
+ * editor (Claude Code, Cursor, Codex) supports.
9
+ *
10
+ * LBB_BASE_URL (default http://127.0.0.1:7400)
11
+ * LBB_API_KEY stack API key (lbb_sk_live_…) or single-mode token
12
+ * LBB_GRAPH / LBB_BRANCH (optional; server defaults to main/main)
13
+ */
14
+ async function main() {
15
+ const client = new LbbClient({
16
+ baseUrl: process.env.LBB_BASE_URL ?? "http://127.0.0.1:7400",
17
+ apiKey: process.env.LBB_API_KEY,
18
+ graph: process.env.LBB_GRAPH,
19
+ branch: process.env.LBB_BRANCH,
20
+ });
21
+ const server = buildLbbServer(client);
22
+ await server.connect(new StdioServerTransport());
23
+ }
24
+ main().catch((error) => {
25
+ console.error(error);
26
+ process.exit(1);
27
+ });