infranodus-mcp-server 1.7.0 → 1.7.3
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/README.md +27 -20
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +8 -2
- package/dist/api/client.js.map +1 -1
- package/dist/api/config-store.d.ts +2 -0
- package/dist/api/config-store.d.ts.map +1 -1
- package/dist/api/config-store.js +7 -0
- package/dist/api/config-store.js.map +1 -1
- package/dist/auth/oauth-provider.d.ts +3 -2
- package/dist/auth/oauth-provider.d.ts.map +1 -1
- package/dist/auth/oauth-provider.js +83 -28
- package/dist/auth/oauth-provider.js.map +1 -1
- package/dist/http-server.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/instructions.js +2 -2
- package/dist/resources/about.d.ts.map +1 -1
- package/dist/resources/about.js +15 -14
- package/dist/resources/about.js.map +1 -1
- package/dist/schemas/index.d.ts +452 -15
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +190 -32
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/addMemory.d.ts +4 -2
- package/dist/tools/addMemory.d.ts.map +1 -1
- package/dist/tools/addMemory.js +15 -1
- package/dist/tools/addMemory.js.map +1 -1
- package/dist/tools/analyzeExistingGraph.d.ts +1 -0
- package/dist/tools/analyzeExistingGraph.d.ts.map +1 -1
- package/dist/tools/analyzeExistingGraph.js +13 -4
- package/dist/tools/analyzeExistingGraph.js.map +1 -1
- package/dist/tools/analyzeText.d.ts +5 -0
- package/dist/tools/analyzeText.d.ts.map +1 -1
- package/dist/tools/analyzeText.js +18 -21
- package/dist/tools/analyzeText.js.map +1 -1
- package/dist/tools/createKnowledgeGraph.d.ts +6 -0
- package/dist/tools/createKnowledgeGraph.d.ts.map +1 -1
- package/dist/tools/createKnowledgeGraph.js +25 -22
- package/dist/tools/createKnowledgeGraph.js.map +1 -1
- package/dist/tools/developConceptualBridges.d.ts +3 -0
- package/dist/tools/developConceptualBridges.d.ts.map +1 -1
- package/dist/tools/developConceptualBridges.js +5 -17
- package/dist/tools/developConceptualBridges.js.map +1 -1
- package/dist/tools/developLatentTopics.d.ts +3 -0
- package/dist/tools/developLatentTopics.d.ts.map +1 -1
- package/dist/tools/developLatentTopics.js +5 -17
- package/dist/tools/developLatentTopics.js.map +1 -1
- package/dist/tools/developTextTool.d.ts +3 -0
- package/dist/tools/developTextTool.d.ts.map +1 -1
- package/dist/tools/developTextTool.js +9 -19
- package/dist/tools/developTextTool.js.map +1 -1
- package/dist/tools/generateContentGaps.d.ts +3 -0
- package/dist/tools/generateContentGaps.d.ts.map +1 -1
- package/dist/tools/generateContentGaps.js +5 -17
- package/dist/tools/generateContentGaps.js.map +1 -1
- package/dist/tools/generateContextualHint.d.ts +3 -0
- package/dist/tools/generateContextualHint.d.ts.map +1 -1
- package/dist/tools/generateContextualHint.js +5 -17
- package/dist/tools/generateContextualHint.js.map +1 -1
- package/dist/tools/generateDifferenceGraphFromTexts.d.ts +15 -3
- package/dist/tools/generateDifferenceGraphFromTexts.d.ts.map +1 -1
- package/dist/tools/generateDifferenceGraphFromTexts.js +9 -30
- package/dist/tools/generateDifferenceGraphFromTexts.js.map +1 -1
- package/dist/tools/generateKnowledgeGraph.d.ts +6 -0
- package/dist/tools/generateKnowledgeGraph.d.ts.map +1 -1
- package/dist/tools/generateKnowledgeGraph.js +19 -22
- package/dist/tools/generateKnowledgeGraph.js.map +1 -1
- package/dist/tools/generateMergedGraphFromTexts.d.ts +15 -3
- package/dist/tools/generateMergedGraphFromTexts.d.ts.map +1 -1
- package/dist/tools/generateMergedGraphFromTexts.js +9 -30
- package/dist/tools/generateMergedGraphFromTexts.js.map +1 -1
- package/dist/tools/generateOntologyGraph.d.ts +2 -0
- package/dist/tools/generateOntologyGraph.d.ts.map +1 -1
- package/dist/tools/generateOntologyGraph.js +9 -2
- package/dist/tools/generateOntologyGraph.js.map +1 -1
- package/dist/tools/generateOverlapGraphFromTexts.d.ts +15 -3
- package/dist/tools/generateOverlapGraphFromTexts.d.ts.map +1 -1
- package/dist/tools/generateOverlapGraphFromTexts.js +9 -30
- package/dist/tools/generateOverlapGraphFromTexts.js.map +1 -1
- package/dist/tools/generateResearchIdeas.d.ts +3 -0
- package/dist/tools/generateResearchIdeas.d.ts.map +1 -1
- package/dist/tools/generateResearchIdeas.js +5 -17
- package/dist/tools/generateResearchIdeas.js.map +1 -1
- package/dist/tools/generateResearchQuestions.d.ts +3 -0
- package/dist/tools/generateResearchQuestions.d.ts.map +1 -1
- package/dist/tools/generateResearchQuestions.js +5 -17
- package/dist/tools/generateResearchQuestions.js.map +1 -1
- package/dist/tools/generateResponses.d.ts +3 -0
- package/dist/tools/generateResponses.d.ts.map +1 -1
- package/dist/tools/generateResponses.js +5 -17
- package/dist/tools/generateResponses.js.map +1 -1
- package/dist/tools/generateSEOGraphTool.d.ts +2 -0
- package/dist/tools/generateSEOGraphTool.d.ts.map +1 -1
- package/dist/tools/generateSEOGraphTool.js +47 -9
- package/dist/tools/generateSEOGraphTool.js.map +1 -1
- package/dist/tools/generateTopicalClusters.d.ts +3 -0
- package/dist/tools/generateTopicalClusters.d.ts.map +1 -1
- package/dist/tools/generateTopicalClusters.js +5 -17
- package/dist/tools/generateTopicalClusters.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/optimizeReasoning.d.ts +34 -0
- package/dist/tools/optimizeReasoning.d.ts.map +1 -0
- package/dist/tools/optimizeReasoning.js +84 -0
- package/dist/tools/optimizeReasoning.js.map +1 -0
- package/dist/tools/optimizeTextStructure.d.ts +3 -0
- package/dist/tools/optimizeTextStructure.d.ts.map +1 -1
- package/dist/tools/optimizeTextStructure.js +7 -19
- package/dist/tools/optimizeTextStructure.js.map +1 -1
- package/dist/utils/graphInput.d.ts +72 -0
- package/dist/utils/graphInput.d.ts.map +1 -0
- package/dist/utils/graphInput.js +167 -0
- package/dist/utils/graphInput.js.map +1 -0
- package/dist/utils/wikilinksMode.d.ts +65 -0
- package/dist/utils/wikilinksMode.d.ts.map +1 -0
- package/dist/utils/wikilinksMode.js +188 -0
- package/dist/utils/wikilinksMode.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,111 +73,118 @@ InfraNodus MCP Server enables LLM workflows and AI assistants to analyze text us
|
|
|
73
73
|
- If the text is dispersed, focus the most common gap topics to improve coherence
|
|
74
74
|
- Choose response type: response, idea, question, or transcend
|
|
75
75
|
|
|
76
|
-
10. **
|
|
76
|
+
10. **optimize_reasoning**
|
|
77
|
+
- Applies the same bias/coherence analysis to the model's own reasoning trace or chat with the user (pass it as `text`)
|
|
78
|
+
- Detects whether the reasoning is biased, focused, diversified, or dispersed
|
|
79
|
+
- Steers the reasoning toward optimal diversity and coherence at the same time
|
|
80
|
+
- If too biased, develop the under-represented topics; if focused or diversified, bridge the content gaps; if dispersed, focus the most common gap topics
|
|
81
|
+
- Returns a structural diagnosis (diversity stats, topical clusters, gaps) plus suggestions for how to continue thinking
|
|
82
|
+
|
|
83
|
+
11. **generate_responses_from_graph**
|
|
77
84
|
- Generate responses based on an existing InfraNodus graph
|
|
78
85
|
- Integrate them into your LLM workflows and AI assistants
|
|
79
86
|
- Use any AI model (included in InfraNodus API)
|
|
80
87
|
- Use any prompt
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
12. **develop_conceptual_bridges**
|
|
83
90
|
- Analyze text and develop latent ideas based on concepts that connect this text to a broader discourse
|
|
84
91
|
- Discover hidden themes and patterns that link your text to wider contexts
|
|
85
92
|
- Use any AI model (included in InfraNodus API)
|
|
86
93
|
- Generate insights that help develop the discourse
|
|
87
94
|
|
|
88
|
-
|
|
95
|
+
13. **develop_latent_topics**
|
|
89
96
|
- Analyze text and extract underdeveloped topics with ideas on how to develop them
|
|
90
97
|
- Identify topics that need more attention and elaboration
|
|
91
98
|
- Use any AI model (included in InfraNodus API)
|
|
92
99
|
- Get actionable suggestions for content expansion
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
14. **develop_text_tool**
|
|
95
102
|
- Comprehensive text analysis combining content gap ideas, latent topics, and conceptual bridges
|
|
96
103
|
- Executes multiple analyses in sequence with progress tracking
|
|
97
104
|
- Generates research ideas based on content gaps
|
|
98
105
|
- Identifies latent topics and conceptual bridges to develop
|
|
99
106
|
- Finds content gaps for deeper exploration
|
|
100
107
|
|
|
101
|
-
|
|
108
|
+
15. **create_knowledge_graph**
|
|
102
109
|
- Create a knowledge graph in InfraNodus from text and provide a link to it
|
|
103
110
|
- Use it to create a knowledge graph in InfraNodus from text
|
|
104
111
|
|
|
105
|
-
|
|
112
|
+
16. **generate_ontology_graph**
|
|
106
113
|
- Use AI to generate a reasoning ontology graph (entities and the relations between them) from a topic, prompt, or text — e.g. "build an ontology on AI attention mechanisms"
|
|
107
114
|
- Saved as a persistent InfraNodus graph by default and a link is returned; set `saveGraph: false` if the user asks not to save, or when you only need a one-off AI ontology overview of a topic for the current context that won't be reused later (the generated statements are returned directly without persisting)
|
|
108
115
|
- `modelToUse` defaults to `claude-opus-4.6` for richer ontologies; pick `-mini`/`-lite` variants (or `gpt-4o-mini`) for faster, cheaper generation
|
|
109
116
|
- Returns the compact graph structure (`knowledgeGraph`) and analytics (main topical clusters, content gaps, top influential nodes, top relations, statistics) by default. Set `includeGraph: false` to save context space when only the ontology statements or insights are needed. Set `includeAnalytics: false` if you just need the raw ontology without graph-derived insights — keep it on whenever you want to understand the structure, gaps, or key concepts
|
|
110
117
|
|
|
111
|
-
|
|
118
|
+
17. **analyze_llm_results**
|
|
112
119
|
- Ask an LLM to describe a topic and turn its response into a knowledge graph that reveals how the model frames it — main concepts, clusters, content gaps, and the relations between them
|
|
113
120
|
- Use it to probe model bias, surface the implicit structure of an LLM's view on a subject, or compare how different models describe the same topic
|
|
114
121
|
- `modelToUse` defaults to `claude-opus-4.6`; pick the model you actually want to study
|
|
115
122
|
- `modifyAnalyzedText` controls how the LLM output is parsed: `'detectEntities'` (default — mixed entities + words), `'extractEntitiesOnly'` (entity-only graph), or `'none'` (plain co-occurrence)
|
|
116
123
|
- Saves the graph by default; set `saveGraph: false` for a one-off probe. Returns analytics by default and omits the raw graph (`includeGraph: false`) to keep responses compact — enable `includeGraph` when you also need nodes/edges
|
|
117
124
|
|
|
118
|
-
|
|
125
|
+
18. **overlap_between_texts**
|
|
119
126
|
- Create knowledge graphs from two or more texts and find the overlap (similarities) between them
|
|
120
127
|
- Use it to find similar topics and keywords across different texts
|
|
121
128
|
|
|
122
|
-
|
|
129
|
+
19. **merged_graph_from_texts**
|
|
123
130
|
- Build a graph of all the texts and URLs provided, providing topical clusters and gaps present in the merged graph generated from all the texts
|
|
124
131
|
- Use it to combine multiple sources into one graph and see clusters and content gaps across the merged content
|
|
125
132
|
|
|
126
|
-
|
|
133
|
+
20. **difference_between_texts**
|
|
127
134
|
- Compare knowledge graphs from two or more texts and find what's not present in the first graph that's present in the others
|
|
128
135
|
- Use it to find how one text can be enriched with the others
|
|
129
136
|
|
|
130
|
-
|
|
137
|
+
21. **analyze_google_search_results**
|
|
131
138
|
- Generate a graph with keywords and topics for Google search results for a certain query
|
|
132
139
|
- Use it to understand the current informational supply (what people find)
|
|
133
140
|
|
|
134
|
-
|
|
141
|
+
22. **analyze_youtube_results**
|
|
135
142
|
- Generate a graph with keywords and topics from YouTube results for a query, channel, or playlist
|
|
136
143
|
- Choose what to pull via `searchMode`: `search` (video metadata for a search term), `comments` (comments on a video), `channel` (a channel's videos — pass a username, URL, or @handle), `playlist` (a playlist's videos — pass a playlist ID or a URL with `list=`), `subtitles` / `subtitlesChannel` / `subtitlesPlaylist` (transcribed subtitles of a video / channel / playlist), or `searchVideos` (analyzes the content of the videos found — limit hard-capped to 20)
|
|
137
144
|
- Control results with `limit` (default 100, max 2000), `sortBy` (`Popular` / `Oldest` / `Latest`), `excludeDescriptions`, `importLanguage`, and `importRegion`
|
|
138
145
|
- Use it to understand the topics, clusters, and content gaps in the discourse around a video, channel, playlist, or search term on YouTube
|
|
139
146
|
|
|
140
|
-
|
|
147
|
+
23. **analyze_related_search_queries**
|
|
141
148
|
- Generate a graph from the search queries suggested by Google for a certain query
|
|
142
149
|
- Use it to understand the current informational demand (what people are looking for)
|
|
143
150
|
|
|
144
|
-
|
|
151
|
+
24. **search_queries_vs_search_results**
|
|
145
152
|
- Generate a graph of keyword combinations and topics people tend to search for that do not readily appear in the search results for the same queries
|
|
146
153
|
- Use it to understand what people search for but don't yet find
|
|
147
154
|
|
|
148
|
-
|
|
155
|
+
25. **generate_seo_report**
|
|
149
156
|
- Analyze content for SEO optimization by comparing it with Google search results and search queries
|
|
150
157
|
- Identify content gaps and opportunities for better search visibility
|
|
151
158
|
- Get comprehensive analysis of what's in search results but not in your text
|
|
152
159
|
- Discover what people search for but don't find in current results
|
|
153
160
|
|
|
154
|
-
|
|
161
|
+
26. **memory_add_relations**
|
|
155
162
|
- Add relations to the InfraNodus memory from text
|
|
156
163
|
- Automatically detect entities or use [[wikilinks]] syntax to mark them
|
|
157
164
|
- Save memory to a specified graph name for future retrieval
|
|
158
165
|
- Support automatic entity extraction or manual entity marking
|
|
159
166
|
- Provide links to created memory graphs for easy access
|
|
160
167
|
|
|
161
|
-
|
|
168
|
+
27. **memory_get_relations**
|
|
162
169
|
- Retrieve relations from InfraNodus memory for specific entities
|
|
163
170
|
- Search for entity relations using [[wikilinks]] syntax
|
|
164
171
|
- Query specific memory contexts or search across all memory graphs
|
|
165
172
|
- Extract statements and relationships from stored knowledge graphs
|
|
166
173
|
- Support both entity-specific searches and full context retrieval
|
|
167
174
|
|
|
168
|
-
|
|
175
|
+
28. **retrieve_from_knowledge_base**
|
|
169
176
|
- Retrieve context from an existing InfraNodus knowledge graph using GraphRAG
|
|
170
177
|
- Query your knowledge base with a natural language prompt to get relevant statements
|
|
171
178
|
- Include graph summaries for quick overviews of the knowledge structure
|
|
172
179
|
- Optionally retrieve the full graph, statements, or extended analysis
|
|
173
180
|
- Ideal for augmenting LLM responses with domain-specific knowledge
|
|
174
181
|
|
|
175
|
-
|
|
182
|
+
29. **search**
|
|
176
183
|
- Search through existing InfraNodus graphs
|
|
177
184
|
- Also use it to search through the public graphs of a specific user
|
|
178
185
|
- Compatible with ChatGPT Deep Research mode via Developer Mode > Connectors
|
|
179
186
|
|
|
180
|
-
|
|
187
|
+
30. **fetch**
|
|
181
188
|
- Fetch a specific search result for a graph
|
|
182
189
|
- Can be used in ChatGPT Deep Research mode via Developer Mode > Connectors
|
|
183
190
|
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,GAAG,EACT,MAAM,GAAE,MAAe,GACrB,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,wBAAsB,qBAAqB,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,GAAG,EACT,MAAM,GAAE,MAAe,GACrB,OAAO,CAAC,aAAa,CAAC,CAsCxB"}
|
package/dist/api/client.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { getConfig } from "./config-store.js";
|
|
1
|
+
import { getConfig, getCurrentTool } from "./config-store.js";
|
|
2
2
|
import { brandSource } from "../config/brand.js";
|
|
3
3
|
export async function makeInfraNodusRequest(endpoint, body, method = "POST") {
|
|
4
4
|
try {
|
|
5
5
|
const config = getConfig();
|
|
6
|
-
const
|
|
6
|
+
const tool = getCurrentTool();
|
|
7
|
+
const requestBody = {
|
|
8
|
+
...body,
|
|
9
|
+
modal: "mcp_server",
|
|
10
|
+
source: brandSource(),
|
|
11
|
+
...(tool && { tool }),
|
|
12
|
+
};
|
|
7
13
|
const response = await fetch(`${config.apiBase}${endpoint}`, {
|
|
8
14
|
method,
|
|
9
15
|
headers: {
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,QAAgB,EAChB,IAAS,EACT,SAAiB,MAAM;IAEvB,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAE3B,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG;YACnB,GAAG,IAAI;YACP,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,WAAW,EAAE;YACrB,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;SACrB,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,QAAQ,EAAE,EAAE;YAC5D,MAAM;YACN,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;aACxC;YACD,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;SAC9D,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEnC,iCAAiC;QACjC,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,wBAAwB,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,0DAA0D;QAC1D,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Config } from "../config/index.js";
|
|
2
2
|
export declare function runWithConfig<T>(config: Config, fn: () => T): T;
|
|
3
|
+
export declare function runWithTool<T>(toolName: string, fn: () => T): T;
|
|
4
|
+
export declare function getCurrentTool(): string | undefined;
|
|
3
5
|
export declare function getConfig(): Config;
|
|
4
6
|
//# sourceMappingURL=config-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-store.d.ts","sourceRoot":"","sources":["../../src/api/config-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-store.d.ts","sourceRoot":"","sources":["../../src/api/config-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM5C,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE/D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE/D;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAMlC"}
|
package/dist/api/config-store.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { brandApiBase } from "../config/brand.js";
|
|
3
3
|
const configStorage = new AsyncLocalStorage();
|
|
4
|
+
const toolStorage = new AsyncLocalStorage();
|
|
4
5
|
export function runWithConfig(config, fn) {
|
|
5
6
|
return configStorage.run(config, fn);
|
|
6
7
|
}
|
|
8
|
+
export function runWithTool(toolName, fn) {
|
|
9
|
+
return toolStorage.run(toolName, fn);
|
|
10
|
+
}
|
|
11
|
+
export function getCurrentTool() {
|
|
12
|
+
return toolStorage.getStore();
|
|
13
|
+
}
|
|
7
14
|
export function getConfig() {
|
|
8
15
|
return (configStorage.getStore() ??
|
|
9
16
|
global.brandConfig ??
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-store.js","sourceRoot":"","sources":["../../src/api/config-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"config-store.js","sourceRoot":"","sources":["../../src/api/config-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAU,CAAC;AACtD,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAU,CAAC;AAEpD,MAAM,UAAU,aAAa,CAAI,MAAc,EAAE,EAAW;IAC3D,OAAO,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,QAAgB,EAAE,EAAW;IAC3D,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc;IAC7B,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,SAAS;IACxB,OAAO,CACN,aAAa,CAAC,QAAQ,EAAE;QACvB,MAAc,CAAC,WAAW;QAC3B,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,CACvC,CAAC;AACH,CAAC"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { InfraNodusUserInfo, TokenResponse, AuthenticatedRequest, RegisteredClient, ClientRegistrationRequest, ClientRegistrationResponse } from "./types.js";
|
|
6
6
|
/**
|
|
7
|
-
* Validate an API key
|
|
8
|
-
* Returns user info if valid, null if invalid
|
|
7
|
+
* Validate an API key against the /api/v1/userId endpoint, with a TTL cache.
|
|
8
|
+
* Returns user info if valid, null if invalid.
|
|
9
|
+
* Concurrent calls for the same key share one upstream request.
|
|
9
10
|
*/
|
|
10
11
|
export declare function validateApiKey(apiKey: string): Promise<InfraNodusUserInfo | null>;
|
|
11
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../../src/auth/oauth-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,kBAAkB,EAElB,aAAa,EAEb,oBAAoB,EACpB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAE1B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../../src/auth/oauth-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,kBAAkB,EAElB,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AAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAwC/B"}
|
|
@@ -19,41 +19,81 @@ const BRAND_API_BASE = brandApiBase();
|
|
|
19
19
|
function hashApiKey(apiKey) {
|
|
20
20
|
return crypto.createHash("sha256").update(apiKey).digest("hex").slice(0, 16);
|
|
21
21
|
}
|
|
22
|
+
// TTL cache for /userId validation results, keyed by SHA-256 of the API key.
|
|
23
|
+
// Raw-API-key clients hit the auth middleware on every request; without this,
|
|
24
|
+
// each request costs a round-trip to the brand API.
|
|
25
|
+
const validationCache = new Map();
|
|
26
|
+
const inFlightValidations = new Map();
|
|
27
|
+
const VALID_KEY_TTL_MS = 10 * 60 * 1000; // revoked keys keep working up to this long
|
|
28
|
+
const INVALID_KEY_TTL_MS = 60 * 1000; // short so a newly created key isn't blocked by a stale miss
|
|
29
|
+
const MAX_VALIDATION_CACHE_SIZE = 10000;
|
|
30
|
+
function validationCacheKey(apiKey) {
|
|
31
|
+
return crypto.createHash("sha256").update(apiKey).digest("hex");
|
|
32
|
+
}
|
|
22
33
|
/**
|
|
23
|
-
* Validate an API key
|
|
24
|
-
* Returns user info if valid, null if invalid
|
|
34
|
+
* Validate an API key against the /api/v1/userId endpoint, with a TTL cache.
|
|
35
|
+
* Returns user info if valid, null if invalid.
|
|
36
|
+
* Concurrent calls for the same key share one upstream request.
|
|
25
37
|
*/
|
|
26
38
|
export async function validateApiKey(apiKey) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
userName: data.userName,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
// Check for error indicators
|
|
48
|
-
if (!data || data.error || typeof data === "string") {
|
|
49
|
-
return null;
|
|
39
|
+
const cacheKey = validationCacheKey(apiKey);
|
|
40
|
+
const cached = validationCache.get(cacheKey);
|
|
41
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
42
|
+
return cached.result;
|
|
43
|
+
}
|
|
44
|
+
const pending = inFlightValidations.get(cacheKey);
|
|
45
|
+
if (pending) {
|
|
46
|
+
return pending;
|
|
47
|
+
}
|
|
48
|
+
const validation = fetchUserInfo(apiKey)
|
|
49
|
+
.then((result) => {
|
|
50
|
+
// Map iteration order is insertion order, so deleting the first
|
|
51
|
+
// entry evicts the oldest when the cap is reached
|
|
52
|
+
if (validationCache.size >= MAX_VALIDATION_CACHE_SIZE) {
|
|
53
|
+
const oldest = validationCache.keys().next().value;
|
|
54
|
+
if (oldest !== undefined)
|
|
55
|
+
validationCache.delete(oldest);
|
|
50
56
|
}
|
|
57
|
+
validationCache.set(cacheKey, {
|
|
58
|
+
result,
|
|
59
|
+
expiresAt: Date.now() + (result ? VALID_KEY_TTL_MS : INVALID_KEY_TTL_MS),
|
|
60
|
+
});
|
|
61
|
+
return result;
|
|
62
|
+
})
|
|
63
|
+
// Network errors are transient — treat as invalid but don't cache the failure
|
|
64
|
+
.catch(() => null)
|
|
65
|
+
.finally(() => {
|
|
66
|
+
inFlightValidations.delete(cacheKey);
|
|
67
|
+
});
|
|
68
|
+
inFlightValidations.set(cacheKey, validation);
|
|
69
|
+
return validation;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Call the /api/v1/userId endpoint. Returns user info for a valid key, null
|
|
73
|
+
* for a definitively invalid one, and throws on network errors so callers can
|
|
74
|
+
* distinguish transient failures from rejections.
|
|
75
|
+
*/
|
|
76
|
+
async function fetchUserInfo(apiKey) {
|
|
77
|
+
const response = await fetch(`${BRAND_API_BASE}/userId`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: {
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
Authorization: `Bearer ${apiKey}`,
|
|
82
|
+
},
|
|
83
|
+
body: JSON.stringify({}),
|
|
84
|
+
});
|
|
85
|
+
if (!response.ok) {
|
|
51
86
|
return null;
|
|
52
87
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
88
|
+
const data = await response.json();
|
|
89
|
+
// Check for valid response format: {"userId": 486, "userName": "circadian"}
|
|
90
|
+
if (data && typeof data.userId === "number" && typeof data.userName === "string") {
|
|
91
|
+
return {
|
|
92
|
+
userId: data.userId,
|
|
93
|
+
userName: data.userName,
|
|
94
|
+
};
|
|
56
95
|
}
|
|
96
|
+
return null;
|
|
57
97
|
}
|
|
58
98
|
/**
|
|
59
99
|
* Exchange an API key for a JWT access token
|
|
@@ -141,10 +181,25 @@ export function cleanupExpiredSessions() {
|
|
|
141
181
|
}
|
|
142
182
|
return cleaned;
|
|
143
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Clean up expired API key validation cache entries
|
|
186
|
+
*/
|
|
187
|
+
function cleanupValidationCache() {
|
|
188
|
+
const now = Date.now();
|
|
189
|
+
let cleaned = 0;
|
|
190
|
+
for (const [key, entry] of validationCache.entries()) {
|
|
191
|
+
if (now >= entry.expiresAt) {
|
|
192
|
+
validationCache.delete(key);
|
|
193
|
+
cleaned++;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return cleaned;
|
|
197
|
+
}
|
|
144
198
|
// Start periodic cleanup every 10 minutes
|
|
145
199
|
setInterval(() => {
|
|
146
200
|
cleanupExpiredSessions();
|
|
147
201
|
cleanupExpiredAuthCodes();
|
|
202
|
+
cleanupValidationCache();
|
|
148
203
|
}, 10 * 60 * 1000);
|
|
149
204
|
// ============================================================================
|
|
150
205
|
// OAuth2 Dynamic Client Registration (RFC 7591)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider.js","sourceRoot":"","sources":["../../src/auth/oauth-provider.ts"],"names":[],"mappings":"A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YAC/B,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAED,mEAAmE;IACnE,MAAM,aAAa,GAAG,wBAAwB,GAAG,IAAI,CAAC;IACtD,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QACrD,IAAI,GAAG,GAAG,SAAS,GAAG,aAAa,EAAE,CAAC;YACrC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
package/dist/http-server.js
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAc,MAAM,mBAAmB,CAAC;AAiD7D,OAAO,EAAE,YAAY,EAAE,CAAC;AAGxB,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACpC,MAAM,GACN,EAAE;IACF,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;CACrC;;;;;;;;;;;;;;;;;;;;;;GA8GA"}
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { configSchema, serverInfo } from "./config/index.js";
|
|
4
4
|
import { brand, brandApiKey, brandApiBase, isToolEnabled, } from "./config/brand.js";
|
|
5
|
-
import { generateKnowledgeGraphTool, createKnowledgeGraphTool, generateOntologyGraphTool, analyzeLlmResultsTool, addMemoryTool, getMemoryTool, analyzeExistingGraphTool, analyzeTextTool, generateContentGapsTool, generateTopicalClustersTool, generateResearchQuestionsTool, generateResearchIdeasTool, generateResponsesFromGraphTool, generateContextualHintTool, retrieveContextForPromptFromGraphTool, developConceptualBridgesTool, developLatentTopicsTool, optimizeTextStructureTool, listGraphsTool, searchExistingGraphsTool, searchExistingGraphsFetchTool, generateOverlapGraphFromTextsTool, generateMergedGraphFromTextsTool, generateDifferenceGraphFromTextsTool, generateGoogleSearchResultsGraphTool, generateYoutubeSearchResultsGraphTool, generateGoogleSearchQueriesGraphTool, generateGoogleResultsVsQueriesGraphTool, generateSEOGraphTool, developTextTool, } from "./tools/index.js";
|
|
5
|
+
import { generateKnowledgeGraphTool, createKnowledgeGraphTool, generateOntologyGraphTool, analyzeLlmResultsTool, addMemoryTool, getMemoryTool, analyzeExistingGraphTool, analyzeTextTool, generateContentGapsTool, generateTopicalClustersTool, generateResearchQuestionsTool, generateResearchIdeasTool, generateResponsesFromGraphTool, generateContextualHintTool, retrieveContextForPromptFromGraphTool, developConceptualBridgesTool, developLatentTopicsTool, optimizeTextStructureTool, optimizeReasoningTool, listGraphsTool, searchExistingGraphsTool, searchExistingGraphsFetchTool, generateOverlapGraphFromTextsTool, generateMergedGraphFromTextsTool, generateDifferenceGraphFromTextsTool, generateGoogleSearchResultsGraphTool, generateYoutubeSearchResultsGraphTool, generateGoogleSearchQueriesGraphTool, generateGoogleResultsVsQueriesGraphTool, generateSEOGraphTool, developTextTool, } from "./tools/index.js";
|
|
6
6
|
import { aboutResource } from "./resources/about.js";
|
|
7
7
|
import { llmsTxtResource, llmsFullTxtResource } from "./resources/llms-txt.js";
|
|
8
8
|
import { prompts } from "./prompts/index.js";
|
|
9
9
|
import { serverInstructions } from "./instructions.js";
|
|
10
10
|
import * as dotenv from "dotenv";
|
|
11
11
|
import * as mcpcat from "mcpcat";
|
|
12
|
-
import { runWithConfig } from "./api/config-store.js";
|
|
12
|
+
import { runWithConfig, runWithTool } from "./api/config-store.js";
|
|
13
13
|
// Export the config schema for Smithery
|
|
14
14
|
export { configSchema };
|
|
15
15
|
// Main function that creates and returns the server
|
|
@@ -21,12 +21,14 @@ export default function createServer({ config, }) {
|
|
|
21
21
|
instructions: serverInstructions,
|
|
22
22
|
});
|
|
23
23
|
// Wrap tool handlers so each invocation runs in an AsyncLocalStorage
|
|
24
|
-
|
|
24
|
+
// carrying both the config and the invoking tool's name (so API requests
|
|
25
|
+
// can tag which tool triggered them — see makeInfraNodusRequest).
|
|
26
|
+
const wrapHandler = (handler, toolName) => {
|
|
25
27
|
return async (params, extra) => {
|
|
26
|
-
return runWithConfig(config, () => handler(params, {
|
|
28
|
+
return runWithConfig(config, () => runWithTool(toolName, () => handler(params, {
|
|
27
29
|
progressToken: extra?._meta?.progressToken,
|
|
28
30
|
sendNotification: extra?.sendNotification,
|
|
29
|
-
}));
|
|
31
|
+
})));
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
// All tools are compiled in; the active brand decides which are exposed
|
|
@@ -50,6 +52,7 @@ export default function createServer({ config, }) {
|
|
|
50
52
|
developConceptualBridgesTool,
|
|
51
53
|
developLatentTopicsTool,
|
|
52
54
|
optimizeTextStructureTool,
|
|
55
|
+
optimizeReasoningTool,
|
|
53
56
|
developTextTool,
|
|
54
57
|
listGraphsTool,
|
|
55
58
|
searchExistingGraphsTool,
|
|
@@ -68,7 +71,7 @@ export default function createServer({ config, }) {
|
|
|
68
71
|
for (const tool of allTools) {
|
|
69
72
|
if (!isToolEnabled(tool.name))
|
|
70
73
|
continue;
|
|
71
|
-
mcpServer.registerTool(tool.name, tool.definition, wrapHandler(tool.handler));
|
|
74
|
+
mcpServer.registerTool(tool.name, tool.definition, wrapHandler(tool.handler, tool.name));
|
|
72
75
|
}
|
|
73
76
|
// Register resources
|
|
74
77
|
mcpServer.registerResource(aboutResource.name, aboutResource.uri, aboutResource.definition, aboutResource.handler);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACN,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,EAC1B,qCAAqC,EACrC,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,oCAAoC,EACpC,oCAAoC,EACpC,qCAAqC,EACrC,oCAAoC,EACpC,uCAAuC,EACvC,oBAAoB,EACpB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAC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C,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,EACpC,CAAC;IACF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/instructions.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { brand } from "./config/brand.js";
|
|
11
11
|
export const serverInstructions = `${brand.name} MCP server for knowledge graph generation and text network analysis using graph theory algorithms.
|
|
12
12
|
|
|
13
|
-
INPUT TYPES: All analysis tools accept text (string), url (webpage or YouTube video URL — automatically transcribed), or graphName (existing ${brand.name} graph). Provide exactly one input type per call.
|
|
13
|
+
INPUT TYPES: All analysis tools accept text (string), url (webpage or YouTube video URL — automatically transcribed), or graphName (existing ${brand.name} graph). Provide exactly one input type per call. Every tool that takes text also takes statements (array of short discrete statements — notes, records, memory items, relations) with two optional parallel arrays: categories (metadata labels, each becoming a [[label]] node on that statement) and timestamps (ISO 8601 dates for time filters and dynamic graphs). Use text/url for prose and long documents. The comparison tools take the same fields per item of their contexts array, where metadata applies only if every context uses statements.
|
|
14
14
|
|
|
15
15
|
ENTITY DETECTION MODES: Use modifyAnalyzedText parameter — 'none' (default, word co-occurrence graph), 'detectEntities' (mix entities and words), 'extractEntitiesOnly' (entity-only graph, best for ontologies and knowledge graphs).
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ WORKFLOW PATTERNS:
|
|
|
18
18
|
1. Quick structural overview: generate_knowledge_graph or generate_topical_clusters → get main topics, clusters, gaps.
|
|
19
19
|
2. Deep text development: develop_text_tool (combines optimize + latent topics + conceptual bridges in one call with progress tracking).
|
|
20
20
|
3. Research ideation: generate_content_gaps → generate_research_questions or generate_research_ideas. Use useSeveralGaps for diversity, gapDepth for less prominent gaps.
|
|
21
|
-
4. Text optimization: optimize_text_structure (auto-detects bias/focus/dispersion and suggests appropriate development).
|
|
21
|
+
4. Text optimization: optimize_text_structure (auto-detects bias/focus/dispersion and suggests appropriate development). For the model's own reasoning or chat with the user, use optimize_reasoning (same analysis applied to the reasoning trace/conversation, steering it toward optimal diversity and coherence).
|
|
22
22
|
5. Outside-the-box thinking: develop_conceptual_bridges (connects discourse to broader context) or set shouldTranscend/transcendDiscourse: true.
|
|
23
23
|
6. RAG augmentation: generate_contextual_hint (lightweight structural summary) or retrieve_from_knowledge_base with includeGraphSummary (GraphRAG retrieval).
|
|
24
24
|
7. Comparing texts: overlap_between_texts (similarities), difference_between_texts (what's missing in first text), merged_graph_from_texts (combined overview).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about.d.ts","sourceRoot":"","sources":["../../src/resources/about.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"about.d.ts","sourceRoot":"","sources":["../../src/resources/about.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CA+DzB,CAAC"}
|
package/dist/resources/about.js
CHANGED
|
@@ -23,20 +23,21 @@ Available Tools:
|
|
|
23
23
|
3. generate_content_gaps - Generate content gaps from text
|
|
24
24
|
4. generate_topical_clusters - Generate topics and clusters of keywords from text using knowledge graph analysis; by default also returns AI-generated summaries of each topical cluster (topicalClusterSummaries, useful for SEO-optimized content creation) — set generateTopicalSummaries: false to increase processing speed or if the summary request fails
|
|
25
25
|
5. optimize_text_structure - Analyze the level of bias and coherence in text; if too biased, develop the represented topics; if focused or diversified, develop the content gaps; if dispersed, focus the most common gap topics
|
|
26
|
-
6.
|
|
27
|
-
7.
|
|
28
|
-
8.
|
|
29
|
-
9.
|
|
30
|
-
10.
|
|
31
|
-
11.
|
|
32
|
-
12.
|
|
33
|
-
13.
|
|
34
|
-
14.
|
|
35
|
-
15.
|
|
36
|
-
16.
|
|
37
|
-
17.
|
|
38
|
-
18.
|
|
39
|
-
19.
|
|
26
|
+
6. optimize_reasoning - Apply the same bias/coherence analysis to the model's own reasoning trace or chat with the user (pass it as text); detects whether the reasoning is biased, focused, diversified, or dispersed and suggests how to continue thinking toward optimal diversity and coherence at the same time
|
|
27
|
+
7. develop_text_tool - Comprehensive text analysis combining research questions, latent topics, and content gaps with progress tracking
|
|
28
|
+
8. create_knowledge_graph - Create a knowledge graph in ${brand.name} from text and provide a link to it
|
|
29
|
+
9. overlap_between_texts - Create knowledge graphs from two or more texts and find the overlap (similarities) between them
|
|
30
|
+
10. merged_graph_from_texts - Build a graph of all the texts, URLs, and existing graphs provided, providing topical clusters and gaps present in the merged graph generated from all the texts
|
|
31
|
+
11. difference_between_texts - Create knowledge graphs from two or more text and find what's not present in the first graph that's present in the others
|
|
32
|
+
12. analyze_llm_results - Ask an LLM to describe a topic and turn its answer into a knowledge graph that reveals how the model frames it (main concepts, clusters, content gaps, relations). Useful for probing model bias or comparing how different models describe the same topic. Default model: claude-opus-4.6. Saves by default; returns analytics by default and omits raw graph (includeGraph: false) to keep responses compact
|
|
33
|
+
13. analyze_google_search_results - Generate a Google search results graph from search queries
|
|
34
|
+
14. analyze_youtube_results - Generate a knowledge graph from YouTube results (search results, a channel's or playlist's videos, video comments, or transcribed subtitles) to reveal main topics, clusters, and content gaps
|
|
35
|
+
15. analyze_related_search_queries - Generate a graph of search requests related to search queries provided
|
|
36
|
+
16. search_queries_vs_search_results - Find what people search for but don't yet find
|
|
37
|
+
17. generate_seo_report - Analyze content for SEO optimization by comparing it with Google search results and search queries
|
|
38
|
+
18. list_graphs - List all graphs for the currently logged in user with optional filtering by name, type, date, language, or favorite status
|
|
39
|
+
19. search - Search through existing ${brand.name} graphs
|
|
40
|
+
20. fetch - Fetch a specific search result from a ${brand.name} graph
|
|
40
41
|
|
|
41
42
|
Key Features:
|
|
42
43
|
- Topic modeling and clustering
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../src/resources/about.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,cAAc;IACnB,UAAU,EAAE;QACX,IAAI,EAAE,SAAS,KAAK,CAAC,IAAI,aAAa;QACtC,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,uGAAuG,KAAK,CAAC,IAAI,wFAAwF,KAAK,CAAC,IAAI,0PAA0P;QACve,QAAQ,EAAE,YAAY;KACtB;IACD,OAAO,EAAE,KAAK,IAAI,EAAE;QACnB,OAAO;YACN,QAAQ,EAAE;gBACT;oBACC,GAAG,EAAE,cAAc;oBACnB,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI;;wFAEgE,KAAK,CAAC,IAAI;;;oFAGd,KAAK,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../src/resources/about.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,cAAc;IACnB,UAAU,EAAE;QACX,IAAI,EAAE,SAAS,KAAK,CAAC,IAAI,aAAa;QACtC,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,uGAAuG,KAAK,CAAC,IAAI,wFAAwF,KAAK,CAAC,IAAI,0PAA0P;QACve,QAAQ,EAAE,YAAY;KACtB;IACD,OAAO,EAAE,KAAK,IAAI,EAAE;QACnB,OAAO;YACN,QAAQ,EAAE;gBACT;oBACC,GAAG,EAAE,cAAc;oBACnB,QAAQ,EAAE,YAAY;oBACtB,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