@sura_ai/mcp-server 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ ${J}`}function k7($){let I=[];I.push(`[workspace context | default org:${$.defau
69
69
  No results.`;let A=[I,...D?["hasMore"]:[]].join(", "),w=[`[results:${U} found, ${A}]`];if(I==="library"){let b=$.results,N=b.some((B)=>B.literatureMetadata),O=b.some((B)=>B.creatorName),X=b.some((B)=>B.updatedAt),W=N?"{type,title,id,relevance,tags,doi,firstAuthor,year,journal":"{type,title,id,relevance,tags",Q=O?`${W},creator`:W;if(X)Q+=",updatedAt";Q+=",snippet}",w.push(`${Q}[${b.length}]:`);for(let B of b){let Y=B.bestSnippet??B.snippet??"",J=Y.length>120?`${Y.slice(0,117)}...`:Y,H=B.tags?.join(" | ")??"",v=B.creatorName??"",V=B.updatedAt??"";if(N){let F=B.literatureMetadata,k=[B.entityType,B.entityTitle,B.entityId,B.relevance,H,F?.doi??"",F?.firstAuthor??"",F?.year??"",F?.journal??""];if(O)k.push(v);if(X)k.push(V);k.push(J),w.push(P$(k))}else{let F=[B.entityType,B.entityTitle,B.entityId,B.relevance,H];if(O)F.push(v);if(X)F.push(V);F.push(J),w.push(P$(F))}}}else{let b=$.results,N=b.some((X)=>X.creatorName),O=N?"{type,title,entityId,blockId,creator,snippet}":"{type,title,entityId,blockId,snippet}";w.push(`${O}[${b.length}]:`);for(let X of b){let W=X.bestSnippet??X.snippet??"",Q=W.length>120?`${W.slice(0,117)}...`:W,B=[X.entityType,X.entityTitle,X.entityId,X.blockId];if(N)B.push(X.creatorName??"");B.push(Q),w.push(P$(B))}}return w.join(`
70
70
  `)}function YF($){if($.length===0)return"";let I=[`[toc:${$.length} sections]`,`{title,level,tokens,ownTokens,blockId}[${$.length}]:`];for(let U of $)I.push(P$([U.title,U.level,U.estimatedTokens??0,U.ownTokens??0,U.blockId]));return I.join(`
71
71
  `)}function Cu($){if($.length===0)return"";let I=[`[regions:${$.length}]`,`{title,kind,tokens,blocks,retrievalHint}[${$.length}]:`];for(let U of $)I.push(P$([U.title,U.kind,U.estimatedTokens??0,U.blockCount,U.retrievalHint]));return I.join(`
72
- `)}function QI($,I){return`${{literature:"lit",document:"doc",record:"rec",artifact:"art"}[$]??$.slice(0,3)}-${I.slice(0,8)}`}function Zu($){let I=[],U=$.direction==="forward"?"→":"←",D=$.direction==="forward"?"↗":"↙";if($.type==="annotation")D="\uD83D\uDCDD";else if($.type==="citation")D="\uD83D\uDCD6";let A=$.dstEntityType??$.dstScope,w=$.dstTitle||$.dstId.slice(0,8),b=QI(A,$.dstId),N=[$.type,$.direction,`via ${$.provenance}`];if(typeof $.weight==="number"&&$.weight>1)N.push(`shared by ${$.weight} records`);if(I.push(` ${D} ${U} ${A}: ${w} (${b}, ${N.join(" · ")})`),$.text)I.push(` "${$.text}"`);if($.snippet)I.push(` — ${$.snippet}`);return I}function gu($,I){let U=I.reduce((D,A)=>Math.max(D,A.hop),0);for(let D=1;D<=U;D++){let A=I.filter((w)=>w.hop===D);if(A.length===0)continue;$.push(""),$.push(`*Hop ${D}* (${A.length} edges):`);for(let w of A)for(let b of Zu(w))$.push(b)}}function WF($,I,U){if(U.length===0)return;$.push(""),$.push(`*${I}* (${U.length}):`);for(let D of U)$.push(` • ${D.type}: ${D.title} (${QI(D.type,D.id)})`)}function xu($){let I=[],U=$.dstEntityType??$.dstScope,D=`${U}: ${$.dstTitle||$.dstId.slice(0,8)} (${QI(U,$.dstId)})`,A=typeof $.weight==="number"&&$.weight>1?` · ×${$.weight}`:"",w=$.origin?.scope==="node"&&$.origin.nodeLabel?` · via «${$.origin.nodeLabel}»`:"",b=$.direction==="inverse"?`←${$.type}— ${D}`:`—${$.type}→ ${D}`;if(I.push(` ${b}${A}${w}`),$.text)I.push(` "${$.text}"`);if($.snippet)I.push(` — ${$.snippet}`);return I}function j7($,I){$.set(I,($.get(I)??0)+1)}function hu($){let I=new Map,U=new Map,D=new Map;for(let A of $){for(let w of[A.srcId,A.dstId])j7(I,w);j7(D,A.srcId),j7(U,A.dstId)}return{total:I,in:U,out:D}}function fu($,I,U){let D=[...I.total.entries()].map(([w,b])=>({node:U.get(w),n:b})).filter((w)=>w.node!==void 0).sort((w,b)=>b.n-w.n).slice(0,5);if(D.length===0)return;let A=D.map(({node:w,n:b})=>{let N=I.in.get(w.id)??0,O=I.out.get(w.id)??0,X=N>=2*Math.max(O,1)?" (sink)":"";return`${w.title} (${QI(w.type,w.id)}) ×${b}${X}`});$.push(`*Most connected*: ${A.join(" · ")}`)}function yu($,I,U,D){let A=new Map;for(let N of I){let O=A.get(N.srcId);if(O)O.push(N);else A.set(N.srcId,[N])}let w=(N)=>U.get(N)?.title??N,b=[...A.entries()].sort((N,O)=>{let X=O[1].length-N[1].length;if(X!==0)return X;let W=(D.in.get(O[0])??0)-(D.in.get(N[0])??0);if(W!==0)return W;return w(N[0]).localeCompare(w(O[0]))});$.push(""),$.push(`*Edges by source* (${I.length} edges):`);for(let[N,O]of b){let X=U.get(N),W=X?`${X.type}: ${X.title} (${QI(X.type,X.id)})`:N.slice(0,8),Q=D.in.get(N)??0;$.push(` ▸ ${W} [out ${O.length} · in ${Q}]`);for(let B of O)for(let Y of xu(B))$.push(Y)}}function uu($){let I=[],U=$.nodes??[],D=$.edges??[],A=new Map(U.map((O)=>[O.id,O])),w=hu(D),b=$.spaceId?QI("space",$.spaceId):"space";I.push(`**Space graph** (${b})`);let N=[`${$.seedCount??0} seeds`,`${U.length} nodes`,`${D.length} edges`,`depth ${$.depth??0}`];if($.truncated)N.push("truncated (large/busy space — situate a specific node for more)");if(I.push(`*${N.join(" · ")}*`),fu(I,w,A),WF(I,"In-space",U.filter((O)=>O.inSpace)),WF(I,"Connected borders",U.filter((O)=>!O.inSpace)),D.length===0)return I.push(""),I.push("*No relationships among these entities.*"),I.join(`
72
+ `)}function QI($,I){return`${{literature:"lit",document:"doc",record:"rec",artifact:"art"}[$]??$.slice(0,3)}-${I.slice(0,8)}`}function Zu($){let I=[],U=$.direction==="forward"?"→":"←",D=$.direction==="forward"?"↗":"↙";if($.type==="annotation")D="\uD83D\uDCDD";else if($.type==="citation")D="\uD83D\uDCD6";let A=$.dstEntityType??$.dstScope,w=$.dstTitle||$.dstId.slice(0,8),b=QI(A,$.dstId),N=[$.type,$.direction,`via ${$.provenance}`];if(typeof $.weight==="number"&&$.weight>1)N.push(`shared by ${$.weight} records`);if(I.push(` ${D} ${U} ${A}: ${w} (${b}, ${N.join(" · ")})`),$.text)I.push(` "${$.text}"`);if($.snippet)I.push(` — ${$.snippet}`);return I}function gu($,I){let U=I.reduce((D,A)=>Math.max(D,A.hop),0);for(let D=1;D<=U;D++){let A=I.filter((w)=>w.hop===D);if(A.length===0)continue;$.push(""),$.push(`*Hop ${D}* (${A.length} edges):`);for(let w of A)for(let b of Zu(w))$.push(b)}}function WF($,I,U){if(U.length===0)return;$.push(""),$.push(`*${I}* (${U.length}):`);for(let D of U)$.push(` • ${D.type}: ${D.title} (${QI(D.type,D.id)})`)}function xu($){let I=[],U=$.dstEntityType??$.dstScope,D=`${U}: ${$.dstTitle||$.dstId.slice(0,8)} (${QI(U,$.dstId)})`,A=typeof $.weight==="number"&&$.weight>1?` · ×${$.weight}`:"",w=$.origin?.scope==="node"&&$.origin.nodeLabel?` · via «${$.origin.nodeLabel}»`:"",b=$.direction==="inverse"?`←${$.type}— ${D}`:`—${$.type}→ ${D}`;if(I.push(` ${b}${A}${w}`),$.text)I.push(` "${$.text}"`);if($.snippet)I.push(` — ${$.snippet}`);return I}function j7($,I){$.set(I,($.get(I)??0)+1)}function hu($){let I=new Map,U=new Map,D=new Map;for(let A of $){for(let N of[A.srcId,A.dstId])j7(I,N);let w=A.direction==="inverse"?A.dstId:A.srcId,b=A.direction==="inverse"?A.srcId:A.dstId;j7(D,w),j7(U,b)}return{total:I,in:U,out:D}}function fu($,I,U){let D=[...I.total.entries()].map(([w,b])=>({node:U.get(w),n:b})).filter((w)=>w.node!==void 0).sort((w,b)=>b.n-w.n).slice(0,5);if(D.length===0)return;let A=D.map(({node:w,n:b})=>{let N=I.in.get(w.id)??0,O=I.out.get(w.id)??0,X=N>=2*Math.max(O,1)?" (sink)":"";return`${w.title} (${QI(w.type,w.id)}) ×${b}${X}`});$.push(`*Most connected*: ${A.join(" · ")}`)}function yu($,I,U,D){let A=new Map;for(let N of I){let O=A.get(N.srcId);if(O)O.push(N);else A.set(N.srcId,[N])}let w=(N)=>U.get(N)?.title??N,b=[...A.entries()].sort((N,O)=>{let X=(D.total.get(O[0])??0)-(D.total.get(N[0])??0);if(X!==0)return X;let W=(D.out.get(O[0])??0)-(D.out.get(N[0])??0);if(W!==0)return W;return w(N[0]).localeCompare(w(O[0]))});$.push(""),$.push(`*Edges by source* (${I.length} edges):`);for(let[N,O]of b){let X=U.get(N),W=X?`${X.type}: ${X.title} (${QI(X.type,X.id)})`:N.slice(0,8),Q=D.out.get(N)??0,B=D.in.get(N)??0;$.push(` ▸ ${W} [out ${Q} · in ${B}]`);for(let Y of O)for(let J of xu(Y))$.push(J)}}function uu($){let I=[],U=$.nodes??[],D=$.edges??[],A=new Map(U.map((O)=>[O.id,O])),w=hu(D),b=$.spaceId?QI("space",$.spaceId):"space";I.push(`**Space graph** (${b})`);let N=[`${$.seedCount??0} seeds`,`${U.length} nodes`,`${D.length} edges`,`depth ${$.depth??0}`];if($.truncated)N.push("truncated (large/busy space — situate a specific node for more)");if(I.push(`*${N.join(" · ")}*`),fu(I,w,A),WF(I,"In-space",U.filter((O)=>O.inSpace)),WF(I,"Connected borders",U.filter((O)=>!O.inSpace)),D.length===0)return I.push(""),I.push("*No relationships among these entities.*"),I.join(`
73
73
  `);return yu(I,D,A,w),I.join(`
74
74
  `)}function R7($){if(!$.found)return JSON.stringify({found:!1,error:$.error??"Entity not found"});if($.mode==="space")return uu($);let I=[],U=$.root,D=U?QI(U.type,U.id):"unknown";I.push(`**Situated:** ${U?.type??"entity"} "${U?.title??""}" (${D})`);let A=[`depth ${$.depth??0}`,`${$.nodes?.length??0} nodes`,`${$.edges?.length??0} edges`];if($.truncated)A.push("truncated (busy hop — re-situate a specific node for more)");I.push(`*${A.join(" · ")}*`);let w=$.edges??[];if(w.length===0)return I.push(""),I.push("*No connections within the traversed depth.*"),I.join(`
75
75
  `);return gu(I,w),I.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sura_ai/mcp-server",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "SURA MCP server - search, read, and edit your research workspace from any AI assistant",
5
5
  "type": "module",
6
6
  "bin": {