@embd/mcp 0.1.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/bin.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{E as Z,n as Q,r as X,t as Y}from"./bin-q5p2211j.js";import W from"node:process";class F{append(q){this._buffer=this._buffer?Buffer.concat([this._buffer,q]):q}readMessage(){if(!this._buffer)return null;let q=this._buffer.indexOf(`
3
+ `);if(q===-1)return null;let w=this._buffer.toString("utf8",0,q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(q+1),$(w)}clear(){this._buffer=void 0}}function $(q){return Q.parse(JSON.parse(q))}function V(q){return JSON.stringify(q)+`
4
+ `}class H{constructor(q=W.stdin,w=W.stdout){this._stdin=q,this._stdout=w,this._readBuffer=new F,this._started=!1,this._ondata=(D)=>{this._readBuffer.append(D),this.processReadBuffer()},this._onerror=(D)=>{this.onerror?.(D)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let q=this._readBuffer.readMessage();if(q===null)break;this.onmessage?.(q)}catch(q){this.onerror?.(q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(q){return new Promise((w)=>{let D=V(q);if(this._stdout.write(D))w();else this._stdout.once("drain",w)})}}async function A(){let q=process.env.EMBD_API_KEY;if(!q)console.error(`embd MCP server: the EMBD_API_KEY environment variable is required.
5
+ Create an API key in your embd account settings (${X}), then configure this server with EMBD_API_KEY=embd_sk_...`),process.exit(1);let w=new Y({apiKey:q,apiUrl:process.env.EMBD_API_URL});await Z(w).connect(new H),console.error("embd MCP server running on stdio")}A().catch((q)=>{console.error("embd MCP server failed to start:",q),process.exit(1)});
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{g as x}from"./bin-kp5d3tt5.js";import"./bin-q5p2211j.js";var j=Number(process.env.PORT??process.env.EMBD_MCP_PORT??8787),q=process.env.EMBD_MCP_HOST??"127.0.0.1",y=process.env.EMBD_MCP_PATH??"/mcp",C=process.env.EMBD_ORIGIN,z=(process.env.EMBD_MCP_ALLOWED_HOSTS??"").split(",").map((b)=>b.trim()).filter((b)=>b.length>0),A=x({origin:C,mcpPath:y,allowedHosts:z});A.listen(j,q,()=>{if(console.log(`embd MCP (stateless HTTP) listening on http://${q}:${j}${y}`),z.length===0)console.log("Note: DNS-rebinding protection is OFF. Set EMBD_MCP_ALLOWED_HOSTS if exposing this port directly.")});function B(b){console.log(`
3
+ embd MCP: received ${b}, shutting down.`),A.close(()=>process.exit(0)),setTimeout(()=>process.exit(0),5000).unref()}process.on("SIGINT",()=>B("SIGINT"));process.on("SIGTERM",()=>B("SIGTERM"));
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{a as C,b as i,c as s,d as m,e as E,f as y,g as S}from"./bin-kp5d3tt5.js";import{A as l,B as n,C as o,D as d,E as h,p as e,q as t,s as r,t as a,z as p}from"./bin-q5p2211j.js";export{m as handleQrUrl,n as handleListCharts,s as handleKpiUrl,i as handleDocUrl,o as handleDeleteChart,l as handleCreateDoc,p as handleCreateChart,C as handleChartUrl,r as friendlyErrorMessage,E as createStatelessServer,y as createRequestListener,S as createHttpServer,h as createEmbdServer,d as SERVER_VERSION,t as EmbdApiError,a as EmbdApiClient,e as DEFAULT_API_URL};
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@embd/mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server that lets AI agents turn tabular data into hosted, embeddable embd charts",
5
+ "type": "module",
6
+ "bin": {
7
+ "embd-mcp": "./dist/bin.js",
8
+ "embd-mcp-http": "./dist/http-bin.js"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/index.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "scripts": {
21
+ "typecheck": "tsc --noEmit -p tsconfig.json",
22
+ "lint": "eslint src",
23
+ "test": "bun test",
24
+ "build": "rm -rf ./dist && bun build src/bin.ts src/http-bin.ts src/index.ts --outdir dist --target node --splitting --minify",
25
+ "test:pack": "EXPECT_EXIT=1 ../../scripts/test-pack.sh packages/mcp embd-mcp",
26
+ "prepublishOnly": "bun run build && bun run test:pack"
27
+ },
28
+ "devDependencies": {
29
+ "@embd/core": "workspace:*",
30
+ "@modelcontextprotocol/sdk": "^1.29.0",
31
+ "@types/bun": "^1.3.5",
32
+ "zod": "^4.4.3"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/arthurpark/embd",
41
+ "directory": "packages/mcp"
42
+ },
43
+ "homepage": "https://www.embd.sh"
44
+ }