@aventurevc/mcp-server 0.8.241 → 0.8.243
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/chunks/{help-intent-CZK7m6cb.js → help-intent-DE_MNIOk.js} +1 -1
- package/dist/chunks/{oauth-discovery-D_QBfJfP.js → oauth-discovery-DILQ7XGM.js} +1 -1
- package/dist/chunks/{openapi-call-DJLjfU5a.js → openapi-call-BTx6xvJD.js} +1 -1
- package/dist/chunks/{openapi-snapshot-DxZhAXyC.js → openapi-snapshot-DWM-Vsry.js} +1 -1
- package/dist/chunks/{streamable-http-DjuwTKHJ.js → streamable-http-DknI9ft1.js} +1 -1
- package/dist/mcp-server/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./result-envelope-DXFbrrkt.js";import{V as r,c as i,m as a,n as o}from"./tool-policy-NTXy68a8.js";import{t as s}from"./openapi-snapshot-
|
|
1
|
+
import{c as e,i as t,r as n}from"./result-envelope-DXFbrrkt.js";import{V as r,c as i,m as a,n as o}from"./tool-policy-NTXy68a8.js";import{t as s}from"./openapi-snapshot-DWM-Vsry.js";import{C as c,D as l,E as u,S as d,T as f,c as p,i as m,l as h,n as g,o as _,r as v,s as y,t as b,u as x,w as S}from"./help-catalog-tM-2mFr2.js";var C=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,w=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,T=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,E=250,D=40,O=100;function k(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(w,()=>(n.add(`uuid`),` `)).replace(C,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).replace(/[?#].*$/su,``).split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&T.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=T.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function A(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function j(e,t){let n=new Set;for(let r of e){let e=new Set;d(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function M(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(f(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>A(t,e,n.path))&&(i+=E,r.has(t)&&(i+=D));if(i===0)return 0;let a=new Set(f(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return d(t,e),[...t].some(e=>a.has(e))}))&&(i+=O),i}var N=40,P=4,F=3,I=1,L=new Map,R=new WeakMap;function z(e){let t=L.get(e);if(t!==void 0)return t;let n=s(),i=r(n.paths,e),o=i===null?new Map:a(n,i.operation.responses,F);return L.set(e,o),o}function B(e,t,n){let r=0,i=V(n);for(let[e,i]of n)t.has(e.toLowerCase())&&(r+=N*(4-i)/4);for(let t of e){let e=Math.min(...[...t].map(e=>i.get(e)??1/0));e<=I&&(r+=P*(2-e))}return r}function V(e){let t=R.get(e);if(t!==void 0)return t;let n=new Map;for(let[t,r]of e){if(r>I)continue;let e=new Set;for(let n of f(t))d(e,n);for(let t of e)n.set(t,Math.min(n.get(t)??r,r))}return R.set(e,n),n}var H=5,U=.5,W=15,G=30,K=2,ee=100,q=.5;function J(e,t,n){if(e.trim().length===0)return t.map(e=>({item:e,score:1}));let r=t.map(e=>({item:e,fields:n(e)})),i=k(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=j(i.urlPathWord,r.map(({fields:e})=>e)),o=u(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=S(o),c=l(o),d=new Set(i.text.toLowerCase().split(/[^a-z0-9]+/u));return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:$({normalizedQuery:o,tokens:s,termForm:c,queryWord:d},t))+M(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}var Y=new WeakMap;function X(e){let t=Y.get(e);if(t!==void 0)return t;let n=e.requestBody??[],r=[...e.parameter,...n.flatMap(e=>e.parameter)],i={...e,cliPath:e.projection.cliPath,enumParameter:r.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:r.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...r,...n].map(({description:e})=>e),responseFieldLevel:z(e.operationId)};return Y.set(e,i),i}function Z(n,r){let i=n.q?.trim()??``,a=J(i,r.filter(e=>Q(n,e)&&(i.length>0||e.deprecated!==!0)),X),o=(a[0]?.score??0)*U,s=a.filter(({score:e})=>e>=o),c=n.limit===void 0||!Number.isFinite(n.limit)?H:n.limit,l=Math.min(s.length,Math.max(0,Math.trunc(c))),u=s.slice(0,l).map(({item:e})=>e),d={totalOperations:r.length,matched:s.length,returned:u.length},f=u.length===1,m=u.map(e=>y(e,f)),g=e(b,m,{counts:d}),_=t(g),v=f?u.map(h):u.map(p);return{summary:b,data:_?m:v,counts:d}}function Q(e,t){let{root:n}=e;return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function $({normalizedQuery:e,tokens:t,termForm:n,queryWord:r},a){let o=oe(a),s=ie(a),l=0;o.some(t=>t===e)&&(l+=100),o.some(t=>t.includes(e))&&(l+=40),l+=ae(e,o);let p=new Set(o.flatMap(f)),m=new Set(s.flatMap(f));for(let e of t)o.some(t=>t===e)?l+=20:m.has(e)?l+=8:p.has(e)&&(l+=K);for(let e of a.cliPath){let n=new Set;d(n,e),[...n].some(e=>t.has(e))&&(l+=W)}c(n,s)&&(l+=200),n.length>1&&s.some(t=>t.includes(e))&&(l+=ee),a.parameterName.some(t=>u(t)===e)&&(l+=G);let h=new Set(a.parameterDescription.flatMap(f));for(let e of t)h.has(e)&&(l+=K);return l+=ce(t,a.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(a.operationId)&&(l+=30),l+=B(n,r,a.responseFieldLevel),l-=se(e,t,a.description),i(a.intent)&&!re(r)?l*q:l}var te=`edit change set fix rename link unlink mark publish correct`.split(` `),ne=new Set([...Object.entries(o).filter(([,e])=>i(e)).map(([e])=>e),...te]);function re(e){return[...e].some(e=>ne.has(e))}function ie(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(u).filter(e=>e.length>0)}function ae(e,t){let n=f(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function oe(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,(g(e.description).useFor||e.description).slice(0,240)].map(u).filter(e=>e.length>0))]}function se(e,t,n){let r=u(g(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(f(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function ce(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>le(e,t))&&(n+=i?40:10);return n}function le(e,t){let n=f(t);return n.length>0&&n.every(t=>e.has(t))}function ue(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function de(t,r,i,a){let o=t.q?.trim()??``;if(o.length===0)return n(`Provide q to resolve a request to one operation.`);let s=i.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(s===void 0)return n(`This build ships no help resolve operation.`);let c=await a(s,{body:{question:o,resolve:!0,...t.scope===void 0?{}:{scope:t.scope===`read`?`READ`:`WRITE`}}});if(!c.ok)return{...c,data:null};let l=x.safeParse(ue(c));if(!l.success||l.data.resolution==null)return n(`The help resolve operation returned no resolution.`,c.warnings,{httpStatus:c.httpStatus});let{answer:u,resolution:d}=l.data,f=e=>r.find(t=>t.operationId===e),p=f(d.operationId),h=d.taskPlan??void 0,g=(h?.step??[]).map(({step:e})=>({step:e,contract:f(e.operationId)})),y=[...new Set([...d.operationId!=null&&p===void 0?[d.operationId]:[],...g.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return y.some(e=>!i.some(t=>t.operationId===e))?n(`No operation on this connection answers that request.`):e(y.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${y.join(`, `)}.`,{outcome:d.outcome,probability:d.probability,answer:u,candidate:d.candidate.filter(({sourceId:e})=>i.some(({operationId:t})=>t===e)).map(({sourceId:e})=>{let t=f(e);return t===void 0?{sourceId:e}:Object.assign({sourceId:e},m(t))}),...p===void 0?{}:{operation:{operationId:p.operationId,apiRoute:`${p.method} ${p.path}`,...v(p),...m(p)}},...(d.taskKey,{}),...h===void 0?{}:{taskPlan:{input:h.input,step:g.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{instruction:n,operationId:r}:{instruction:n,mcpCall:_(e)})}}},{warnings:y.map(e=>i.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}export{z as a,de as i,J as n,Z as r,X as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./env-CpA6E7ay.js";import{w as t}from"./tool-policy-NTXy68a8.js";import{a as n,o as r,t as i}from"./logging-BHp-5JwI.js";import{c as a,r as o}from"./openapi-call-
|
|
1
|
+
import{f as e}from"./env-CpA6E7ay.js";import{w as t}from"./tool-policy-NTXy68a8.js";import{a as n,o as r,t as i}from"./logging-BHp-5JwI.js";import{c as a,r as o}from"./openapi-call-BTx6xvJD.js";import{t as s}from"./provider-catalog-k5VPfOoO.js";var c=5e3;function l(){let e,t;return async()=>(e===void 0&&(e=await(t??=u().finally(()=>{t=void 0}))),e)}async function u(){let l=`getAuthProviderCatalog`,u=await a(e(),{method:`GET`,path:o(l,{}),headers:{},operationId:l,timeoutMs:c},s).catch(e=>{r({component:`aventure-mcp-server`,event:`oauth_catalog_unavailable`,message:i(e),fields:{requestId:t()},error:e})});if(u===void 0)return;if(!u.ok||u.redirect){r({component:`aventure-mcp-server`,event:`oauth_catalog_unavailable`,message:`the API did not return an OAuth provider catalog`,fields:{requestId:t()}});return}let d=u.data.oauthClient;if(d==null){r({component:`aventure-mcp-server`,event:`oauth_discovery_disabled`,message:`the API published no OAuth client; retrying on the next request that needs one`,fields:{requestId:t()}});return}let f=d.mcpResource;if(f==null){r({component:`aventure-mcp-server`,event:`oauth_discovery_disabled`,message:`the API published an OAuth client without an MCP resource indicator, so this server has no resource to advertise or audience to verify; retrying on the next request that needs one`,fields:{requestId:t()}});return}if(!URL.canParse(f)){r({component:`aventure-mcp-server`,event:`oauth_discovery_disabled`,message:`the API published an unusable MCP resource indicator: ${f}`,fields:{requestId:t()}});return}let p=new URL(f);return n({component:`aventure-mcp-server`,event:`oauth_discovery_ready`,fields:{requestId:t(),resource:p.href,authorizationServer:d.authorizationServer}}),{client:d,resourceUrl:p}}export{l as catalogOAuthDiscovery};
|