@lunora/mcp 1.0.0-alpha.239 → 1.0.0-alpha.240
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.d.mts
CHANGED
|
@@ -268,23 +268,6 @@ interface AuthedMcpFetchHandlerOptions {
|
|
|
268
268
|
* token denies instead of crashing the tool call.
|
|
269
269
|
*/
|
|
270
270
|
declare const mcpTokenScopes: (claims: McpAccessTokenClaims) => ReadonlySet<string>;
|
|
271
|
-
/**
|
|
272
|
-
* Build an OAuth-protected stateless Streamable-HTTP fetch handler for a Lunora
|
|
273
|
-
* MCP server.
|
|
274
|
-
*
|
|
275
|
-
* Unauthenticated requests never reach the MCP server at all: `protect` answers
|
|
276
|
-
* them with the RFC 9728 `WWW-Authenticate` challenge that starts the client's
|
|
277
|
-
* authorization flow. An authorized request builds a fresh proxy server from
|
|
278
|
-
* `server` (resolved against the verified claims) and serves it through
|
|
279
|
-
* {@link serveStateless}, exactly as the unprotected `createMcpFetchHandler`
|
|
280
|
-
* does — the transport behaviour is identical, only the gate is new.
|
|
281
|
-
*
|
|
282
|
-
* A fixed `server` object names one deployment, so its `LunoraClient` is
|
|
283
|
-
* resolved once and shared: the public-function registry memo in `./tools` is
|
|
284
|
-
* keyed by client identity and never hits when each request builds its own. The
|
|
285
|
-
* `(claims) => …` form is per-request by construction — the claims decide which
|
|
286
|
-
* deployment and token to use — so it keeps a client per request.
|
|
287
|
-
*/
|
|
288
271
|
declare const createAuthedMcpFetchHandler: (options: AuthedMcpFetchHandlerOptions) => McpFetchHandler;
|
|
289
272
|
/** {@link createMcpFetchHandler} options: the server's, plus this transport's body limit. */
|
|
290
273
|
interface McpFetchHandlerOptions extends LunoraMcpServerOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -268,23 +268,6 @@ interface AuthedMcpFetchHandlerOptions {
|
|
|
268
268
|
* token denies instead of crashing the tool call.
|
|
269
269
|
*/
|
|
270
270
|
declare const mcpTokenScopes: (claims: McpAccessTokenClaims) => ReadonlySet<string>;
|
|
271
|
-
/**
|
|
272
|
-
* Build an OAuth-protected stateless Streamable-HTTP fetch handler for a Lunora
|
|
273
|
-
* MCP server.
|
|
274
|
-
*
|
|
275
|
-
* Unauthenticated requests never reach the MCP server at all: `protect` answers
|
|
276
|
-
* them with the RFC 9728 `WWW-Authenticate` challenge that starts the client's
|
|
277
|
-
* authorization flow. An authorized request builds a fresh proxy server from
|
|
278
|
-
* `server` (resolved against the verified claims) and serves it through
|
|
279
|
-
* {@link serveStateless}, exactly as the unprotected `createMcpFetchHandler`
|
|
280
|
-
* does — the transport behaviour is identical, only the gate is new.
|
|
281
|
-
*
|
|
282
|
-
* A fixed `server` object names one deployment, so its `LunoraClient` is
|
|
283
|
-
* resolved once and shared: the public-function registry memo in `./tools` is
|
|
284
|
-
* keyed by client identity and never hits when each request builds its own. The
|
|
285
|
-
* `(claims) => …` form is per-request by construction — the claims decide which
|
|
286
|
-
* deployment and token to use — so it keeps a client per request.
|
|
287
|
-
*/
|
|
288
271
|
declare const createAuthedMcpFetchHandler: (options: AuthedMcpFetchHandlerOptions) => McpFetchHandler;
|
|
289
272
|
/** {@link createMcpFetchHandler} options: the server's, plus this transport's body limit. */
|
|
290
273
|
interface McpFetchHandlerOptions extends LunoraMcpServerOptions {
|
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-
|
|
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-DSTZ2ftz.mjs";import{createToolServer as l}from"./packem_shared/createToolServer-BtGuPyMU.mjs";import{createMcpFetchHandler as n}from"./packem_shared/createMcpFetchHandler-CNEfLA-N.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-DM_NJ-eY.mjs";import{createPaidMcpServer as M}from"./packem_shared/createPaidMcpServer-C_V1beyQ.mjs";import{connectStdio as i,createLunoraMcpServer as D}from"./packem_shared/connectStdio-n-RHjcwN.mjs";import{R as d,W as v,c as F,t as U}from"./packem_shared/tools-Dmnb3M2T.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 y}from"@lunora/errors";import{isAgentToolName as S}from"./AGENT_RUN_INPUT_SCHEMA-hKbpa3Dg.mjs";import{readScreenedBody as g,serveStateless as w}from"./DEFAULT_MAX_REQUEST_BYTES-CbbpkHRK.mjs";import{resolveClient as d,createLunoraMcpServer as T}from"./connectStdio-n-RHjcwN.mjs";import{c as M}from"./tool-call-Bs-QeKp6.mjs";import{a as E,s as _,S as k}from"./tools-Dmnb3M2T.mjs";const A=t=>typeof t.scope!="string"?new Set:new Set(t.scope.split(" ").filter(c=>c!=="")),C=(t,c)=>{const o={...t};for(const{flag:s,scope:n}of k)o[s]=t[s]===!0&&c.has(n);return o},I=(t,c,o)=>{const s=new Set,n=c.agents??[];for(const l of t){const e=M(l);if(e===void 0)continue;(E.has(e)||S(e,n))&&s.add(o);const r=_(e,c);r!==void 0&&s.add(r)}return s},N=256,B=t=>{const{maxRequestBytes:c,stepUp:o}=t;if(o!==void 0&&(typeof o.scope!="string"||o.scope===""||typeof o.challenge!="function"))throw new y("MCP_STEP_UP_MISCONFIGURED","createAuthedMcpFetchHandler: `stepUp` needs a non-empty `scope` and a `challenge` function.");const s=typeof t.server=="function"?void 0:d(t.server),n=new Map,l=e=>{if(e.client!==void 0||e.url===void 0||e.token===void 0||e.token.length===0)return d(e);const r=JSON.stringify([e.url,e.token]),i=n.get(r);if(i!==void 0&&i.fetch===e.fetch)return n.delete(r),n.set(r,i),i.client;const f=d(e);return n.delete(r),n.set(r,{client:f,fetch:e.fetch}),n.size>N&&n.delete(n.keys().next().value),f};return t.protect(async(e,r)=>{const i=A(r),f=typeof t.server=="function"?await t.server(r):{...t.server,client:s};let a;if(o!==void 0){const p=await g(e,c);if("response"in p)return p.response;({parsedBody:a}=p);const m=Array.isArray(a)?a:[a],u=[...I(m,f,o.scope)].filter(v=>!i.has(v));if(u.length>0)throw o.challenge(u)}const h=C(typeof t.server=="function"?{...f,client:l(f)}:f,i);return await w(T(h),e,{maxRequestBytes:c,parsedBody:a})})};export{B as createAuthedMcpFetchHandler,A as mcpTokenScopes};
|
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.240",
|
|
4
4
|
"description": "Model Context Protocol server exposing a Lunora deployment to AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@cfworker/json-schema": "^4.1.1",
|
|
57
|
-
"@lunora/client": "1.0.0-alpha.
|
|
57
|
+
"@lunora/client": "1.0.0-alpha.207",
|
|
58
58
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
59
|
-
"@lunora/shard-engine": "1.0.0-alpha.
|
|
59
|
+
"@lunora/shard-engine": "1.0.0-alpha.128",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.32.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as u}from"@lunora/errors";import{isAgentToolName as S}from"./AGENT_RUN_INPUT_SCHEMA-hKbpa3Dg.mjs";import{readScreenedBody as h,serveStateless as g}from"./DEFAULT_MAX_REQUEST_BYTES-CbbpkHRK.mjs";import{resolveClient as y,createLunoraMcpServer as v}from"./connectStdio-n-RHjcwN.mjs";import{c as w}from"./tool-call-Bs-QeKp6.mjs";import{S as T,a as A,s as E}from"./tools-Dmnb3M2T.mjs";const M=e=>typeof e.scope!="string"?new Set:new Set(e.scope.split(" ").filter(t=>t!=="")),_=(e,t)=>{const o={...e};for(const{flag:r,scope:n}of T)o[r]=e[r]===!0&&t.has(n);return o},C=(e,t,o)=>{const r=new Set,n=t.agents??[];for(const i of e){const s=w(i);if(s===void 0)continue;(A.has(s)||S(s,n))&&r.add(o);const c=E(s,t);c!==void 0&&r.add(c)}return r},I=e=>{const{maxRequestBytes:t,stepUp:o}=e;if(o!==void 0&&(typeof o.scope!="string"||o.scope===""||typeof o.challenge!="function"))throw new u("MCP_STEP_UP_MISCONFIGURED","createAuthedMcpFetchHandler: `stepUp` needs a non-empty `scope` and a `challenge` function.");const r=typeof e.server=="function"?void 0:y(e.server);return e.protect(async(n,i)=>{const s=M(i),c=typeof e.server=="function"?await e.server(i):{...e.server,client:r},d=_(c,s);let a;if(o!==void 0){const p=await h(n,t);if("response"in p)return p.response;({parsedBody:a}=p);const l=Array.isArray(a)?a:[a],f=[...C(l,c,o.scope)].filter(m=>!s.has(m));if(f.length>0)throw o.challenge(f)}return await g(v(d),n,{maxRequestBytes:t,parsedBody:a})})};export{I as createAuthedMcpFetchHandler,M as mcpTokenScopes};
|