@aborruso/ckan-mcp-server 0.4.22 → 0.4.24
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/LOG.md +31 -0
- package/README.md +2 -1
- package/dist/index.js +4 -2
- package/dist/worker.js +5 -5
- package/package.json +1 -1
package/LOG.md
CHANGED
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
# LOG
|
|
2
2
|
|
|
3
|
+
## 2026-01-28
|
|
4
|
+
|
|
5
|
+
### Release v0.4.24
|
|
6
|
+
|
|
7
|
+
- Use browser-like headers (UA + Sec-* + Referer) to avoid WAF blocks on some portals
|
|
8
|
+
- Deps: npm audit fix (hono transitive)
|
|
9
|
+
- Files: `src/utils/http.ts`, `tests/unit/http.test.ts`, `src/server.ts`, `src/worker.ts`, `package.json`, `package-lock.json`, `README.md`
|
|
10
|
+
|
|
11
|
+
## 2026-01-27
|
|
12
|
+
|
|
13
|
+
### MCP Best Practices Evaluation
|
|
14
|
+
|
|
15
|
+
- **Source**: https://www.philschmid.de/mcp-best-practices
|
|
16
|
+
- **Score**: 4/6 (B+ grade)
|
|
17
|
+
- **Doc**: `docs/mcp-best-practices-evaluation.md`
|
|
18
|
+
- **Key findings**:
|
|
19
|
+
- ✅ Excellent: Tool naming, flat arguments
|
|
20
|
+
- ✅ Good: Instructions as context
|
|
21
|
+
- ⚠️ Partial: Outcomes focus, curation, pagination metadata
|
|
22
|
+
- **Top recommendations**:
|
|
23
|
+
1. Add structured pagination metadata to all responses
|
|
24
|
+
2. Create outcome-focused tools (discover_datasets, find_organization)
|
|
25
|
+
3. Improve tool categorization (beginner/advanced/expert)
|
|
26
|
+
- **Extracted with**: `agent-browser get text 'article'` (readability-like)
|
|
27
|
+
|
|
3
28
|
## 2026-01-26
|
|
4
29
|
|
|
30
|
+
### Release v0.4.23
|
|
31
|
+
|
|
32
|
+
- Fix MQA quality score maximum from 450 to 405 (correct max: 100+100+110+75+20)
|
|
33
|
+
- Files modified: `src/tools/quality.ts:442`, `tests/integration/quality.test.ts:279,302`
|
|
34
|
+
|
|
5
35
|
### Release v0.4.22
|
|
6
36
|
|
|
7
37
|
- Fix MQA identifier normalization to handle dot separators (e.g. `c_g273:D.1727` -> `c_g273-d-1727`)
|
|
38
|
+
- Workers deploy: https://ckan-mcp-server.andy-pr.workers.dev (2026-01-26)
|
|
8
39
|
|
|
9
40
|
### Release v0.4.21
|
|
10
41
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ MCP (Model Context Protocol) server for interacting with CKAN-based open data po
|
|
|
17
17
|
- ⚡ Pagination and faceting support
|
|
18
18
|
- 📄 MCP Resource Templates for direct data access
|
|
19
19
|
- 🧭 Guided MCP prompts for common workflows
|
|
20
|
-
-
|
|
20
|
+
- 🛡️ Browser-like headers to avoid WAF blocks
|
|
21
|
+
- 🧪 Test suite with 214 tests (100% passing)
|
|
21
22
|
|
|
22
23
|
---
|
|
23
24
|
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ async function makeCkanRequest(serverUrl, action, params = {}) {
|
|
|
26
26
|
params,
|
|
27
27
|
timeout: 3e4,
|
|
28
28
|
headers: {
|
|
29
|
+
Accept: "application/json, text/plain, */*",
|
|
30
|
+
"Accept-Language": "en-US,en;q=0.9,it;q=0.8",
|
|
29
31
|
"User-Agent": "CKAN-MCP-Server/1.0"
|
|
30
32
|
}
|
|
31
33
|
});
|
|
@@ -2402,7 +2404,7 @@ function formatQualityMarkdown(data, datasetId) {
|
|
|
2402
2404
|
lines.push(`# Quality Metrics for Dataset: ${datasetId}`);
|
|
2403
2405
|
lines.push("");
|
|
2404
2406
|
if (normalized.info?.score !== void 0) {
|
|
2405
|
-
lines.push(`**Overall Score**: ${normalized.info.score}/
|
|
2407
|
+
lines.push(`**Overall Score**: ${normalized.info.score}/405`);
|
|
2406
2408
|
lines.push("");
|
|
2407
2409
|
}
|
|
2408
2410
|
if (normalized.breakdown?.scores) {
|
|
@@ -3047,7 +3049,7 @@ var registerAllPrompts = (server2) => {
|
|
|
3047
3049
|
function createServer() {
|
|
3048
3050
|
return new McpServer({
|
|
3049
3051
|
name: "ckan-mcp-server",
|
|
3050
|
-
version: "0.4.
|
|
3052
|
+
version: "0.4.23"
|
|
3051
3053
|
});
|
|
3052
3054
|
}
|
|
3053
3055
|
function registerAll(server2) {
|
package/dist/worker.js
CHANGED
|
@@ -41,7 +41,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
41
41
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){let n=(this[W_]=this[W_]={accessors:{}}).accessors,o=this.prototype;function s(i){let a=cs(i);n[a]||(JP(o,i),n[a]=!0)}return y.isArray(e)?e.forEach(s):s(e),this}};Wn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);y.reduceDescriptors(Wn.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});y.freezeMethods(Wn);var ze=Wn;function us(t,e){let r=this||Gn,n=e||r,o=ze.from(n.headers),s=n.data;return y.forEach(t,function(a){s=a.call(r,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function ls(t){return!!(t&&t.__CANCEL__)}function Q_(t,e,r){D.call(this,t??"canceled",D.ERR_CANCELED,e,r),this.name="CanceledError"}y.inherits(Q_,D,{__CANCEL__:!0});var jt=Q_;function ds(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function _p(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function KP(t,e){t=t||10;let r=new Array(t),n=new Array(t),o=0,s=0,i;return e=e!==void 0?e:1e3,function(c){let u=Date.now(),l=n[s];i||(i=u),r[o]=c,n[o]=u;let d=s,h=0;for(;d!==o;)h+=r[d++],d=d%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),u-i<e)return;let m=l&&u-l;return m?Math.round(h*1e3/m):void 0}}var Y_=KP;function GP(t,e){let r=0,n=1e3/e,o,s,i=(u,l=Date.now())=>{r=l,o=null,s&&(clearTimeout(s),s=null),t(...u)};return[(...u)=>{let l=Date.now(),d=l-r;d>=n?i(u,l):(o=u,s||(s=setTimeout(()=>{s=null,i(o)},n-d)))},()=>o&&i(o)]}var X_=GP;var Qn=(t,e,r=3)=>{let n=0,o=Y_(50,250);return X_(s=>{let i=s.loaded,a=s.lengthComputable?s.total:void 0,c=i-n,u=o(c),l=i<=a;n=i;let d={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},r)},vp=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},bp=t=>(...e)=>y.asap(()=>t(...e));var ev=xe.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,xe.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(xe.origin),xe.navigator&&/(msie|trident)/i.test(xe.navigator.userAgent)):()=>!0;var tv=xe.hasStandardBrowserEnv?{write(t,e,r,n,o,s,i){if(typeof document>"u")return;let a=[`${t}=${encodeURIComponent(e)}`];y.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),y.isString(n)&&a.push(`path=${n}`),y.isString(o)&&a.push(`domain=${o}`),s===!0&&a.push("secure"),y.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function xp(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function wp(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ps(t,e,r){let n=!xp(e);return t&&(n||r==!1)?wp(t,e):e}var rv=t=>t instanceof ze?{...t}:t;function wt(t,e){e=e||{};let r={};function n(u,l,d,h){return y.isPlainObject(u)&&y.isPlainObject(l)?y.merge.call({caseless:h},u,l):y.isPlainObject(l)?y.merge({},l):y.isArray(l)?l.slice():l}function o(u,l,d,h){if(y.isUndefined(l)){if(!y.isUndefined(u))return n(void 0,u,d,h)}else return n(u,l,d,h)}function s(u,l){if(!y.isUndefined(l))return n(void 0,l)}function i(u,l){if(y.isUndefined(l)){if(!y.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,d){if(d in e)return n(u,l);if(d in t)return n(void 0,u)}let c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,l,d)=>o(rv(u),rv(l),d,!0)};return y.forEach(Object.keys({...t,...e}),function(l){let d=c[l]||o,h=d(t[l],e[l],l);y.isUndefined(h)&&d!==a||(r[l]=h)}),r}var ya=t=>{let e=wt({},t),{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=e;if(e.headers=i=ze.from(i),e.url=as(ps(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),y.isFormData(r)){if(xe.hasStandardBrowserEnv||xe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(y.isFunction(r.getHeaders)){let c=r.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([l,d])=>{u.includes(l.toLowerCase())&&i.set(l,d)})}}if(xe.hasStandardBrowserEnv&&(n&&y.isFunction(n)&&(n=n(e)),n||n!==!1&&ev(e.url))){let c=o&&s&&tv.read(s);c&&i.set(o,c)}return e};var WP=typeof XMLHttpRequest<"u",nv=WP&&function(t){return new Promise(function(r,n){let o=ya(t),s=o.data,i=ze.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:u}=o,l,d,h,m,p;function f(){m&&m(),p&&p(),o.cancelToken&&o.cancelToken.unsubscribe(l),o.signal&&o.signal.removeEventListener("abort",l)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function _(){if(!g)return;let w=ze.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:t,request:g};ds(function(de){r(de),f()},function(de){n(de),f()},O),g=null}"onloadend"in g?g.onloadend=_:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(_)},g.onabort=function(){g&&(n(new D("Request aborted",D.ECONNABORTED,t,g)),g=null)},g.onerror=function(z){let O=z&&z.message?z.message:"Network Error",_e=new D(O,D.ERR_NETWORK,t,g);_e.event=z||null,n(_e),g=null},g.ontimeout=function(){let z=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",O=o.transitional||ma;o.timeoutErrorMessage&&(z=o.timeoutErrorMessage),n(new D(z,O.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,t,g)),g=null},s===void 0&&i.setContentType(null),"setRequestHeader"in g&&y.forEach(i.toJSON(),function(z,O){g.setRequestHeader(O,z)}),y.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),a&&a!=="json"&&(g.responseType=o.responseType),u&&([h,p]=Qn(u,!0),g.addEventListener("progress",h)),c&&g.upload&&([d,m]=Qn(c),g.upload.addEventListener("progress",d),g.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(l=w=>{g&&(n(!w||w.type?new jt(null,t,g):w),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(l),o.signal&&(o.signal.aborted?l():o.signal.addEventListener("abort",l)));let x=_p(o.url);if(x&&xe.protocols.indexOf(x)===-1){n(new D("Unsupported protocol "+x+":",D.ERR_BAD_REQUEST,t));return}g.send(s||null)})};var QP=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o,s=function(u){if(!o){o=!0,a();let l=u instanceof Error?u:this.reason;n.abort(l instanceof D?l:new jt(l instanceof Error?l.message:l))}},i=e&&setTimeout(()=>{i=null,s(new D(`timeout ${e} of ms exceeded`,D.ETIMEDOUT))},e),a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));let{signal:c}=n;return c.unsubscribe=()=>y.asap(a),c}},ov=QP;var YP=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},XP=async function*(t,e){for await(let r of eO(t))yield*YP(r,e)},eO=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},$p=(t,e,r,n)=>{let o=XP(t,e),s=0,i,a=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:u,value:l}=await o.next();if(u){a(),c.close();return}let d=l.byteLength;if(r){let h=s+=d;r(h)}c.enqueue(new Uint8Array(l))}catch(u){throw a(u),u}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var sv=64*1024,{isFunction:_a}=y,tO=(({Request:t,Response:e})=>({Request:t,Response:e}))(y.global),{ReadableStream:iv,TextEncoder:av}=y.global,cv=(t,...e)=>{try{return!!t(...e)}catch{return!1}},rO=t=>{t=y.merge.call({skipUndefined:!0},tO,t);let{fetch:e,Request:r,Response:n}=t,o=e?_a(e):typeof fetch=="function",s=_a(r),i=_a(n);if(!o)return!1;let a=o&&_a(iv),c=o&&(typeof av=="function"?(p=>f=>p.encode(f))(new av):async p=>new Uint8Array(await new r(p).arrayBuffer())),u=s&&a&&cv(()=>{let p=!1,f=new r(xe.origin,{body:new iv,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!f}),l=i&&a&&cv(()=>y.isReadableStream(new n("").body)),d={stream:l&&(p=>p.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(f,g)=>{let _=f&&f[p];if(_)return _.call(f);throw new D(`Response type '${p}' is not supported`,D.ERR_NOT_SUPPORT,g)})});let h=async p=>{if(p==null)return 0;if(y.isBlob(p))return p.size;if(y.isSpecCompliantForm(p))return(await new r(xe.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(y.isArrayBufferView(p)||y.isArrayBuffer(p))return p.byteLength;if(y.isURLSearchParams(p)&&(p=p+""),y.isString(p))return(await c(p)).byteLength},m=async(p,f)=>{let g=y.toFiniteNumber(p.getContentLength());return g??h(f)};return async p=>{let{url:f,method:g,data:_,signal:x,cancelToken:w,timeout:z,onDownloadProgress:O,onUploadProgress:_e,responseType:de,headers:$t,withCredentials:Qt="same-origin",fetchOptions:Yt}=ya(p),dn=e||fetch;de=de?(de+"").toLowerCase():"text";let zr=ov([x,w&&w.toAbortSignal()],z),Xt=null,qt=zr&&zr.unsubscribe&&(()=>{zr.unsubscribe()}),jp;try{if(_e&&u&&g!=="get"&&g!=="head"&&(jp=await m($t,_))!==0){let tr=new r(f,{method:"POST",body:_,duplex:"half"}),pn;if(y.isFormData(_)&&(pn=tr.headers.get("content-type"))&&$t.setContentType(pn),tr.body){let[Ea,gs]=vp(jp,Qn(bp(_e)));_=$p(tr.body,sv,Ea,gs)}}y.isString(Qt)||(Qt=Qt?"include":"omit");let St=s&&"credentials"in r.prototype,Mp={...Yt,signal:zr,method:g.toUpperCase(),headers:$t.normalize().toJSON(),body:_,duplex:"half",credentials:St?Qt:void 0};Xt=s&&new r(f,Mp);let er=await(s?dn(Xt,Yt):dn(f,Mp)),Zp=l&&(de==="stream"||de==="response");if(l&&(O||Zp&&qt)){let tr={};["status","statusText","headers"].forEach(qp=>{tr[qp]=er[qp]});let pn=y.toFiniteNumber(er.headers.get("content-length")),[Ea,gs]=O&&vp(pn,Qn(bp(O),!0))||[];er=new n($p(er.body,sv,Ea,()=>{gs&&gs(),qt&&qt()}),tr)}de=de||"text";let Kv=await d[y.findKey(d,de)||"text"](er,p);return!Zp&&qt&&qt(),await new Promise((tr,pn)=>{ds(tr,pn,{data:Kv,headers:ze.from(er.headers),status:er.status,statusText:er.statusText,config:p,request:Xt})})}catch(St){throw qt&&qt(),St&&St.name==="TypeError"&&/Load failed|fetch/i.test(St.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,p,Xt),{cause:St.cause||St}):D.from(St,St&&St.code,p,Xt)}}},nO=new Map,Sp=t=>{let e=t&&t.env||{},{fetch:r,Request:n,Response:o}=e,s=[n,o,r],i=s.length,a=i,c,u,l=nO;for(;a--;)c=s[a],u=l.get(c),u===void 0&&l.set(c,u=a?new Map:rO(e)),l=u;return u},qq=Sp();var kp={http:pa,xhr:nv,fetch:{get:Sp}};y.forEach(kp,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var uv=t=>`- ${t}`,sO=t=>y.isFunction(t)||t===null||t===!1;function iO(t,e){t=y.isArray(t)?t:[t];let{length:r}=t,n,o,s={};for(let i=0;i<r;i++){n=t[i];let a;if(o=n,!sO(n)&&(o=kp[(a=String(n)).toLowerCase()],o===void 0))throw new D(`Unknown adapter '${a}'`);if(o&&(y.isFunction(o)||(o=o.get(e))))break;s[a||"#"+i]=o}if(!o){let i=Object.entries(s).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build")),a=r?i.length>1?`since :
|
|
42
42
|
`+i.map(uv).join(`
|
|
43
43
|
`):" "+uv(i[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}var va={getAdapter:iO,adapters:kp};function zp(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new jt(null,t)}function ba(t){return zp(t),t.headers=ze.from(t.headers),t.data=us.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),va.getAdapter(t.adapter||Gn.adapter,t)(t).then(function(n){return zp(t),n.data=us.call(t,t.transformResponse,n),n.headers=ze.from(n.headers),n},function(n){return ls(n)||(zp(t),n&&n.response&&(n.response.data=us.call(t,t.transformResponse,n.response),n.response.headers=ze.from(n.response.headers))),Promise.reject(n)})}var xa="1.13.2";var wa={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{wa[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var lv={};wa.transitional=function(e,r,n){function o(s,i){return"[Axios v"+xa+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,a)=>{if(e===!1)throw new D(o(i," has been removed"+(r?" in "+r:"")),D.ERR_DEPRECATED);return r&&!lv[i]&&(lv[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,i,a):!0}};wa.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function aO(t,e,r){if(typeof t!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),o=n.length;for(;o-- >0;){let s=n[o],i=e[s];if(i){let a=t[s],c=a===void 0||i(a,s,t);if(c!==!0)throw new D("option "+s+" must be "+c,D.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new D("Unknown option "+s,D.ERR_BAD_OPTION)}}var fs={assertOptions:aO,validators:wa};var Mt=fs.validators,Yn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dp,response:new dp}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let s=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
44
|
-
`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=wt(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&fs.assertOptions(n,{silentJSONParsing:Mt.transitional(Mt.boolean),forcedJSONParsing:Mt.transitional(Mt.boolean),clarifyTimeoutError:Mt.transitional(Mt.boolean)},!1),o!=null&&(y.isFunction(o)?r.paramsSerializer={serialize:o}:fs.assertOptions(o,{encode:Mt.function,serialize:Mt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),fs.assertOptions(r,{baseUrl:Mt.spelling("baseURL"),withXsrfToken:Mt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&y.merge(s.common,s[r.method]);s&&y.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),r.headers=ze.concat(i,s);let a=[],c=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(c=c&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});let u=[];this.interceptors.response.forEach(function(f){u.push(f.fulfilled,f.rejected)});let l,d=0,h;if(!c){let p=[ba.bind(this),void 0];for(p.unshift(...a),p.push(...u),h=p.length,l=Promise.resolve(r);d<h;)l=l.then(p[d++],p[d++]);return l}h=a.length;let m=r;for(;d<h;){let p=a[d++],f=a[d++];try{m=p(m)}catch(g){f.call(this,g);break}}try{l=ba.call(this,m)}catch(p){return Promise.reject(p)}for(d=0,h=u.length;d<h;)l=l.then(u[d++],u[d++]);return l}getUri(e){e=wt(this.defaults,e);let r=ps(e.baseURL,e.url,e.allowAbsoluteUrls);return as(r,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Yn.prototype[e]=function(r,n){return this.request(wt(n||{},{method:e,url:r,data:(n||{}).data}))}});y.forEach(["post","put","patch"],function(e){function r(n){return function(s,i,a){return this.request(wt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Yn.prototype[e]=r(),Yn.prototype[e+"Form"]=r(!0)});var ms=Yn;var Tp=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},e(function(s,i,a){n.reason||(n.reason=new jt(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}},dv=Tp;function Ep(t){return function(r){return t.apply(null,r)}}function Rp(t){return y.isObject(t)&&t.isAxiosError===!0}var Pp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Pp).forEach(([t,e])=>{Pp[e]=t});var pv=Pp;function fv(t){let e=new ms(t),r=ns(ms.prototype.request,e);return y.extend(r,ms.prototype,e,{allOwnKeys:!0}),y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return fv(wt(t,o))},r}var $e=fv(Gn);$e.Axios=ms;$e.CanceledError=jt;$e.CancelToken=dv;$e.isCancel=ls;$e.VERSION=xa;$e.toFormData=$r;$e.AxiosError=D;$e.Cancel=$e.CanceledError;$e.all=function(e){return Promise.all(e)};$e.spread=Ep;$e.isAxiosError=Rp;$e.mergeConfig=wt;$e.AxiosHeaders=ze;$e.formToJSON=t=>ha(y.isHTMLForm(t)?new FormData(t):t);$e.getAdapter=va.getAdapter;$e.HttpStatusCode=pv;$e.default=$e;var Sr=$e;var{Axios:jD,AxiosError:MD,CanceledError:ZD,isCancel:qD,CancelToken:DD,VERSION:LD,all:UD,Cancel:FD,isAxiosError:VD,spread:HD,toFormData:BD,AxiosHeaders:JD,HttpStatusCode:KD,formToJSON:GD,getAdapter:WD,mergeConfig:QD}=Sr;async function ne(t,e,r={}){let
|
|
44
|
+
`+s):n.stack=s}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=wt(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&fs.assertOptions(n,{silentJSONParsing:Mt.transitional(Mt.boolean),forcedJSONParsing:Mt.transitional(Mt.boolean),clarifyTimeoutError:Mt.transitional(Mt.boolean)},!1),o!=null&&(y.isFunction(o)?r.paramsSerializer={serialize:o}:fs.assertOptions(o,{encode:Mt.function,serialize:Mt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),fs.assertOptions(r,{baseUrl:Mt.spelling("baseURL"),withXsrfToken:Mt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&y.merge(s.common,s[r.method]);s&&y.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),r.headers=ze.concat(i,s);let a=[],c=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(r)===!1||(c=c&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});let u=[];this.interceptors.response.forEach(function(f){u.push(f.fulfilled,f.rejected)});let l,d=0,h;if(!c){let p=[ba.bind(this),void 0];for(p.unshift(...a),p.push(...u),h=p.length,l=Promise.resolve(r);d<h;)l=l.then(p[d++],p[d++]);return l}h=a.length;let m=r;for(;d<h;){let p=a[d++],f=a[d++];try{m=p(m)}catch(g){f.call(this,g);break}}try{l=ba.call(this,m)}catch(p){return Promise.reject(p)}for(d=0,h=u.length;d<h;)l=l.then(u[d++],u[d++]);return l}getUri(e){e=wt(this.defaults,e);let r=ps(e.baseURL,e.url,e.allowAbsoluteUrls);return as(r,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Yn.prototype[e]=function(r,n){return this.request(wt(n||{},{method:e,url:r,data:(n||{}).data}))}});y.forEach(["post","put","patch"],function(e){function r(n){return function(s,i,a){return this.request(wt(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}Yn.prototype[e]=r(),Yn.prototype[e+"Form"]=r(!0)});var ms=Yn;var Tp=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},e(function(s,i,a){n.reason||(n.reason=new jt(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}},dv=Tp;function Ep(t){return function(r){return t.apply(null,r)}}function Rp(t){return y.isObject(t)&&t.isAxiosError===!0}var Pp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Pp).forEach(([t,e])=>{Pp[e]=t});var pv=Pp;function fv(t){let e=new ms(t),r=ns(ms.prototype.request,e);return y.extend(r,ms.prototype,e,{allOwnKeys:!0}),y.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return fv(wt(t,o))},r}var $e=fv(Gn);$e.Axios=ms;$e.CanceledError=jt;$e.CancelToken=dv;$e.isCancel=ls;$e.VERSION=xa;$e.toFormData=$r;$e.AxiosError=D;$e.Cancel=$e.CanceledError;$e.all=function(e){return Promise.all(e)};$e.spread=Ep;$e.isAxiosError=Rp;$e.mergeConfig=wt;$e.AxiosHeaders=ze;$e.formToJSON=t=>ha(y.isHTMLForm(t)?new FormData(t):t);$e.getAdapter=va.getAdapter;$e.HttpStatusCode=pv;$e.default=$e;var Sr=$e;var{Axios:jD,AxiosError:MD,CanceledError:ZD,isCancel:qD,CancelToken:DD,VERSION:LD,all:UD,Cancel:FD,isAxiosError:VD,spread:HD,toFormData:BD,AxiosHeaders:JD,HttpStatusCode:KD,formToJSON:GD,getAdapter:WD,mergeConfig:QD}=Sr;async function ne(t,e,r={}){let n=t.replace(/\/$/,""),o=`${n}/api/3/action/${e}`;try{let s=await Sr.get(o,{params:r,timeout:3e4,headers:{Accept:"application/json, text/plain, */*","Accept-Language":"en-US,en;q=0.9,it;q=0.8","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive",Referer:`${n}/`,"Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"navigate","Sec-Fetch-Dest":"document","Upgrade-Insecure-Requests":"1","Sec-CH-UA":'"Chromium";v="120", "Not?A_Brand";v="24", "Google Chrome";v="120"',"Sec-CH-UA-Mobile":"?0","Sec-CH-UA-Platform":'"Linux"',"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}});if(s.data&&s.data.success===!0)return s.data.result;throw new Error(`CKAN API returned success=false: ${JSON.stringify(s.data)}`)}catch(s){if(Sr.isAxiosError(s)){let i=s;if(i.response){let a=i.response.status,c=i.response.data,u=c?.error?.message||c?.error||"Unknown error";throw new Error(`CKAN API error (${a}): ${u}`)}else throw i.code==="ECONNABORTED"?new Error(`Request timeout connecting to ${t}`):i.code==="ENOTFOUND"?new Error(`Server not found: ${t}`):new Error(`Network error: ${i.message}`)}throw s}}function J(t,e=R_){return t.length<=e?t:t.substring(0,e)+`
|
|
45
45
|
|
|
46
46
|
... [Response truncated at ${e} characters]`}function lt(t){try{if(!t)return"Invalid Date";let e=new Date(t);return Number.isNaN(e.getTime())?"Invalid Date":e.toISOString().slice(0,10)}catch{return"Invalid Date"}}var cn={portals:[{id:"dati-gov-it",name:"dati.gov.it",api_url:"https://www.dati.gov.it/opendata",api_url_aliases:["https://dati.gov.it/opendata","http://www.dati.gov.it/opendata","http://dati.gov.it/opendata"],search:{force_text_field:!0},dataset_view_url:"https://www.dati.gov.it/view-dataset/dataset?id={id}",organization_view_url:"https://www.dati.gov.it/view-dataset?organization={name}"}],defaults:{dataset_view_url:"{server_url}/dataset/{name}",organization_view_url:"{server_url}/organization/{name}",search:{force_text_field:!1}}};function hs(t){return t.replace(/\/$/,"")}function uO(t){try{return new URL(t).hostname}catch{return null}}function $a(t){let e=hs(t);return cn.portals.find(n=>{let o=hs(n.api_url),s=(n.api_url_aliases||[]).map(hs);return o===e||s.includes(e)})||null}function mv(t){let e=$a(t),r=cn.defaults?.search||{};return{force_text_field:e?.search?.force_text_field??r.force_text_field??!1}}function Op(t){return hs(t)}function hv(t){let e=cn.portals.find(r=>[r.api_url,...r.api_url_aliases||[]].some(o=>uO(o)===t));return e?hs(e.api_url):null}function Np(t,e){let r=Op(t);return($a(t)?.dataset_view_url||cn.defaults.dataset_view_url).replace("{server_url}",r).replace("{id}",e.id).replace("{name}",e.name)}function Sa(t,e){let r=Op(t);return($a(t)?.organization_view_url||cn.defaults.organization_view_url).replace("{server_url}",r).replace("{id}",e.id).replace("{name}",e.name)}var lO="*:*",dO=/\b[a-zA-Z_][\w-]*:/,pO=/[+\-!(){}[\]^"~*?:\\/|&]/g;function fO(t){return dO.test(t)}function mO(t){return t.replace(pO,"\\$&")}function hO(t){let e=new Date,r=e.toISOString(),n=/\b(?!metadata_)(modified|issued):\[NOW-(\d+)(DAYS?|MONTHS?|YEARS?)\s+TO\s+NOW\]/gi;return t.replace(n,(o,s,i,a)=>{let c=parseInt(i,10),u=new Date(e);switch(a.toLowerCase().replace(/s$/,"")){case"day":u.setDate(u.getDate()-c);break;case"month":u.setMonth(u.getMonth()-c);break;case"year":u.setFullYear(u.getFullYear()-c);break;default:return o}let d=u.toISOString();return`${s}:[${d} TO ${r}]`})}function Ap(t,e,r){let o=mv(t).force_text_field??!1,s=!1;if(r==="text")s=!0;else if(r==="default")s=!1;else if(o){let a=e.trim();s=a!==lO&&!fO(a)}let i=s?`text:(${mO(e)})`:e;return i=hO(i),{effectiveQuery:i,forcedTextField:s}}var gv={title:4,notes:2,tags:3,organization:1},gO=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","as","is","was","are","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","must","can","this","that","these","those"]),yv=t=>{let r=(t.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).filter(n=>n.length>1&&!gO.has(n));return Array.from(new Set(r))},yO=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_v=(t,e)=>{if(!t||e.length===0)return!1;let r=t.toLowerCase().replace(/_/g," ");return e.some(n=>new RegExp(`\\b${yO(n)}\\b`,"i").test(r))},Ip=(t,e,r)=>_v(t,e)?r:0,_O=(t,e,r=gv)=>{let n=yv(t),o=e.title||e.name||"",s=e.notes||"",i=e.organization?.title||e.organization?.name||e.owner_org||"",a={title:Ip(o,n,r.title),notes:Ip(s,n,r.notes),tags:0,organization:Ip(i,n,r.organization),total:0};if(Array.isArray(e.tags)&&e.tags.length>0&&n.length>0){let c=e.tags.some(u=>{let l=typeof u=="string"?u:u?.name;return _v(l,n)});a.tags=c?r.tags:0}return a.total=a.title+a.notes+a.tags+a.organization,{total:a.total,breakdown:a,terms:n}};function vv(t){t.registerTool("ckan_package_search",{title:"Search CKAN Datasets",description:`Search for datasets (packages) on a CKAN server using Solr query syntax.
|
|
47
47
|
|
|
@@ -595,7 +595,7 @@ Returns:
|
|
|
595
595
|
`,i+=`| Group | Datasets |
|
|
596
596
|
`,i+=`|-------|----------|
|
|
597
597
|
`;for(let a of o)i+=`| ${a.display_name||a.name} | ${a.count} |
|
|
598
|
-
`}return{content:[{type:"text",text:J(i)}]}}catch(r){return{content:[{type:"text",text:`Error searching groups: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}})}var Tv="https://data.europa.eu/api/mqa/cache/datasets",Ev="https://data.europa.eu/api/hub/repo/datasets",xO=[/^https?:\/\/(www\.)?dati\.gov\.it/i];function wO(t){return xO.some(e=>e.test(t))}function $O(t){return t.trim().replace(/:/g,"-").replace(/\./g,"-").replace(/-+/g,"-").toLowerCase()}function SO(t){let e=$O(t);if(!e)return[];let r=[e];return e.includes("~~")||r.push(`${e}~~1`,`${e}~~2`),r}var ln={accessibility:100,findability:100,interoperability:110,reusability:75,contextuality:20};function kO(t){if(!t||typeof t!="object")return;let e=t["@value"];if(typeof e=="number")return e;if(typeof e=="string"){let r=Number(e);return Number.isFinite(r)?r:void 0}}function zO(t){if(t&&typeof t=="object"&&"@graph"in t)return t;if(typeof t=="string")try{return JSON.parse(t)}catch{return}if(t instanceof ArrayBuffer)try{let e=new TextDecoder().decode(new Uint8Array(t));return JSON.parse(e)}catch{return}if(ArrayBuffer.isView(t))try{let e=t,r=new TextDecoder().decode(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return JSON.parse(r)}catch{return}return t}function TO(t){let e={},r=zO(t);if(!r||typeof r!="object")return e;let n=r["@graph"];if(!Array.isArray(n))return e;for(let o of n){if(!o||typeof o!="object")continue;let s=o["dqv:isMeasurementOf"];if(!s)continue;let i=typeof s=="string"?s:s["@id"];if(typeof i!="string")continue;let a=kO(o["dqv:value"]);a!==void 0&&(i.endsWith("#accessibilityScoring")?e.accessibility=a:i.endsWith("#findabilityScoring")?e.findability=a:i.endsWith("#interoperabilityScoring")?e.interoperability=a:i.endsWith("#reusabilityScoring")?e.reusability=a:i.endsWith("#contextualityScoring")?e.contextuality=a:i.endsWith("#scoring")&&(e.total=a))}return e}function EO(t){let e=[];return Object.keys(ln).forEach(r=>{let n=t[r];typeof n=="number"&&n<ln[r]&&e.push(r)}),e}async function RO(t,e){let r=await ne(t,"package_show",{id:e}),n=r.identifier||r.name,o=SO(n);if(o.length===0)throw new Error("Dataset identifier is empty; cannot query MQA API");for(let s of o){let i=`${Tv}/${s}`,a=`${Ev}/${s}/metrics`;try{let c=await Sr.get(i,{timeout:3e4,headers:{"User-Agent":"CKAN-MCP-Server/1.0"}}),u;try{let p=await fetch(a,{headers:{"User-Agent":"CKAN-MCP-Server/1.0"}});if(!p.ok)throw new Error(`MQA metrics error: ${p.status} ${p.statusText}`);try{u=await p.json()}catch{u=await p.text()}}catch(p){throw p instanceof Error?new Error(`MQA metrics error: ${p.message}`):p}let l=TO(u),h=c.data?.result?.results?.[0]?.info?.["dataset-id"]||s,m={scores:l,nonMaxDimensions:EO(l),metricsUrl:a,mqaUrl:i,portalId:h};return{mqa:c.data,breakdown:m}}catch(c){if(Sr.isAxiosError(c)){if(c.response?.status===404)continue;throw new Error(`MQA API error: ${c.message}`)}throw c}}throw new Error(`Quality metrics not found or identifier not aligned on data.europa.eu. Tried: ${o.join(", ")}. Check the dataset quality page on data.europa.eu to confirm the identifier (it may include a '~~1' suffix) or verify alignment on dati.gov.it (quality may be marked as 'Non disponibile o identificativo non allineato').`)}function Cp(t,e){if(Array.isArray(t)){for(let r of t)if(r&&typeof r=="object"&&e in r)return r[e]}}function zv(t){if(!Array.isArray(t))return;let e=new Map;for(let r of t){if(!r||typeof r!="object")continue;let n=r.name,o=r.percentage;typeof n=="string"&&typeof o=="number"&&e.set(n.toLowerCase(),o)}if(e.has("yes"))return(e.get("yes")||0)>0;if(e.size>0){for(let[r,n]of e.entries())if(r.startsWith("2")&&n>0)return!0;return!1}}function dt(t,e){let r=Cp(t,e);if(typeof r=="boolean")return r}function un(t,e,r){let n=Cp(t,e),o=zv(n);if(o!==void 0)return{available:o};if(r){let s=Cp(t,r),i=zv(s);if(i!==void 0)return{available:i}}}function PO(t){let e=t?.mqa??t,r=t?.breakdown,n=e?.result?.results?.[0];return!n||typeof n!="object"?{...t,breakdown:r}:{id:n.info?.["dataset-id"],info:{score:n.info?.score},accessibility:{accessUrl:un(n.accessibility,"accessUrlAvailability","accessUrlStatusCode"),downloadUrl:un(n.accessibility,"downloadUrlAvailability","downloadUrlStatusCode")},reusability:{licence:un(n.reusability,"licenceAvailability"),contactPoint:dt(n.reusability,"contactPointAvailability")!==void 0?{available:dt(n.reusability,"contactPointAvailability")}:void 0,publisher:dt(n.reusability,"publisherAvailability")!==void 0?{available:dt(n.reusability,"publisherAvailability")}:void 0},interoperability:{format:un(n.interoperability,"formatAvailability"),mediaType:un(n.interoperability,"mediaTypeAvailability")},findability:{keyword:dt(n.findability,"keywordAvailability")!==void 0?{available:dt(n.findability,"keywordAvailability")}:void 0,category:dt(n.findability,"categoryAvailability")!==void 0?{available:dt(n.findability,"categoryAvailability")}:void 0,spatial:dt(n.findability,"spatialAvailability")!==void 0?{available:dt(n.findability,"spatialAvailability")}:void 0,temporal:dt(n.findability,"temporalAvailability")!==void 0?{available:dt(n.findability,"temporalAvailability")}:void 0},contextuality:{byteSize:un(n.contextuality,"byteSizeAvailability"),rights:un(n.contextuality,"rightsAvailability")},breakdown:r}}function OO(t,e){let r=PO(t),n=[];if(n.push(`# Quality Metrics for Dataset: ${e}`),n.push(""),r.info?.score!==void 0&&(n.push(`**Overall Score**: ${r.info.score}/
|
|
598
|
+
`}return{content:[{type:"text",text:J(i)}]}}catch(r){return{content:[{type:"text",text:`Error searching groups: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}})}var Tv="https://data.europa.eu/api/mqa/cache/datasets",Ev="https://data.europa.eu/api/hub/repo/datasets",xO=[/^https?:\/\/(www\.)?dati\.gov\.it/i];function wO(t){return xO.some(e=>e.test(t))}function $O(t){return t.trim().replace(/:/g,"-").replace(/\./g,"-").replace(/-+/g,"-").toLowerCase()}function SO(t){let e=$O(t);if(!e)return[];let r=[e];return e.includes("~~")||r.push(`${e}~~1`,`${e}~~2`),r}var ln={accessibility:100,findability:100,interoperability:110,reusability:75,contextuality:20};function kO(t){if(!t||typeof t!="object")return;let e=t["@value"];if(typeof e=="number")return e;if(typeof e=="string"){let r=Number(e);return Number.isFinite(r)?r:void 0}}function zO(t){if(t&&typeof t=="object"&&"@graph"in t)return t;if(typeof t=="string")try{return JSON.parse(t)}catch{return}if(t instanceof ArrayBuffer)try{let e=new TextDecoder().decode(new Uint8Array(t));return JSON.parse(e)}catch{return}if(ArrayBuffer.isView(t))try{let e=t,r=new TextDecoder().decode(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return JSON.parse(r)}catch{return}return t}function TO(t){let e={},r=zO(t);if(!r||typeof r!="object")return e;let n=r["@graph"];if(!Array.isArray(n))return e;for(let o of n){if(!o||typeof o!="object")continue;let s=o["dqv:isMeasurementOf"];if(!s)continue;let i=typeof s=="string"?s:s["@id"];if(typeof i!="string")continue;let a=kO(o["dqv:value"]);a!==void 0&&(i.endsWith("#accessibilityScoring")?e.accessibility=a:i.endsWith("#findabilityScoring")?e.findability=a:i.endsWith("#interoperabilityScoring")?e.interoperability=a:i.endsWith("#reusabilityScoring")?e.reusability=a:i.endsWith("#contextualityScoring")?e.contextuality=a:i.endsWith("#scoring")&&(e.total=a))}return e}function EO(t){let e=[];return Object.keys(ln).forEach(r=>{let n=t[r];typeof n=="number"&&n<ln[r]&&e.push(r)}),e}async function RO(t,e){let r=await ne(t,"package_show",{id:e}),n=r.identifier||r.name,o=SO(n);if(o.length===0)throw new Error("Dataset identifier is empty; cannot query MQA API");for(let s of o){let i=`${Tv}/${s}`,a=`${Ev}/${s}/metrics`;try{let c=await Sr.get(i,{timeout:3e4,headers:{"User-Agent":"CKAN-MCP-Server/1.0"}}),u;try{let p=await fetch(a,{headers:{"User-Agent":"CKAN-MCP-Server/1.0"}});if(!p.ok)throw new Error(`MQA metrics error: ${p.status} ${p.statusText}`);try{u=await p.json()}catch{u=await p.text()}}catch(p){throw p instanceof Error?new Error(`MQA metrics error: ${p.message}`):p}let l=TO(u),h=c.data?.result?.results?.[0]?.info?.["dataset-id"]||s,m={scores:l,nonMaxDimensions:EO(l),metricsUrl:a,mqaUrl:i,portalId:h};return{mqa:c.data,breakdown:m}}catch(c){if(Sr.isAxiosError(c)){if(c.response?.status===404)continue;throw new Error(`MQA API error: ${c.message}`)}throw c}}throw new Error(`Quality metrics not found or identifier not aligned on data.europa.eu. Tried: ${o.join(", ")}. Check the dataset quality page on data.europa.eu to confirm the identifier (it may include a '~~1' suffix) or verify alignment on dati.gov.it (quality may be marked as 'Non disponibile o identificativo non allineato').`)}function Cp(t,e){if(Array.isArray(t)){for(let r of t)if(r&&typeof r=="object"&&e in r)return r[e]}}function zv(t){if(!Array.isArray(t))return;let e=new Map;for(let r of t){if(!r||typeof r!="object")continue;let n=r.name,o=r.percentage;typeof n=="string"&&typeof o=="number"&&e.set(n.toLowerCase(),o)}if(e.has("yes"))return(e.get("yes")||0)>0;if(e.size>0){for(let[r,n]of e.entries())if(r.startsWith("2")&&n>0)return!0;return!1}}function dt(t,e){let r=Cp(t,e);if(typeof r=="boolean")return r}function un(t,e,r){let n=Cp(t,e),o=zv(n);if(o!==void 0)return{available:o};if(r){let s=Cp(t,r),i=zv(s);if(i!==void 0)return{available:i}}}function PO(t){let e=t?.mqa??t,r=t?.breakdown,n=e?.result?.results?.[0];return!n||typeof n!="object"?{...t,breakdown:r}:{id:n.info?.["dataset-id"],info:{score:n.info?.score},accessibility:{accessUrl:un(n.accessibility,"accessUrlAvailability","accessUrlStatusCode"),downloadUrl:un(n.accessibility,"downloadUrlAvailability","downloadUrlStatusCode")},reusability:{licence:un(n.reusability,"licenceAvailability"),contactPoint:dt(n.reusability,"contactPointAvailability")!==void 0?{available:dt(n.reusability,"contactPointAvailability")}:void 0,publisher:dt(n.reusability,"publisherAvailability")!==void 0?{available:dt(n.reusability,"publisherAvailability")}:void 0},interoperability:{format:un(n.interoperability,"formatAvailability"),mediaType:un(n.interoperability,"mediaTypeAvailability")},findability:{keyword:dt(n.findability,"keywordAvailability")!==void 0?{available:dt(n.findability,"keywordAvailability")}:void 0,category:dt(n.findability,"categoryAvailability")!==void 0?{available:dt(n.findability,"categoryAvailability")}:void 0,spatial:dt(n.findability,"spatialAvailability")!==void 0?{available:dt(n.findability,"spatialAvailability")}:void 0,temporal:dt(n.findability,"temporalAvailability")!==void 0?{available:dt(n.findability,"temporalAvailability")}:void 0},contextuality:{byteSize:un(n.contextuality,"byteSizeAvailability"),rights:un(n.contextuality,"rightsAvailability")},breakdown:r}}function OO(t,e){let r=PO(t),n=[];if(n.push(`# Quality Metrics for Dataset: ${e}`),n.push(""),r.info?.score!==void 0&&(n.push(`**Overall Score**: ${r.info.score}/405`),n.push("")),r.breakdown?.scores){n.push("## Dimension Scores");let s=r.breakdown.scores,i=[["accessibility","Accessibility",ln.accessibility],["findability","Findability",ln.findability],["interoperability","Interoperability",ln.interoperability],["reusability","Reusability",ln.reusability],["contextuality","Contextuality",ln.contextuality]];for(let[a,c,u]of i){let l=s[a];if(typeof l=="number"){let d=l>=u,h=d?"\u2705":"\u26A0\uFE0F";n.push(`- ${c}: ${l}/${u} ${h}${d?"":` (max ${u})`}`)}}r.breakdown.nonMaxDimensions.length>0?n.push(`- Non-max dimension(s): ${r.breakdown.nonMaxDimensions.join(", ")}`):Object.keys(s).length>0&&n.push("- Non-max dimension(s): none"),n.push("")}r.accessibility&&(n.push("## Accessibility"),r.accessibility.accessUrl!==void 0&&n.push(`- Access URL: ${r.accessibility.accessUrl.available?"\u2713":"\u2717"} Available`),r.accessibility.downloadUrl!==void 0&&n.push(`- Download URL: ${r.accessibility.downloadUrl.available?"\u2713":"\u2717"} Available`),n.push("")),r.reusability&&(n.push("## Reusability"),r.reusability.licence!==void 0&&n.push(`- License: ${r.reusability.licence.available?"\u2713":"\u2717"} Available`),r.reusability.contactPoint!==void 0&&n.push(`- Contact Point: ${r.reusability.contactPoint.available?"\u2713":"\u2717"} Available`),r.reusability.publisher!==void 0&&n.push(`- Publisher: ${r.reusability.publisher.available?"\u2713":"\u2717"} Available`),n.push("")),r.interoperability&&(n.push("## Interoperability"),r.interoperability.format!==void 0&&n.push(`- Format: ${r.interoperability.format.available?"\u2713":"\u2717"} Available`),r.interoperability.mediaType!==void 0&&n.push(`- Media Type: ${r.interoperability.mediaType.available?"\u2713":"\u2717"} Available`),n.push("")),r.findability&&(n.push("## Findability"),r.findability.keyword!==void 0&&n.push(`- Keywords: ${r.findability.keyword.available?"\u2713":"\u2717"} Available`),r.findability.category!==void 0&&n.push(`- Category: ${r.findability.category.available?"\u2713":"\u2717"} Available`),r.findability.spatial!==void 0&&n.push(`- Spatial: ${r.findability.spatial.available?"\u2713":"\u2717"} Available`),r.findability.temporal!==void 0&&n.push(`- Temporal: ${r.findability.temporal.available?"\u2713":"\u2717"} Available`),n.push("")),r.contextuality&&(n.push("## Contextuality"),r.contextuality.byteSize!==void 0&&n.push(`- Byte Size: ${r.contextuality.byteSize.available?"\u2713":"\u2717"} Available`),r.contextuality.rights!==void 0&&n.push(`- Rights: ${r.contextuality.rights.available?"\u2713":"\u2717"} Available`),n.push("")),n.push("---");let o=r.breakdown?.portalId||r.id||e;return n.push(`Portal: https://data.europa.eu/data/datasets/${o}/quality?locale=it`),n.push(`MQA source: ${Tv}/${o}`),n.push(`Metrics endpoint: ${r.breakdown?.metricsUrl||`${Ev}/${o}/metrics`}`),n.join(`
|
|
599
599
|
`)}function Rv(t){t.tool("ckan_get_mqa_quality","Get MQA (Metadata Quality Assurance) quality metrics for a dataset on dati.gov.it. Returns quality score and detailed metrics (accessibility, reusability, interoperability, findability, contextuality) from data.europa.eu. Only works with dati.gov.it server.",{server_url:$.string().url().describe("Base URL of dati.gov.it (e.g., https://www.dati.gov.it/opendata)"),dataset_id:$.string().describe("Dataset ID or name"),response_format:ke.optional()},async({server_url:e,dataset_id:r,response_format:n})=>{if(!wO(e))return{content:[{type:"text",text:`Error: MQA quality metrics are only available for dati.gov.it datasets. Provided server: ${e}
|
|
600
600
|
|
|
601
601
|
The MQA (Metadata Quality Assurance) system is operated by data.europa.eu and only evaluates datasets from Italian open data portal.`}]};try{let o=await RO(e,r);return{content:[{type:"text",text:(n||"markdown")==="json"?JSON.stringify(o,null,2):OO(o,r)}]}}catch(o){return{content:[{type:"text",text:`Error retrieving quality metrics: ${o instanceof Error?o.message:String(o)}`}]}}})}function kr(t){let e=t.hostname;if(!e)throw new Error("Invalid ckan:// URI: missing server hostname");let r=t.pathname.split("/").filter(a=>a.length>0);if(r.length<2)throw new Error(`Invalid ckan:// URI: expected /{type}/{id}, got ${t.pathname}`);let[n,...o]=r,s=o.join("/");if(!n||!s)throw new Error("Invalid ckan:// URI: missing type or id");return{server:hv(e)||`https://${e}`,type:n,id:s}}function Pv(t){t.registerResource("ckan-dataset",new Ct("ckan://{server}/dataset/{id}",{list:void 0}),{title:"CKAN Dataset",description:"Access dataset metadata from any CKAN server. URI format: ckan://{server}/dataset/{id}",mimeType:"application/json"},async(e,r)=>{try{let{server:n}=kr(e),o=r.id,s=await ne(n,"package_show",{id:o}),i=J(JSON.stringify(s,null,2));return{contents:[{uri:e.href,mimeType:"application/json",text:i}]}}catch(n){let o=n instanceof Error?n.message:String(n);return{contents:[{uri:e.href,mimeType:"text/plain",text:`Error fetching dataset: ${o}`}]}}})}function Ov(t){t.registerResource("ckan-resource",new Ct("ckan://{server}/resource/{id}",{list:void 0}),{title:"CKAN Resource",description:"Access resource metadata and download URL from any CKAN server. URI format: ckan://{server}/resource/{id}",mimeType:"application/json"},async(e,r)=>{try{let{server:n}=kr(e),o=r.id,s=await ne(n,"resource_show",{id:o}),i=J(JSON.stringify(s,null,2));return{contents:[{uri:e.href,mimeType:"application/json",text:i}]}}catch(n){let o=n instanceof Error?n.message:String(n);return{contents:[{uri:e.href,mimeType:"text/plain",text:`Error fetching resource: ${o}`}]}}})}function Nv(t){t.registerResource("ckan-organization",new Ct("ckan://{server}/organization/{name}",{list:void 0}),{title:"CKAN Organization",description:"Access organization metadata from any CKAN server. URI format: ckan://{server}/organization/{name}",mimeType:"application/json"},async(e,r)=>{try{let{server:n}=kr(e),o=r.name,s=await ne(n,"organization_show",{id:o,include_datasets:!1}),i=J(JSON.stringify(s,null,2));return{contents:[{uri:e.href,mimeType:"application/json",text:i}]}}catch(n){let o=n instanceof Error?n.message:String(n);return{contents:[{uri:e.href,mimeType:"text/plain",text:`Error fetching organization: ${o}`}]}}})}var ka=t=>t.replace(/["\\]/g,"\\$&"),NO=t=>{let e=t.trim(),r=[e],n=e.toUpperCase();return n!==e&&r.push(n),`(${["res_format","distribution_format"].flatMap(i=>r.map(a=>`${i}:"${ka(a)}"`)).join(" OR ")})`},za=(t,e)=>{t.registerResource(e.name,new Ct(e.template,{list:void 0}),{title:e.title,description:e.description,mimeType:"application/json"},async(r,n)=>{try{let{server:o}=kr(r),s=e.buildFq(n),i=await ne(o,"package_search",{q:"*:*",fq:s}),a=J(JSON.stringify(i,null,2));return{contents:[{uri:r.href,mimeType:"application/json",text:a}]}}catch(o){let s=o instanceof Error?o.message:String(o);return{contents:[{uri:r.href,mimeType:"text/plain",text:`Error fetching datasets: ${s}`}]}}})};function Av(t){za(t,{name:"ckan-group-datasets",template:"ckan://{server}/group/{name}/datasets",title:"CKAN Group Datasets",description:"List datasets in a CKAN group (theme). URI format: ckan://{server}/group/{name}/datasets",buildFq:e=>`groups:"${ka(e.name)}"`})}function Iv(t){za(t,{name:"ckan-organization-datasets",template:"ckan://{server}/organization/{name}/datasets",title:"CKAN Organization Datasets",description:"List datasets for a CKAN organization. URI format: ckan://{server}/organization/{name}/datasets",buildFq:e=>`organization:"${ka(e.name)}"`})}function Cv(t){za(t,{name:"ckan-tag-datasets",template:"ckan://{server}/tag/{name}/datasets",title:"CKAN Tag Datasets",description:"List datasets matching a CKAN tag. URI format: ckan://{server}/tag/{name}/datasets",buildFq:e=>`tags:"${ka(e.name)}"`})}function jv(t){za(t,{name:"ckan-format-datasets",template:"ckan://{server}/format/{format}/datasets",title:"CKAN Format Datasets",description:"List datasets by resource format. URI format: ckan://{server}/format/{format}/datasets",buildFq:e=>NO(e.format)})}function Mv(t){Pv(t),Ov(t),Nv(t),Av(t),Iv(t),Cv(t),jv(t)}var Zt=t=>({messages:[{role:"user",content:{type:"text",text:t}}]});var AO="ckan-search-by-theme",IO=(t,e,r)=>`# Guided search: datasets by theme
|
|
@@ -712,7 +712,7 @@ For aggregates, use SQL:
|
|
|
712
712
|
ckan_datastore_search_sql({
|
|
713
713
|
server_url: "${t}",
|
|
714
714
|
sql: "SELECT * FROM "<resource-id>" LIMIT 10"
|
|
715
|
-
})`,Uv=t=>{t.registerPrompt(LO,{title:"Analyze a dataset",description:"Guided prompt to inspect dataset metadata and explore DataStore tables.",argsSchema:{server_url:$.string().url().describe("Base URL of the CKAN server"),id:$.string().min(1).describe("Dataset id or name (CKAN package id)")}},async({server_url:e,id:r})=>Zt(UO(e,r)))};var Fv=t=>{Zv(t),qv(t),Dv(t),Lv(t),Uv(t)};function Vv(){return new aa({name:"ckan-mcp-server",version:"0.4.
|
|
715
|
+
})`,Uv=t=>{t.registerPrompt(LO,{title:"Analyze a dataset",description:"Guided prompt to inspect dataset metadata and explore DataStore tables.",argsSchema:{server_url:$.string().url().describe("Base URL of the CKAN server"),id:$.string().min(1).describe("Dataset id or name (CKAN package id)")}},async({server_url:e,id:r})=>Zt(UO(e,r)))};var Fv=t=>{Zv(t),qv(t),Dv(t),Lv(t),Uv(t)};function Vv(){return new aa({name:"ckan-mcp-server",version:"0.4.24"})}function Hv(t){vv(t),bv(t),xv(t),wv(t),$v(t),kv(t),Rv(t),Mv(t),Fv(t)}var Ta=class{constructor(e={}){this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,r,n,o){let s={code:r,message:n};return o?.data!==void 0&&(s.data=o.data),new Response(JSON.stringify({jsonrpc:"2.0",error:s,id:null}),{status:e,headers:{"Content-Type":"application/json",...o?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let n=`Invalid Host header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let n=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}}}async handleRequest(e,r){let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case"POST":return this.handlePostRequest(e,r);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,r,n,o){if(!this._eventStore||o<"2025-11-25")return;let s=await this._eventStore.storeEvent(n,{}),i=`id: ${s}
|
|
716
716
|
data:
|
|
717
717
|
|
|
718
718
|
`;this._retryInterval!==void 0&&(i=`id: ${s}
|
|
@@ -895,8 +895,8 @@ data:
|
|
|
895
895
|
<pre><code>curl ${e.origin}/health</code></pre>
|
|
896
896
|
|
|
897
897
|
<div class="footer">
|
|
898
|
-
Version 0.4.
|
|
898
|
+
Version 0.4.24 \u2022 Running on Cloudflare Workers \u2022 <a href="https://github.com/ondata/ckan-mcp-server/blob/main/LICENSE.txt" target="_blank">MIT License</a>
|
|
899
899
|
</div>
|
|
900
900
|
</div>
|
|
901
901
|
</body>
|
|
902
|
-
</html>`,{headers:{"Content-Type":"text/html; charset=utf-8","Access-Control-Allow-Origin":"*"}});if(t.method==="GET"&&e.pathname==="/health")return new Response(JSON.stringify({status:"ok",version:"0.4.
|
|
902
|
+
</html>`,{headers:{"Content-Type":"text/html; charset=utf-8","Access-Control-Allow-Origin":"*"}});if(t.method==="GET"&&e.pathname==="/health")return new Response(JSON.stringify({status:"ok",version:"0.4.24",tools:14,resources:7,prompts:5,runtime:"cloudflare-workers"}),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});if(e.pathname==="/mcp")try{let r=await Jv.handleRequest(t),n=new Headers(r.headers);return n.set("Access-Control-Allow-Origin","*"),new Response(r.body,{status:r.status,statusText:r.statusText,headers:n})}catch(r){return console.error("Worker error:",r),new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32603,message:"Internal error",data:r instanceof Error?r.message:String(r)},id:null}),{status:500,headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}return new Response("Not Found",{status:404,headers:{"Access-Control-Allow-Origin":"*"}})}};export{o4 as default};
|