@lunora/mcp 1.0.0-alpha.192 → 1.0.0-alpha.194
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/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AGENT_RUN_INPUT_SCHEMA as r,AGENT_STATUS_TOOL_NAME as t,agentToolDefinitions as c,callAgentTool as T,parseAgentsEnv as a}from"./packem_shared/AGENT_RUN_INPUT_SCHEMA-hKbpa3Dg.mjs";import{createAuthedMcpFetchHandler as S,mcpTokenScopes as _}from"./packem_shared/createAuthedMcpFetchHandler-Mfw8jlOV.mjs";import{createToolServer as l}from"./packem_shared/createToolServer-BtGuPyMU.mjs";import{createMcpFetchHandler as n}from"./packem_shared/createMcpFetchHandler-C5doZK5c.mjs";import{LOCAL_SERVER_NAME as N,NO_DEPLOYMENT_MESSAGE as s,connectLocalStdio as I,createLocalMcpServer as L,localTools as f}from"./packem_shared/LOCAL_SERVER_NAME-CYzrUsx9.mjs";import{createPaidMcpServer as M}from"./packem_shared/createPaidMcpServer-
|
|
1
|
+
import{AGENT_RUN_INPUT_SCHEMA as r,AGENT_STATUS_TOOL_NAME as t,agentToolDefinitions as c,callAgentTool as T,parseAgentsEnv as a}from"./packem_shared/AGENT_RUN_INPUT_SCHEMA-hKbpa3Dg.mjs";import{createAuthedMcpFetchHandler as S,mcpTokenScopes as _}from"./packem_shared/createAuthedMcpFetchHandler-Mfw8jlOV.mjs";import{createToolServer as l}from"./packem_shared/createToolServer-BtGuPyMU.mjs";import{createMcpFetchHandler as n}from"./packem_shared/createMcpFetchHandler-C5doZK5c.mjs";import{LOCAL_SERVER_NAME as N,NO_DEPLOYMENT_MESSAGE as s,connectLocalStdio as I,createLocalMcpServer as L,localTools as f}from"./packem_shared/LOCAL_SERVER_NAME-CYzrUsx9.mjs";import{createPaidMcpServer as M}from"./packem_shared/createPaidMcpServer-D9wuqrEz.mjs";import{connectStdio as i,createLunoraMcpServer as D}from"./packem_shared/connectStdio-CQI9JGJC.mjs";import{R as d,W as v,c as F,t as U}from"./packem_shared/tools-D-JWERWj.mjs";import{DEFAULT_MAX_REQUEST_BYTES as g,serveStateless as h}from"./packem_shared/DEFAULT_MAX_REQUEST_BYTES-CbbpkHRK.mjs";import{O as G}from"./packem_shared/observability-tools-D4Z8dGS-.mjs";export{r as AGENT_RUN_INPUT_SCHEMA,t as AGENT_STATUS_TOOL_NAME,g as DEFAULT_MAX_REQUEST_BYTES,N as LOCAL_SERVER_NAME,s as NO_DEPLOYMENT_MESSAGE,G as OBSERVABILITY_TOOL_DEFINITIONS,d as READ_ONLY_TOOL_DEFINITIONS,v as WRITE_TOOL_DEFINITIONS,c as agentToolDefinitions,T as callAgentTool,F as callTool,I as connectLocalStdio,i as connectStdio,S as createAuthedMcpFetchHandler,L as createLocalMcpServer,D as createLunoraMcpServer,n as createMcpFetchHandler,M as createPaidMcpServer,l as createToolServer,f as localTools,_ as mcpTokenScopes,a as parseAgentsEnv,h as serveStateless,U as toolDefinitions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as x}from"@lunora/errors";import{Server as E}from"@modelcontextprotocol/sdk/server/index.js";import{CallToolRequestSchema as B,ListToolsRequestSchema as A}from"@modelcontextprotocol/sdk/types.js";import{CfWorkerJsonSchemaValidator as b}from"@modelcontextprotocol/sdk/validation/cfworker";import{m as L}from"./promise-memo-OqVPWoUX.mjs";import{readScreenedBody as q,serveStateless as M}from"./DEFAULT_MAX_REQUEST_BYTES-CbbpkHRK.mjs";const H=new b,T=(t,a,o)=>{const i=t.validate(o);return i.valid?void 0:{content:[{text:`invalid arguments for tool "${a}": ${i.errorMessage}`,type:"text"}],isError:!0}},P=async()=>{try{return(await import("@lunora/x402/charge")).createChargeMiddleware}catch(t){throw new x("INTERNAL",`paid MCP tools need the optional peer "@lunora/x402" — install it alongside @lunora/mcp to charge for tools (${t instanceof Error?t.message:String(t)})`)}},_={name:"lunora-paid-mcp",version:"0.0.0"},N="tools/call",S=t=>{if(typeof t!="object"||t===null)return;const{method:a,params:o}=t;if(a!==N||typeof o!="object"||o===null)return;const{name:i}=o;return typeof i=="string"?i:void 0},O=()=>Response.json({error:"A JSON-RPC batch may not reference a paid MCP tool; send paid tools/call requests individually."},{status:400}),U=async(t,a,o,i,p)=>{const m={reached:!1},u=new E({name:"lunora-paid-mcp-preflight",version:"0.0.0"},{capabilities:{tools:{}}});u.setRequestHandler(B,f=>{const h=T(i,o,f.params.arguments??{});return m.reached=h===void 0&&f.params.name===o,h??{content:[]}});const v=await M(u,t,{maxRequestBytes:p,parsedBody:a});return m.reached?void 0:v},z=t=>{const a=new Map,o=new Map,i=new Map,p=t.serverInfo??_,m=(e,r,n)=>{if(a.has(e.name))throw new x("BAD_REQUEST",`MCP tool "${e.name}" is already registered.`);const s={description:e.description,inputSchema:e.inputSchema,name:e.name};e.annotations!==void 0&&(s.annotations=e.annotations),a.set(e.name,{definition:s,handler:r,validate:H.getValidator(s.inputSchema)}),n!==void 0&&o.set(e.name,n)},u=()=>{const e=new E(p,{capabilities:{tools:{}}});return e.setRequestHandler(A,()=>({tools:[...a.values()].map(r=>r.definition)})),e.setRequestHandler(B,async r=>{const n=a.get(r.params.name);if(n===void 0)return{content:[{text:`unknown tool: ${r.params.name}`,type:"text"}],isError:!0};const s=r.params.arguments??{},c=T(n,r.params.name,s);if(c!==void 0)return c;try{return await n.handler(s)}catch(d){return{content:[{text:d instanceof Error?d.message:String(d),type:"text"}],isError:!0}}}),e},v=(e,r)=>L(i,e,async()=>(await P())({...t.charge,price:r},{resource:e}));return{fetchHandler:async(e,r,n)=>{const s=await q(e.clone(),t.maxRequestBytes);if("response"in s)return s.response;const{parsedBody:c}=s,d=()=>M(u(),e,c===void 0?{maxRequestBytes:t.maxRequestBytes}:{maxRequestBytes:t.maxRequestBytes,parsedBody:c});if(Array.isArray(c))return c.some(y=>o.has(S(y)??""))?O():d();const l=S(c),w=l===void 0?void 0:o.get(l),R=l===void 0?void 0:a.get(l);if(l===void 0||w===void 0||R===void 0)return d();const g=await U(e,c,l,R,t.maxRequestBytes);if(g!==void 0)return g;const C=await v(l,w),j=typeof n?.waitUntil=="function"?{waitUntil:y=>{n.waitUntil?.(y)}}:void 0;return C.handle(e,d,j)},paidTool:(e,r)=>{m(e,r,e.price)},tool:(e,r)=>{m(e,r)}}};export{z as createPaidMcpServer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/mcp",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.194",
|
|
4
4
|
"description": "Model Context Protocol server exposing a Lunora deployment to AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@lunora/
|
|
56
|
+
"@cfworker/json-schema": "^4.1.1",
|
|
57
|
+
"@lunora/client": "1.0.0-alpha.158",
|
|
58
|
+
"@lunora/errors": "1.0.0-alpha.47",
|
|
58
59
|
"@lunora/shard-engine": "1.0.0-alpha.96",
|
|
59
60
|
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
60
61
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as y}from"@lunora/errors";import{Server as E}from"@modelcontextprotocol/sdk/server/index.js";import{ListToolsRequestSchema as T,CallToolRequestSchema as g}from"@modelcontextprotocol/sdk/types.js";import{m as x}from"./promise-memo-OqVPWoUX.mjs";import{readScreenedBody as B,serveStateless as M}from"./DEFAULT_MAX_REQUEST_BYTES-CbbpkHRK.mjs";const C=async()=>{try{return(await import("@lunora/x402/charge")).createChargeMiddleware}catch(t){throw new y("INTERNAL",`paid MCP tools need the optional peer "@lunora/x402" — install it alongside @lunora/mcp to charge for tools (${t instanceof Error?t.message:String(t)})`)}},A={name:"lunora-paid-mcp",version:"0.0.0"},L="tools/call",f=t=>{if(typeof t!="object"||t===null)return;const{method:s,params:a}=t;if(s!==L||typeof a!="object"||a===null)return;const{name:c}=a;return typeof c=="string"?c:void 0},q=()=>Response.json({error:"A JSON-RPC batch may not reference a paid MCP tool; send paid tools/call requests individually."},{status:400}),j=t=>{const s=new Map,a=new Map,c=new Map,h=t.serverInfo??A,u=(e,r,n)=>{if(s.has(e.name))throw new y("BAD_REQUEST",`MCP tool "${e.name}" is already registered.`);const o={description:e.description,inputSchema:e.inputSchema,name:e.name};e.annotations!==void 0&&(o.annotations=e.annotations),s.set(e.name,{definition:o,handler:r}),n!==void 0&&a.set(e.name,n)},v=()=>{const e=new E(h,{capabilities:{tools:{}}});return e.setRequestHandler(T,()=>({tools:[...s.values()].map(r=>r.definition)})),e.setRequestHandler(g,async r=>{const n=s.get(r.params.name);if(n===void 0)return{content:[{text:`unknown tool: ${r.params.name}`,type:"text"}],isError:!0};try{return await n.handler(r.params.arguments??{})}catch(o){return{content:[{text:o instanceof Error?o.message:String(o),type:"text"}],isError:!0}}}),e},w=(e,r)=>x(c,e,async()=>(await C())({...t.charge,price:r},{resource:e}));return{fetchHandler:async(e,r,n)=>{const o=await B(e.clone(),t.maxRequestBytes);if("response"in o)return o.response;const{parsedBody:i}=o,d=()=>M(v(),e,i===void 0?{maxRequestBytes:t.maxRequestBytes}:{maxRequestBytes:t.maxRequestBytes,parsedBody:i});if(Array.isArray(i))return i.some(m=>a.has(f(m)??""))?q():d();const l=f(i),p=l===void 0?void 0:a.get(l);if(l===void 0||p===void 0)return d();const R=await w(l,p),S=typeof n?.waitUntil=="function"?{waitUntil:m=>{n.waitUntil?.(m)}}:void 0;return R.handle(e,d,S)},paidTool:(e,r)=>{u(e,r,e.price)},tool:(e,r)=>{u(e,r)}}};export{j as createPaidMcpServer};
|