@cachly-dev/mcp-server 0.10.274 → 0.10.275

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.
@@ -1,2 +1,2 @@
1
- import{constants as y,createPublicKey as T,verify as m}from"node:crypto";const P="https://mcp.cachly.dev/mcp",x="https://auth.cachly.dev/realms/cachly",D=["profile","email"],O="https://cachly.dev/docs/remote-mcp",_="https://cachly.dev/instances",g="/.well-known/oauth-protected-resource";function k(e){return e.replace(/\/+$/,"")}function w(e,t){return(e??"").split(t).map(n=>n.trim()).filter(n=>n!=="")}function A(e,t){let n;try{n=new URL(t)}catch{throw new Error(`${e} ist keine URL: "${t}"`)}const s=n.hostname==="localhost"||n.hostname==="127.0.0.1"||n.hostname==="[::1]";if(n.protocol!=="https:"&&!(n.protocol==="http:"&&s))throw new Error(`${e} muss mit https:// beginnen (http nur fuer localhost): "${t}"`);if(n.search||n.hash)throw new Error(`${e} darf weder ? noch # enthalten: "${t}"`);return n}function J(e=process.env){const t=k(e.MCP_OAUTH_RESOURCE?.trim()||P),n=k(e.MCP_OAUTH_ISSUER?.trim()||x),s=A("MCP_OAUTH_RESOURCE",t);A("MCP_OAUTH_ISSUER",n);const r=w(e.MCP_OAUTH_AUDIENCE,/,/),i=e.MCP_OAUTH_JWKS_URL?.trim()??"";let c;i.toLowerCase()==="aus"||i.toLowerCase()==="off"?c=null:i?c=A("MCP_OAUTH_JWKS_URL",i).href:c=`${n}/protocol/openid-connect/certs`;const f=w(e.MCP_OAUTH_SCOPES,/[\s,]+/),u=f.length>0?f:[...D],o=s.pathname==="/"?"":s.pathname,a=o?[`${g}${o}`,g]:[g];return{resource:t,aussteller:n,zielgruppen:r.length>0?r:[t],jwksUrl:c,scopes:u,metadatenUrl:`${s.origin}${a[0]}`,metadatenPfade:a}}function G(e){return{resource:e.resource,authorization_servers:[e.aussteller],bearer_methods_supported:["header"],...e.scopes.length>0?{scopes_supported:[...e.scopes]}:{},resource_name:"cachly",resource_documentation:O}}function v(e,t,n){const s=['Bearer realm="cachly"'];return t&&s.push(`error="${t}"`),t&&n&&s.push(`error_description="${n.replace(/[^\x20-\x7e]|"/g,"")}"`),s.push(`resource_metadata="${e.metadatenUrl}"`),e.scopes.length>0&&s.push(`scope="${e.scopes.join(" ")}"`),s.join(", ")}const W="Authentication required for this tool",Z=4*1024*1024;function V(e){return(Array.isArray(e)?e:[e]).some(n=>!!n&&typeof n=="object"&&n.method==="tools/call")}const C=/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/;function M(e){return C.test(e)}function E(e){try{const t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}function $(e){if(!M(e))return;const[t,n,s]=e.split("."),r=E(t),i=E(n);if(!(!r||!i))return{kopf:r,ansprueche:i,signiert:`${t}.${n}`,unterschrift:Buffer.from(s,"base64url")}}const U=30;function j(e,t,n){if(e.iss!==t.aussteller)return{fehler:"aussteller"};if(typeof e.exp!="number"||!Number.isFinite(e.exp))return{fehler:"form"};if(e.exp*1e3+U*1e3<=n)return{fehler:"abgelaufen"};if(typeof e.nbf=="number"&&e.nbf*1e3-U*1e3>n)return{fehler:"noch-nicht-gueltig"};const s=typeof e.aud=="string"?[e.aud]:Array.isArray(e.aud)?e.aud.filter(r=>typeof r=="string"):[];return t.zielgruppen.length>0&&!s.some(r=>t.zielgruppen.includes(r))?{fehler:"zielgruppe"}:typeof e.typ=="string"&&e.typ.toLowerCase()!=="bearer"?{fehler:"typ"}:typeof e.sub!="string"||e.sub===""?{fehler:"inhaber"}:{sub:e.sub,iss:e.iss,bisMs:e.exp*1e3}}function L(e){switch(e){case"aussteller":return"Das Token stammt nicht vom cachly-Anmeldedienst.";case"abgelaufen":return"Die Anmeldung ist abgelaufen. Bitte neu anmelden.";case"noch-nicht-gueltig":return"Das Token ist noch nicht gueltig (Uhrzeit pruefen).";case"zielgruppe":return"Das Token ist nicht fuer diesen MCP-Server ausgestellt (Zielgruppe passt nicht).";case"typ":return"Das ist kein Zugangstoken.";case"inhaber":return"Dem Token fehlt der Inhaber.";case"algorithmus":return"Das Token ist mit einem nicht erlaubten Verfahren unterschrieben.";case"schluessel-unbekannt":return"Der Schluessel, mit dem das Token unterschrieben ist, ist unbekannt.";case"unterschrift":return"Die Unterschrift des Tokens ist ungueltig.";case"jwks-fehlt":return"Der cachly-Anmeldedienst ist gerade nicht erreichbar. Bitte gleich noch einmal versuchen.";default:return"Das Token hat keine gueltige Form."}}class l extends Error{grund;constructor(t){super(L(t)),this.grund=t,this.name="TokenAbgelehnt"}}const b={RS256:{familie:"RS",hash:"sha256"},RS384:{familie:"RS",hash:"sha384"},RS512:{familie:"RS",hash:"sha512"},PS256:{familie:"PS",hash:"sha256"},PS384:{familie:"PS",hash:"sha384"},PS512:{familie:"PS",hash:"sha512"},ES256:{familie:"ES",hash:"sha256"},ES384:{familie:"ES",hash:"sha384"},ES512:{familie:"ES",hash:"sha512"}};function N(e,t,n,s){const r=b[e];if(!r)return!1;const i=t.asymmetricKeyType,c=Buffer.from(n,"utf8");try{return r.familie==="RS"?i==="rsa"&&m(r.hash,c,t,s):r.familie==="PS"?(i==="rsa"||i==="rsa-pss")&&m(r.hash,c,{key:t,padding:y.RSA_PKCS1_PSS_PADDING,saltLength:y.RSA_PSS_SALTLEN_DIGEST},s):i==="ec"&&m(r.hash,c,{key:t,dsaEncoding:"ieee-p1363"},s)}catch{return!1}}const H=10*6e4,B=3e4;function z(e){const t=e?.keys;if(!Array.isArray(t))return[];const n=[];for(const s of t)if(!(!s||typeof s!="object")&&!(s.use!==void 0&&s.use!=="sig")&&!(s.kty!=="RSA"&&s.kty!=="EC"))try{const r=T({key:s,format:"jwk"});n.push({kid:typeof s.kid=="string"?s.kid:void 0,alg:typeof s.alg=="string"?s.alg:void 0,schluessel:r})}catch{}return n}function X(e,t){const n=t?.jetzt??Date.now,s=t?.abruf??(async u=>{const o=await fetch(u,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return{status:o.status,body:o.ok?await o.json().catch(()=>null):null}});let r,i;const c=()=>{if(!e.jwksUrl)return Promise.resolve([]);if(!i){const u=e.jwksUrl;i=s(u).then(o=>{const a=o.status===200?z(o.body):[];if(a.length===0)throw new l("jwks-fehlt");return r={schluessel:a,um:n()},a}).catch(o=>{throw o instanceof l?o:new l("jwks-fehlt")}).finally(()=>{i=void 0})}return i},f=(u,o,a)=>u.find(h=>(o===void 0||h.kid===o)&&(h.alg===void 0||h.alg===a));return{async pruefe(u){const o=$(u);if(!o)throw new l("form");const a=j(o.ansprueche,e,n());if("fehler"in a)throw new l(a.fehler);if(!e.jwksUrl)return a;const h=typeof o.kopf.alg=="string"?o.kopf.alg:"";if(!b[h])throw new l("algorithmus");const d=typeof o.kopf.kid=="string"?o.kopf.kid:void 0,S=r&&n()-r.um<H;let p=S?f(r.schluessel,d,h):void 0;if(!p&&(!r||!S||n()-r.um>=B))try{p=f(await c(),d,h)}catch(R){if(p=r?f(r.schluessel,d,h):void 0,!p)throw R}if(!p)throw new l("schluessel-unbekannt");if(!N(h,p.schluessel,o.signiert,o.unterschrift))throw new l("unterschrift");return a}}}const I=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function q(e){const t=e?.data;if(!Array.isArray(t))return"";const n=r=>{const i=typeof r=="string"?Date.parse(r):NaN;return Number.isFinite(i)?i:-1/0};return t.filter(r=>r&&typeof r.id=="string"&&I.test(r.id)&&r.status==="running").map(r=>({id:r.id.toLowerCase(),t:n(r.created_at)})).sort((r,i)=>i.t-r.t||(r.id<i.id?-1:r.id>i.id?1:0))[0]?.id??""}const Y=["Zu deinem cachly-Konto gehoert noch kein laufendes Brain.",`Lege eines an oder starte es im Dashboard: ${_}`,"Danach geht es hier ohne neue Anmeldung weiter (spaetestens nach einer Minute).","","Your cachly account has no running Brain yet.",`Create or start one in the dashboard: ${_}`].join(`
1
+ import{constants as S,createPublicKey as T,verify as m}from"node:crypto";const P="https://mcp.cachly.dev/mcp",x="https://auth.cachly.dev/realms/cachly",D=["profile","email","cachly-mcp"],O="https://cachly.dev/docs/remote-mcp",_="https://cachly.dev/instances",g="/.well-known/oauth-protected-resource";function k(e){return e.replace(/\/+$/,"")}function w(e,t){return(e??"").split(t).map(n=>n.trim()).filter(n=>n!=="")}function y(e,t){let n;try{n=new URL(t)}catch{throw new Error(`${e} ist keine URL: "${t}"`)}const s=n.hostname==="localhost"||n.hostname==="127.0.0.1"||n.hostname==="[::1]";if(n.protocol!=="https:"&&!(n.protocol==="http:"&&s))throw new Error(`${e} muss mit https:// beginnen (http nur fuer localhost): "${t}"`);if(n.search||n.hash)throw new Error(`${e} darf weder ? noch # enthalten: "${t}"`);return n}function J(e=process.env){const t=k(e.MCP_OAUTH_RESOURCE?.trim()||P),n=k(e.MCP_OAUTH_ISSUER?.trim()||x),s=y("MCP_OAUTH_RESOURCE",t);y("MCP_OAUTH_ISSUER",n);const r=w(e.MCP_OAUTH_AUDIENCE,/,/),i=e.MCP_OAUTH_JWKS_URL?.trim()??"";let c;i.toLowerCase()==="aus"||i.toLowerCase()==="off"?c=null:i?c=y("MCP_OAUTH_JWKS_URL",i).href:c=`${n}/protocol/openid-connect/certs`;const f=w(e.MCP_OAUTH_SCOPES,/[\s,]+/),u=f.length>0?f:[...D],o=s.pathname==="/"?"":s.pathname,a=o?[`${g}${o}`,g]:[g];return{resource:t,aussteller:n,zielgruppen:r.length>0?r:[t],jwksUrl:c,scopes:u,metadatenUrl:`${s.origin}${a[0]}`,metadatenPfade:a}}function G(e){return{resource:e.resource,authorization_servers:[e.aussteller],bearer_methods_supported:["header"],...e.scopes.length>0?{scopes_supported:[...e.scopes]}:{},resource_name:"cachly",resource_documentation:O}}function v(e,t,n){const s=['Bearer realm="cachly"'];return t&&s.push(`error="${t}"`),t&&n&&s.push(`error_description="${n.replace(/[^\x20-\x7e]|"/g,"")}"`),s.push(`resource_metadata="${e.metadatenUrl}"`),e.scopes.length>0&&s.push(`scope="${e.scopes.join(" ")}"`),s.join(", ")}const W="Authentication required for this tool",Z=4*1024*1024;function V(e){return(Array.isArray(e)?e:[e]).some(n=>!!n&&typeof n=="object"&&n.method==="tools/call")}const C=/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/;function M(e){return C.test(e)}function E(e){try{const t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}function $(e){if(!M(e))return;const[t,n,s]=e.split("."),r=E(t),i=E(n);if(!(!r||!i))return{kopf:r,ansprueche:i,signiert:`${t}.${n}`,unterschrift:Buffer.from(s,"base64url")}}const U=30;function j(e,t,n){if(e.iss!==t.aussteller)return{fehler:"aussteller"};if(typeof e.exp!="number"||!Number.isFinite(e.exp))return{fehler:"form"};if(e.exp*1e3+U*1e3<=n)return{fehler:"abgelaufen"};if(typeof e.nbf=="number"&&e.nbf*1e3-U*1e3>n)return{fehler:"noch-nicht-gueltig"};const s=typeof e.aud=="string"?[e.aud]:Array.isArray(e.aud)?e.aud.filter(r=>typeof r=="string"):[];return t.zielgruppen.length>0&&!s.some(r=>t.zielgruppen.includes(r))?{fehler:"zielgruppe"}:typeof e.typ=="string"&&e.typ.toLowerCase()!=="bearer"?{fehler:"typ"}:typeof e.sub!="string"||e.sub===""?{fehler:"inhaber"}:{sub:e.sub,iss:e.iss,bisMs:e.exp*1e3}}function L(e){switch(e){case"aussteller":return"Das Token stammt nicht vom cachly-Anmeldedienst.";case"abgelaufen":return"Die Anmeldung ist abgelaufen. Bitte neu anmelden.";case"noch-nicht-gueltig":return"Das Token ist noch nicht gueltig (Uhrzeit pruefen).";case"zielgruppe":return"Das Token ist nicht fuer diesen MCP-Server ausgestellt (Zielgruppe passt nicht).";case"typ":return"Das ist kein Zugangstoken.";case"inhaber":return"Dem Token fehlt der Inhaber.";case"algorithmus":return"Das Token ist mit einem nicht erlaubten Verfahren unterschrieben.";case"schluessel-unbekannt":return"Der Schluessel, mit dem das Token unterschrieben ist, ist unbekannt.";case"unterschrift":return"Die Unterschrift des Tokens ist ungueltig.";case"jwks-fehlt":return"Der cachly-Anmeldedienst ist gerade nicht erreichbar. Bitte gleich noch einmal versuchen.";default:return"Das Token hat keine gueltige Form."}}class l extends Error{grund;constructor(t){super(L(t)),this.grund=t,this.name="TokenAbgelehnt"}}const b={RS256:{familie:"RS",hash:"sha256"},RS384:{familie:"RS",hash:"sha384"},RS512:{familie:"RS",hash:"sha512"},PS256:{familie:"PS",hash:"sha256"},PS384:{familie:"PS",hash:"sha384"},PS512:{familie:"PS",hash:"sha512"},ES256:{familie:"ES",hash:"sha256"},ES384:{familie:"ES",hash:"sha384"},ES512:{familie:"ES",hash:"sha512"}};function N(e,t,n,s){const r=b[e];if(!r)return!1;const i=t.asymmetricKeyType,c=Buffer.from(n,"utf8");try{return r.familie==="RS"?i==="rsa"&&m(r.hash,c,t,s):r.familie==="PS"?(i==="rsa"||i==="rsa-pss")&&m(r.hash,c,{key:t,padding:S.RSA_PKCS1_PSS_PADDING,saltLength:S.RSA_PSS_SALTLEN_DIGEST},s):i==="ec"&&m(r.hash,c,{key:t,dsaEncoding:"ieee-p1363"},s)}catch{return!1}}const H=10*6e4,B=3e4;function z(e){const t=e?.keys;if(!Array.isArray(t))return[];const n=[];for(const s of t)if(!(!s||typeof s!="object")&&!(s.use!==void 0&&s.use!=="sig")&&!(s.kty!=="RSA"&&s.kty!=="EC"))try{const r=T({key:s,format:"jwk"});n.push({kid:typeof s.kid=="string"?s.kid:void 0,alg:typeof s.alg=="string"?s.alg:void 0,schluessel:r})}catch{}return n}function X(e,t){const n=t?.jetzt??Date.now,s=t?.abruf??(async u=>{const o=await fetch(u,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return{status:o.status,body:o.ok?await o.json().catch(()=>null):null}});let r,i;const c=()=>{if(!e.jwksUrl)return Promise.resolve([]);if(!i){const u=e.jwksUrl;i=s(u).then(o=>{const a=o.status===200?z(o.body):[];if(a.length===0)throw new l("jwks-fehlt");return r={schluessel:a,um:n()},a}).catch(o=>{throw o instanceof l?o:new l("jwks-fehlt")}).finally(()=>{i=void 0})}return i},f=(u,o,a)=>u.find(h=>(o===void 0||h.kid===o)&&(h.alg===void 0||h.alg===a));return{async pruefe(u){const o=$(u);if(!o)throw new l("form");const a=j(o.ansprueche,e,n());if("fehler"in a)throw new l(a.fehler);if(!e.jwksUrl)return a;const h=typeof o.kopf.alg=="string"?o.kopf.alg:"";if(!b[h])throw new l("algorithmus");const d=typeof o.kopf.kid=="string"?o.kopf.kid:void 0,A=r&&n()-r.um<H;let p=A?f(r.schluessel,d,h):void 0;if(!p&&(!r||!A||n()-r.um>=B))try{p=f(await c(),d,h)}catch(R){if(p=r?f(r.schluessel,d,h):void 0,!p)throw R}if(!p)throw new l("schluessel-unbekannt");if(!N(h,p.schluessel,o.signiert,o.unterschrift))throw new l("unterschrift");return a}}}const I=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function q(e){const t=e?.data;if(!Array.isArray(t))return"";const n=r=>{const i=typeof r=="string"?Date.parse(r):NaN;return Number.isFinite(i)?i:-1/0};return t.filter(r=>r&&typeof r.id=="string"&&I.test(r.id)&&r.status==="running").map(r=>({id:r.id.toLowerCase(),t:n(r.created_at)})).sort((r,i)=>i.t-r.t||(r.id<i.id?-1:r.id>i.id?1:0))[0]?.id??""}const Y=["Zu deinem cachly-Konto gehoert noch kein laufendes Brain.",`Lege eines an oder starte es im Dashboard: ${_}`,"Danach geht es hier ohne neue Anmeldung weiter (spaetestens nach einer Minute).","","Your cachly account has no running Brain yet.",`Create or start one in the dashboard: ${_}`].join(`
2
2
  `);export{_ as DASHBOARD_URL,B as JWKS_MINDESTABSTAND_MS,H as JWKS_TTL_MS,Y as KEIN_BRAIN_TEXT,Z as MAX_RUMPF_OHNE_ANMELDUNG,O as OAUTH_DOKU,x as OAUTH_VORGABE_ISSUER,P as OAUTH_VORGABE_RESOURCE,D as OAUTH_VORGABE_SCOPES,l as TokenAbgelehnt,U as UHR_SPIELRAUM_S,W as WERKZEUG_BRAUCHT_ANMELDUNG,X as baueJwtPruefer,V as brauchtAnmeldung,J as leseOAuthEinstellungen,j as pruefeAnsprueche,G as schutzMetadaten,M as siehtAusWieJwt,L as tokenFehlerText,N as unterschriftStimmt,q as waehleStandardBrain,v as wwwAuthenticate,$ as zerlegeJwt};
package/glama.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://glama.ai/mcp/schemas/server.json",
3
- "version": "0.10.274",
3
+ "version": "0.10.275",
4
4
  "maintainers": [
5
5
  "HeinrichNebula"
6
6
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cachly-dev/mcp-server",
3
- "version": "0.10.274",
3
+ "version": "0.10.275",
4
4
  "mcpName": "io.github.cachly-dev/mcp-server",
5
5
  "description": "Explain it once. Every AI knows it. cachly keeps the rules, decisions and fixes you explain to your AI and gives them back in every session: Claude Code, Cursor, Copilot, Windsurf, Codex, Gemini CLI. Hosted in the EU.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -17,12 +17,12 @@
17
17
  "url": "https://github.com/cachly-dev/cachly-mcp",
18
18
  "source": "github"
19
19
  },
20
- "version": "0.10.274",
20
+ "version": "0.10.275",
21
21
  "packages": [
22
22
  {
23
23
  "registryType": "npm",
24
24
  "identifier": "@cachly-dev/mcp-server",
25
- "version": "0.10.274",
25
+ "version": "0.10.275",
26
26
  "runtimeHint": "npx",
27
27
  "transport": {
28
28
  "type": "stdio"