@semiont/cli 0.1.0 → 0.2.0-build.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/dist/cli.mjs +81 -13
- package/package.json +1 -1
- package/dist/mcp-server/handlers-stubs.d.ts +0 -40
- package/dist/mcp-server/handlers-stubs.d.ts.map +0 -1
- package/dist/mcp-server/handlers-stubs.js +0 -22
- package/dist/mcp-server/handlers-stubs.js.map +0 -1
- package/dist/mcp-server/handlers.d.ts +0 -96
- package/dist/mcp-server/handlers.d.ts.map +0 -1
- package/dist/mcp-server/handlers.js +0 -253
- package/dist/mcp-server/handlers.js.map +0 -1
- package/dist/mcp-server/index.d.ts +0 -3
- package/dist/mcp-server/index.d.ts.map +0 -1
- package/dist/mcp-server/index.js +0 -365
- package/dist/mcp-server/index.js.map +0 -1
- package/dist/mcp-server/index.test.d.ts +0 -7
- package/dist/mcp-server/index.test.d.ts.map +0 -1
- package/dist/mcp-server/index.test.js +0 -183
- package/dist/mcp-server/index.test.js.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -16807,7 +16807,7 @@ var require_sse = __commonJS({
|
|
|
16807
16807
|
* stream.close();
|
|
16808
16808
|
* ```
|
|
16809
16809
|
*/
|
|
16810
|
-
generateResourceFromAnnotation(resourceId, annotationId, request
|
|
16810
|
+
generateResourceFromAnnotation(resourceId, annotationId, request) {
|
|
16811
16811
|
const resId = this.extractId(resourceId);
|
|
16812
16812
|
const annId = this.extractId(annotationId);
|
|
16813
16813
|
const url2 = `${this.baseUrl}/resources/${resId}/annotations/${annId}/generate-resource-stream`;
|
|
@@ -16960,6 +16960,54 @@ var require_sse = __commonJS({
|
|
|
16960
16960
|
errorEvent: "comment-detection-error"
|
|
16961
16961
|
});
|
|
16962
16962
|
}
|
|
16963
|
+
/**
|
|
16964
|
+
* Detect tags in a resource (streaming)
|
|
16965
|
+
*
|
|
16966
|
+
* Streams tag detection progress via Server-Sent Events.
|
|
16967
|
+
* Uses AI to identify passages serving specific structural roles
|
|
16968
|
+
* (e.g., IRAC, IMRAD, Toulmin) and creates tag annotations with dual-body structure.
|
|
16969
|
+
*
|
|
16970
|
+
* @param resourceId - Resource URI or ID
|
|
16971
|
+
* @param request - Detection configuration (schema and categories to detect)
|
|
16972
|
+
* @returns SSE stream controller with progress/complete/error callbacks
|
|
16973
|
+
*
|
|
16974
|
+
* @example
|
|
16975
|
+
* ```typescript
|
|
16976
|
+
* const stream = sseClient.detectTags('http://localhost:4000/resources/doc-123', {
|
|
16977
|
+
* schemaId: 'legal-irac',
|
|
16978
|
+
* categories: ['Issue', 'Rule', 'Application', 'Conclusion']
|
|
16979
|
+
* });
|
|
16980
|
+
*
|
|
16981
|
+
* stream.onProgress((progress) => {
|
|
16982
|
+
* console.log(`${progress.status}: ${progress.percentage}%`);
|
|
16983
|
+
* console.log(`Processing ${progress.currentCategory}...`);
|
|
16984
|
+
* });
|
|
16985
|
+
*
|
|
16986
|
+
* stream.onComplete((result) => {
|
|
16987
|
+
* console.log(`Detection complete! Created ${result.tagsCreated} tags`);
|
|
16988
|
+
* });
|
|
16989
|
+
*
|
|
16990
|
+
* stream.onError((error) => {
|
|
16991
|
+
* console.error('Detection failed:', error.message);
|
|
16992
|
+
* });
|
|
16993
|
+
*
|
|
16994
|
+
* // Cleanup when done
|
|
16995
|
+
* stream.close();
|
|
16996
|
+
* ```
|
|
16997
|
+
*/
|
|
16998
|
+
detectTags(resourceId, request) {
|
|
16999
|
+
const id = this.extractId(resourceId);
|
|
17000
|
+
const url2 = `${this.baseUrl}/resources/${id}/detect-tags-stream`;
|
|
17001
|
+
return (0, stream_1.createSSEStream)(url2, {
|
|
17002
|
+
method: "POST",
|
|
17003
|
+
headers: this.getHeaders(),
|
|
17004
|
+
body: JSON.stringify(request)
|
|
17005
|
+
}, {
|
|
17006
|
+
progressEvents: ["tag-detection-started", "tag-detection-progress"],
|
|
17007
|
+
completeEvent: "tag-detection-complete",
|
|
17008
|
+
errorEvent: "tag-detection-error"
|
|
17009
|
+
});
|
|
17010
|
+
}
|
|
16963
17011
|
/**
|
|
16964
17012
|
* Subscribe to resource events (long-lived stream)
|
|
16965
17013
|
*
|
|
@@ -17292,6 +17340,13 @@ var require_client = __commonJS({
|
|
|
17292
17340
|
async getResourceAnnotations(resourceUri) {
|
|
17293
17341
|
return this.http.get(`${resourceUri}/annotations`).json();
|
|
17294
17342
|
}
|
|
17343
|
+
async getAnnotationLLMContext(resourceUri, annotationId, options) {
|
|
17344
|
+
const searchParams = new URLSearchParams();
|
|
17345
|
+
if (options?.contextWindow) {
|
|
17346
|
+
searchParams.append("contextWindow", options.contextWindow.toString());
|
|
17347
|
+
}
|
|
17348
|
+
return this.http.get(`${resourceUri}/annotations/${annotationId}/llm-context`, { searchParams }).json();
|
|
17349
|
+
}
|
|
17295
17350
|
async getResourceReferencedBy(resourceUri) {
|
|
17296
17351
|
return this.http.get(`${resourceUri}/referenced-by`).json();
|
|
17297
17352
|
}
|
|
@@ -17409,16 +17464,6 @@ var require_client = __commonJS({
|
|
|
17409
17464
|
searchParams.append("includeSummary", options.includeSummary.toString());
|
|
17410
17465
|
return this.http.get(`${resourceUri}/llm-context`, { searchParams }).json();
|
|
17411
17466
|
}
|
|
17412
|
-
async getAnnotationLLMContext(annotationUri, options) {
|
|
17413
|
-
const searchParams = new URLSearchParams();
|
|
17414
|
-
if (options?.includeSourceContext !== void 0)
|
|
17415
|
-
searchParams.append("includeSourceContext", options.includeSourceContext.toString());
|
|
17416
|
-
if (options?.includeTargetContext !== void 0)
|
|
17417
|
-
searchParams.append("includeTargetContext", options.includeTargetContext.toString());
|
|
17418
|
-
if (options?.contextWindow !== void 0)
|
|
17419
|
-
searchParams.append("contextWindow", options.contextWindow.toString());
|
|
17420
|
-
return this.http.get(`${annotationUri}/llm-context`, { searchParams }).json();
|
|
17421
|
-
}
|
|
17422
17467
|
// ============================================================================
|
|
17423
17468
|
// SYSTEM STATUS
|
|
17424
17469
|
// ============================================================================
|
|
@@ -43065,14 +43110,37 @@ var require_arg = __commonJS({
|
|
|
43065
43110
|
var require_package = __commonJS({
|
|
43066
43111
|
"package.json"(exports, module) {
|
|
43067
43112
|
module.exports = {
|
|
43068
|
-
name: "semiont
|
|
43069
|
-
version: "0.0
|
|
43113
|
+
name: "@semiont/cli",
|
|
43114
|
+
version: "0.2.0",
|
|
43070
43115
|
description: "Semiont CLI - Unified environment management tool",
|
|
43071
43116
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
43072
43117
|
type: "module",
|
|
43073
43118
|
bin: {
|
|
43074
43119
|
semiont: "./dist/cli.mjs"
|
|
43075
43120
|
},
|
|
43121
|
+
files: [
|
|
43122
|
+
"dist",
|
|
43123
|
+
"README.md",
|
|
43124
|
+
"LICENSE"
|
|
43125
|
+
],
|
|
43126
|
+
publishConfig: {
|
|
43127
|
+
access: "public"
|
|
43128
|
+
},
|
|
43129
|
+
repository: {
|
|
43130
|
+
type: "git",
|
|
43131
|
+
url: "git+https://github.com/The-AI-Alliance/semiont.git",
|
|
43132
|
+
directory: "apps/cli"
|
|
43133
|
+
},
|
|
43134
|
+
keywords: [
|
|
43135
|
+
"semiont",
|
|
43136
|
+
"cli",
|
|
43137
|
+
"environment-management",
|
|
43138
|
+
"devops",
|
|
43139
|
+
"deployment",
|
|
43140
|
+
"infrastructure"
|
|
43141
|
+
],
|
|
43142
|
+
author: "Semiont Team",
|
|
43143
|
+
license: "Apache-2.0",
|
|
43076
43144
|
scripts: {
|
|
43077
43145
|
build: "npm run typecheck && node build.mjs",
|
|
43078
43146
|
"build:only": "node build.mjs",
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stub handlers for endpoints that were removed/renamed in the API
|
|
3
|
-
* These return error messages indicating the endpoint is unavailable
|
|
4
|
-
*/
|
|
5
|
-
export declare const handleDetectSelections: (_args: any) => {
|
|
6
|
-
content: {
|
|
7
|
-
type: "text";
|
|
8
|
-
text: string;
|
|
9
|
-
}[];
|
|
10
|
-
isError: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare const handleGetContextualSummary: (_args: any) => {
|
|
13
|
-
content: {
|
|
14
|
-
type: "text";
|
|
15
|
-
text: string;
|
|
16
|
-
}[];
|
|
17
|
-
isError: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare const handleGetSchemaDescription: (_args: any) => {
|
|
20
|
-
content: {
|
|
21
|
-
type: "text";
|
|
22
|
-
text: string;
|
|
23
|
-
}[];
|
|
24
|
-
isError: boolean;
|
|
25
|
-
};
|
|
26
|
-
export declare const handleGetLLMContext: (_args: any) => {
|
|
27
|
-
content: {
|
|
28
|
-
type: "text";
|
|
29
|
-
text: string;
|
|
30
|
-
}[];
|
|
31
|
-
isError: boolean;
|
|
32
|
-
};
|
|
33
|
-
export declare const handleGetResourceSelections: (_args: any) => {
|
|
34
|
-
content: {
|
|
35
|
-
type: "text";
|
|
36
|
-
text: string;
|
|
37
|
-
}[];
|
|
38
|
-
isError: boolean;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=handlers-stubs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-stubs.d.ts","sourceRoot":"","sources":["../src/handlers-stubs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,eAAO,MAAM,sBAAsB,UAZlB,GAAG;;;;;;CAYwD,CAAC;AAC7E,eAAO,MAAM,0BAA0B,UAbtB,GAAG;;;;;;CAa6D,CAAC;AAClF,eAAO,MAAM,0BAA0B,UAdtB,GAAG;;;;;;CAc6D,CAAC;AAClF,eAAO,MAAM,mBAAmB,UAff,GAAG;;;;;;CAe+C,CAAC;AACpE,eAAO,MAAM,2BAA2B,UAhBvB,GAAG;;;;;;CAgB+D,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stub handlers for endpoints that were removed/renamed in the API
|
|
3
|
-
* These return error messages indicating the endpoint is unavailable
|
|
4
|
-
*/
|
|
5
|
-
function createStubHandler(endpointName) {
|
|
6
|
-
return (_args) => {
|
|
7
|
-
return {
|
|
8
|
-
content: [{
|
|
9
|
-
type: 'text',
|
|
10
|
-
text: `Error: The ${endpointName} endpoint is no longer available in the current API version. This feature may have been removed or renamed.`,
|
|
11
|
-
}],
|
|
12
|
-
isError: true,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
// Endpoints that don't exist in the current API
|
|
17
|
-
export const handleDetectSelections = createStubHandler('detect-selections');
|
|
18
|
-
export const handleGetContextualSummary = createStubHandler('contextual-summary');
|
|
19
|
-
export const handleGetSchemaDescription = createStubHandler('schema-description');
|
|
20
|
-
export const handleGetLLMContext = createStubHandler('llm-context');
|
|
21
|
-
export const handleGetResourceSelections = createStubHandler('resource-selections');
|
|
22
|
-
//# sourceMappingURL=handlers-stubs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-stubs.js","sourceRoot":"","sources":["../src/handlers-stubs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,SAAS,iBAAiB,CAAC,YAAoB;IAC7C,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,cAAc,YAAY,6GAA6G;iBAC9I,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool execution handlers using @semiont/api-client
|
|
3
|
-
*/
|
|
4
|
-
import { SemiontApiClient } from '@semiont/api-client';
|
|
5
|
-
export declare function handleCreateResource(client: SemiontApiClient, args: any): Promise<{
|
|
6
|
-
content: {
|
|
7
|
-
type: "text";
|
|
8
|
-
text: string;
|
|
9
|
-
}[];
|
|
10
|
-
}>;
|
|
11
|
-
export declare function handleGetResource(client: SemiontApiClient, id: string): Promise<{
|
|
12
|
-
content: {
|
|
13
|
-
type: "text";
|
|
14
|
-
text: string;
|
|
15
|
-
}[];
|
|
16
|
-
}>;
|
|
17
|
-
export declare function handleListResources(client: SemiontApiClient, args: any): Promise<{
|
|
18
|
-
content: {
|
|
19
|
-
type: "text";
|
|
20
|
-
text: string;
|
|
21
|
-
}[];
|
|
22
|
-
}>;
|
|
23
|
-
export declare function handleDetectAnnotations(client: SemiontApiClient, args: any): Promise<{
|
|
24
|
-
content: Array<{
|
|
25
|
-
type: "text";
|
|
26
|
-
text: string;
|
|
27
|
-
}>;
|
|
28
|
-
isError?: boolean;
|
|
29
|
-
}>;
|
|
30
|
-
export declare function handleCreateAnnotation(client: SemiontApiClient, args: any): Promise<{
|
|
31
|
-
content: {
|
|
32
|
-
type: "text";
|
|
33
|
-
text: string;
|
|
34
|
-
}[];
|
|
35
|
-
}>;
|
|
36
|
-
export declare function handleSaveAnnotation(_client: SemiontApiClient, _args: any): Promise<{
|
|
37
|
-
content: {
|
|
38
|
-
type: "text";
|
|
39
|
-
text: string;
|
|
40
|
-
}[];
|
|
41
|
-
isError: boolean;
|
|
42
|
-
}>;
|
|
43
|
-
export declare function handleResolveAnnotation(client: SemiontApiClient, args: any): Promise<{
|
|
44
|
-
content: {
|
|
45
|
-
type: "text";
|
|
46
|
-
text: string;
|
|
47
|
-
}[];
|
|
48
|
-
}>;
|
|
49
|
-
export declare function handleGenerateResourceFromAnnotation(client: SemiontApiClient, args: any): Promise<{
|
|
50
|
-
content: Array<{
|
|
51
|
-
type: "text";
|
|
52
|
-
text: string;
|
|
53
|
-
}>;
|
|
54
|
-
isError?: boolean;
|
|
55
|
-
}>;
|
|
56
|
-
export declare function handleGetContextualSummary(_client: SemiontApiClient, _args: any): Promise<{
|
|
57
|
-
content: {
|
|
58
|
-
type: "text";
|
|
59
|
-
text: string;
|
|
60
|
-
}[];
|
|
61
|
-
isError: boolean;
|
|
62
|
-
}>;
|
|
63
|
-
export declare function handleGetSchemaDescription(_client: SemiontApiClient): Promise<{
|
|
64
|
-
content: {
|
|
65
|
-
type: "text";
|
|
66
|
-
text: string;
|
|
67
|
-
}[];
|
|
68
|
-
isError: boolean;
|
|
69
|
-
}>;
|
|
70
|
-
export declare function handleGetLLMContext(_client: SemiontApiClient, _args: any): Promise<{
|
|
71
|
-
content: {
|
|
72
|
-
type: "text";
|
|
73
|
-
text: string;
|
|
74
|
-
}[];
|
|
75
|
-
isError: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
export declare function handleGetResourceAnnotations(_client: SemiontApiClient, _args: any): Promise<{
|
|
78
|
-
content: {
|
|
79
|
-
type: "text";
|
|
80
|
-
text: string;
|
|
81
|
-
}[];
|
|
82
|
-
isError: boolean;
|
|
83
|
-
}>;
|
|
84
|
-
export declare function handleGetResourceHighlights(client: SemiontApiClient, args: Record<string, unknown>): Promise<{
|
|
85
|
-
content: {
|
|
86
|
-
type: "text";
|
|
87
|
-
text: string;
|
|
88
|
-
}[];
|
|
89
|
-
}>;
|
|
90
|
-
export declare function handleGetResourceReferences(client: SemiontApiClient, args: Record<string, unknown>): Promise<{
|
|
91
|
-
content: {
|
|
92
|
-
type: "text";
|
|
93
|
-
text: string;
|
|
94
|
-
}[];
|
|
95
|
-
}>;
|
|
96
|
-
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1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AAG;;;;;;GAS9E;AAED,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG;;;;;;GASvF;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAiBxG;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAgBxG"}
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool execution handlers using @semiont/api-client
|
|
3
|
-
*/
|
|
4
|
-
import { getExactText, getBodySource, resourceUri, annotationUri } from '@semiont/api-client';
|
|
5
|
-
export async function handleCreateResource(client, args) {
|
|
6
|
-
// Create File from content string for multipart/form-data upload
|
|
7
|
-
const format = args?.contentType || 'text/plain';
|
|
8
|
-
const content = args?.content || '';
|
|
9
|
-
const blob = new Blob([content], { type: format });
|
|
10
|
-
const file = new File([blob], args?.name + '.txt', { type: format });
|
|
11
|
-
const data = await client.createResource({
|
|
12
|
-
name: args?.name,
|
|
13
|
-
file: file,
|
|
14
|
-
format: format,
|
|
15
|
-
entityTypes: args?.entityTypes || [],
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
content: [{
|
|
19
|
-
type: 'text',
|
|
20
|
-
text: `Resource created successfully:\nID: ${data.resource.id}\nName: ${data.resource.name}\nEntity Types: ${data.resource.entityTypes?.join(', ') || 'None'}`,
|
|
21
|
-
}],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export async function handleGetResource(client, id) {
|
|
25
|
-
const data = await client.getResource(resourceUri(id));
|
|
26
|
-
return {
|
|
27
|
-
content: [{
|
|
28
|
-
type: 'text',
|
|
29
|
-
text: JSON.stringify(data, null, 2),
|
|
30
|
-
}],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export async function handleListResources(client, args) {
|
|
34
|
-
const data = await client.listResources(args?.limit, args?.archived ?? false);
|
|
35
|
-
return {
|
|
36
|
-
content: [{
|
|
37
|
-
type: 'text',
|
|
38
|
-
text: `Found ${data.total} resources:\n${data.resources.map((d) => `- ${d.name} (${d.id}) - ${d.entityTypes?.join(', ') || 'No types'}`).join('\n')}`,
|
|
39
|
-
}],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export async function handleDetectAnnotations(client, args) {
|
|
43
|
-
const rUri = resourceUri(args?.resourceId);
|
|
44
|
-
const entityTypes = args?.entityTypes || [];
|
|
45
|
-
return new Promise((resolve) => {
|
|
46
|
-
const stream = client.sse.detectAnnotations(rUri, { entityTypes });
|
|
47
|
-
const progressMessages = [];
|
|
48
|
-
stream.onProgress((progress) => {
|
|
49
|
-
const msg = progress.status === 'scanning'
|
|
50
|
-
? `Scanning for ${progress.currentEntityType}... (${progress.processedEntityTypes}/${progress.totalEntityTypes})`
|
|
51
|
-
: `Status: ${progress.status}`;
|
|
52
|
-
progressMessages.push(msg);
|
|
53
|
-
console.error(msg); // Send to stderr for MCP progress
|
|
54
|
-
});
|
|
55
|
-
stream.onComplete((result) => {
|
|
56
|
-
resolve({
|
|
57
|
-
content: [{
|
|
58
|
-
type: 'text',
|
|
59
|
-
text: `Entity detection complete!\nFound ${result.foundCount || 0} entities\n\nProgress:\n${progressMessages.join('\n')}`,
|
|
60
|
-
}],
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
stream.onError((error) => {
|
|
64
|
-
resolve({
|
|
65
|
-
content: [{
|
|
66
|
-
type: 'text',
|
|
67
|
-
text: `Entity detection failed: ${error.message}`,
|
|
68
|
-
}],
|
|
69
|
-
isError: true,
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export async function handleCreateAnnotation(client, args) {
|
|
75
|
-
const selectionData = args?.selectionData || {};
|
|
76
|
-
const entityTypes = args?.entityTypes || [];
|
|
77
|
-
// Convert entityTypes to W3C TextualBody items
|
|
78
|
-
const body = entityTypes.map((value) => ({
|
|
79
|
-
type: 'TextualBody',
|
|
80
|
-
value,
|
|
81
|
-
purpose: 'tagging',
|
|
82
|
-
}));
|
|
83
|
-
const rUri = resourceUri(args?.resourceId);
|
|
84
|
-
const data = await client.createAnnotation(rUri, {
|
|
85
|
-
motivation: 'highlighting',
|
|
86
|
-
target: {
|
|
87
|
-
source: args?.resourceId,
|
|
88
|
-
selector: [
|
|
89
|
-
{
|
|
90
|
-
type: 'TextPositionSelector',
|
|
91
|
-
start: selectionData.offset || 0,
|
|
92
|
-
end: (selectionData.offset || 0) + (selectionData.length || 0),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: 'TextQuoteSelector',
|
|
96
|
-
exact: selectionData.text || '',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
body,
|
|
101
|
-
});
|
|
102
|
-
// Extract text using SDK utility
|
|
103
|
-
const targetSelector = typeof data.annotation.target === 'string'
|
|
104
|
-
? undefined
|
|
105
|
-
: data.annotation.target.selector;
|
|
106
|
-
const exactText = getExactText(targetSelector);
|
|
107
|
-
return {
|
|
108
|
-
content: [{
|
|
109
|
-
type: 'text',
|
|
110
|
-
text: `Annotation created:\nID: ${data.annotation.id}\nMotivation: ${data.annotation.motivation}\nText: ${exactText}`,
|
|
111
|
-
}],
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
export async function handleSaveAnnotation(_client, _args) {
|
|
115
|
-
// NOTE: The /save endpoint was removed from the API
|
|
116
|
-
// This functionality may have been merged into the main annotation creation
|
|
117
|
-
return {
|
|
118
|
-
content: [{
|
|
119
|
-
type: 'text',
|
|
120
|
-
text: `Error: The save annotation endpoint is no longer available. Annotations are automatically persisted when created.`,
|
|
121
|
-
}],
|
|
122
|
-
isError: true,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
export async function handleResolveAnnotation(client, args) {
|
|
126
|
-
const data = await client.updateAnnotationBody(args?.selectionId, {
|
|
127
|
-
resourceId: args?.sourceResourceId,
|
|
128
|
-
operations: [{
|
|
129
|
-
op: 'add',
|
|
130
|
-
item: {
|
|
131
|
-
type: 'SpecificResource',
|
|
132
|
-
source: args?.resourceId,
|
|
133
|
-
purpose: 'linking',
|
|
134
|
-
},
|
|
135
|
-
}],
|
|
136
|
-
});
|
|
137
|
-
return {
|
|
138
|
-
content: [{
|
|
139
|
-
type: 'text',
|
|
140
|
-
text: `Annotation linked to resource:\nAnnotation ID: ${data.annotation.id}\nLinked to: ${args?.resourceId || 'null'}`,
|
|
141
|
-
}],
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
export async function handleGenerateResourceFromAnnotation(client, args) {
|
|
145
|
-
const rUri = resourceUri(args?.resourceId);
|
|
146
|
-
const aUri = annotationUri(args?.annotationId);
|
|
147
|
-
const request = {
|
|
148
|
-
title: args?.title,
|
|
149
|
-
prompt: args?.prompt,
|
|
150
|
-
language: args?.language,
|
|
151
|
-
};
|
|
152
|
-
return new Promise((resolve) => {
|
|
153
|
-
const stream = client.sse.generateResourceFromAnnotation(rUri, aUri, request);
|
|
154
|
-
const progressMessages = [];
|
|
155
|
-
stream.onProgress((progress) => {
|
|
156
|
-
const msg = `${progress.status}: ${progress.percentage}% - ${progress.message || ''}`;
|
|
157
|
-
progressMessages.push(msg);
|
|
158
|
-
console.error(msg); // Send to stderr for MCP progress
|
|
159
|
-
});
|
|
160
|
-
stream.onComplete((result) => {
|
|
161
|
-
resolve({
|
|
162
|
-
content: [{
|
|
163
|
-
type: 'text',
|
|
164
|
-
text: `Resource generation complete!\nResource ID: ${result.resourceId || 'unknown'}\nResource Name: ${result.resourceName || 'unknown'}\n\nProgress:\n${progressMessages.join('\n')}`,
|
|
165
|
-
}],
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
stream.onError((error) => {
|
|
169
|
-
resolve({
|
|
170
|
-
content: [{
|
|
171
|
-
type: 'text',
|
|
172
|
-
text: `Resource generation failed: ${error.message}`,
|
|
173
|
-
}],
|
|
174
|
-
isError: true,
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
export async function handleGetContextualSummary(_client, _args) {
|
|
180
|
-
// NOTE: /contextual-summary endpoint was removed or renamed
|
|
181
|
-
// Use /api/annotations/{id}/summary or /api/annotations/{id}/context instead
|
|
182
|
-
return {
|
|
183
|
-
content: [{
|
|
184
|
-
type: 'text',
|
|
185
|
-
text: `Error: The contextual-summary endpoint is no longer available. Use /summary or /context endpoints instead.`,
|
|
186
|
-
}],
|
|
187
|
-
isError: true,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
export async function handleGetSchemaDescription(_client) {
|
|
191
|
-
// NOTE: /schema-description endpoint was removed
|
|
192
|
-
return {
|
|
193
|
-
content: [{
|
|
194
|
-
type: 'text',
|
|
195
|
-
text: `Error: The schema-description endpoint is no longer available.`,
|
|
196
|
-
}],
|
|
197
|
-
isError: true,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
export async function handleGetLLMContext(_client, _args) {
|
|
201
|
-
// NOTE: Endpoint path may have changed - need to verify correct path
|
|
202
|
-
return {
|
|
203
|
-
content: [{
|
|
204
|
-
type: 'text',
|
|
205
|
-
text: `Error: The llm-context endpoint path needs to be updated.`,
|
|
206
|
-
}],
|
|
207
|
-
isError: true,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
export async function handleGetResourceAnnotations(_client, _args) {
|
|
211
|
-
// NOTE: Use /api/resources/{id}/annotations instead
|
|
212
|
-
return {
|
|
213
|
-
content: [{
|
|
214
|
-
type: 'text',
|
|
215
|
-
text: `Error: This endpoint needs to be updated to use /api/resources/{id}/annotations.`,
|
|
216
|
-
}],
|
|
217
|
-
isError: true,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
export async function handleGetResourceHighlights(client, args) {
|
|
221
|
-
const data = await client.getResourceAnnotations(resourceUri(args?.resourceId));
|
|
222
|
-
const highlights = data.annotations.filter(a => a.motivation === 'highlighting');
|
|
223
|
-
return {
|
|
224
|
-
content: [{
|
|
225
|
-
type: 'text',
|
|
226
|
-
text: `Found ${highlights.length} highlights in resource:\n${highlights.map(h => {
|
|
227
|
-
// Safely get exact text from TextQuoteSelector
|
|
228
|
-
const targetSelector = typeof h.target === 'string' ? undefined : h.target.selector;
|
|
229
|
-
const selectors = Array.isArray(targetSelector) ? targetSelector : [targetSelector];
|
|
230
|
-
const textQuoteSelector = selectors.find(s => s?.type === 'TextQuoteSelector');
|
|
231
|
-
const text = textQuoteSelector && 'exact' in textQuoteSelector ? textQuoteSelector.exact : h.id;
|
|
232
|
-
return `- ${text}${h.creator ? ` (creator: ${h.creator.name})` : ''}`;
|
|
233
|
-
}).join('\n')}`,
|
|
234
|
-
}],
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
export async function handleGetResourceReferences(client, args) {
|
|
238
|
-
const data = await client.getResourceAnnotations(resourceUri(args?.resourceId));
|
|
239
|
-
const references = data.annotations.filter(a => a.motivation === 'linking');
|
|
240
|
-
return {
|
|
241
|
-
content: [{
|
|
242
|
-
type: 'text',
|
|
243
|
-
text: `Found ${references.length} references in resource:\n${references.map(r => {
|
|
244
|
-
// Use SDK utilities to extract text and source
|
|
245
|
-
const targetSelector = typeof r.target === 'string' ? undefined : r.target.selector;
|
|
246
|
-
const text = getExactText(targetSelector) || r.id;
|
|
247
|
-
const source = getBodySource(r.body);
|
|
248
|
-
return `- ${text} → ${source || 'stub (no link)'}`;
|
|
249
|
-
}).join('\n')}`,
|
|
250
|
-
}],
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
//# sourceMappingURL=handlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAoB,YAAY,EAAE,aAAa,EAAE,W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;gBACrD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aAChB,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/mcp-server/index.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import { SemiontApiClient, baseUrl, accessToken } from '@semiont/api-client';
|
|
6
|
-
/**
|
|
7
|
-
* Semiont MCP Server
|
|
8
|
-
*
|
|
9
|
-
* This MCP server provides access to the Semiont API.
|
|
10
|
-
* It handles authentication and makes the API available to AI applications.
|
|
11
|
-
*/
|
|
12
|
-
import * as handlers from './handlers.js';
|
|
13
|
-
// Configuration from environment variables
|
|
14
|
-
if (!process.env.SEMIONT_ENV) {
|
|
15
|
-
throw new Error('SEMIONT_ENV environment variable is required');
|
|
16
|
-
}
|
|
17
|
-
if (!process.env.SEMIONT_API_URL) {
|
|
18
|
-
throw new Error('SEMIONT_API_URL environment variable is required');
|
|
19
|
-
}
|
|
20
|
-
if (!process.env.SEMIONT_ACCESS_TOKEN) {
|
|
21
|
-
throw new Error('SEMIONT_ACCESS_TOKEN environment variable is required');
|
|
22
|
-
}
|
|
23
|
-
const SEMIONT_ENV = process.env.SEMIONT_ENV;
|
|
24
|
-
const SEMIONT_API_URL = process.env.SEMIONT_API_URL;
|
|
25
|
-
const SEMIONT_ACCESS_TOKEN = process.env.SEMIONT_ACCESS_TOKEN;
|
|
26
|
-
// Create the Semiont API client
|
|
27
|
-
const apiClient = new SemiontApiClient({
|
|
28
|
-
baseUrl: baseUrl(SEMIONT_API_URL),
|
|
29
|
-
accessToken: accessToken(SEMIONT_ACCESS_TOKEN),
|
|
30
|
-
});
|
|
31
|
-
// Create the MCP server
|
|
32
|
-
const server = new Server({
|
|
33
|
-
name: 'semiont-mcp',
|
|
34
|
-
version: '0.1.0',
|
|
35
|
-
}, {
|
|
36
|
-
capabilities: {
|
|
37
|
-
tools: {},
|
|
38
|
-
resources: {},
|
|
39
|
-
prompts: {},
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
// Define all available tools
|
|
43
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
44
|
-
return {
|
|
45
|
-
tools: [
|
|
46
|
-
// Resource Management
|
|
47
|
-
{
|
|
48
|
-
name: 'semiont_create_resource',
|
|
49
|
-
description: 'Create a new resource in the knowledge graph',
|
|
50
|
-
inputSchema: {
|
|
51
|
-
type: 'object',
|
|
52
|
-
properties: {
|
|
53
|
-
name: { type: 'string', description: 'Resource name' },
|
|
54
|
-
content: { type: 'string', description: 'Resource content' },
|
|
55
|
-
entityTypes: {
|
|
56
|
-
type: 'array',
|
|
57
|
-
items: { type: 'string' },
|
|
58
|
-
description: 'Entity types (e.g., Person, Topic, Concept)'
|
|
59
|
-
},
|
|
60
|
-
contentType: { type: 'string', description: 'Content MIME type (default: text/plain)' },
|
|
61
|
-
metadata: { type: 'object', description: 'Additional metadata' },
|
|
62
|
-
},
|
|
63
|
-
required: ['name', 'content'],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'semiont_get_resource',
|
|
68
|
-
description: 'Get a resource by ID with its selections',
|
|
69
|
-
inputSchema: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
properties: {
|
|
72
|
-
id: { type: 'string', description: 'Resource ID' },
|
|
73
|
-
},
|
|
74
|
-
required: ['id'],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'semiont_list_resources',
|
|
79
|
-
description: 'List and search resources',
|
|
80
|
-
inputSchema: {
|
|
81
|
-
type: 'object',
|
|
82
|
-
properties: {
|
|
83
|
-
entityTypes: { type: 'string', description: 'Comma-separated entity types to filter' },
|
|
84
|
-
search: { type: 'string', description: 'Search query' },
|
|
85
|
-
archived: { type: 'boolean', description: 'Filter by archived status (default: false - shows only non-archived resources)' },
|
|
86
|
-
limit: { type: 'number', description: 'Maximum results (default: 20)' },
|
|
87
|
-
offset: { type: 'number', description: 'Offset for pagination (default: 0)' },
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'semiont_detect_selections',
|
|
93
|
-
description: 'Detect selections (entities, references) in a resource',
|
|
94
|
-
inputSchema: {
|
|
95
|
-
type: 'object',
|
|
96
|
-
properties: {
|
|
97
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
98
|
-
types: {
|
|
99
|
-
type: 'array',
|
|
100
|
-
items: { type: 'string' },
|
|
101
|
-
description: 'Types to detect (default: entities, concepts)'
|
|
102
|
-
},
|
|
103
|
-
confidence: { type: 'number', description: 'Minimum confidence (0-1, default: 0.7)' },
|
|
104
|
-
},
|
|
105
|
-
required: ['resourceId'],
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
// Selection Management
|
|
109
|
-
{
|
|
110
|
-
name: 'semiont_create_selection',
|
|
111
|
-
description: 'Create a new selection in a resource',
|
|
112
|
-
inputSchema: {
|
|
113
|
-
type: 'object',
|
|
114
|
-
properties: {
|
|
115
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
116
|
-
selectionType: { type: 'string', description: 'Selection type (e.g., text_span)' },
|
|
117
|
-
selectionData: {
|
|
118
|
-
type: 'object',
|
|
119
|
-
description: 'Selection data (offset, length, text, etc.)',
|
|
120
|
-
properties: {
|
|
121
|
-
type: { type: 'string' },
|
|
122
|
-
offset: { type: 'number' },
|
|
123
|
-
length: { type: 'number' },
|
|
124
|
-
text: { type: 'string' },
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
entityTypes: {
|
|
128
|
-
type: 'array',
|
|
129
|
-
items: { type: 'string' },
|
|
130
|
-
description: 'Entity types for this selection'
|
|
131
|
-
},
|
|
132
|
-
provisional: { type: 'boolean', description: 'Is this provisional?' },
|
|
133
|
-
},
|
|
134
|
-
required: ['resourceId', 'selectionType', 'selectionData'],
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'semiont_save_selection',
|
|
139
|
-
description: 'Save a selection as a highlight',
|
|
140
|
-
inputSchema: {
|
|
141
|
-
type: 'object',
|
|
142
|
-
properties: {
|
|
143
|
-
selectionId: { type: 'string', description: 'Selection ID' },
|
|
144
|
-
metadata: { type: 'object', description: 'Additional metadata' },
|
|
145
|
-
},
|
|
146
|
-
required: ['selectionId'],
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: 'semiont_resolve_selection',
|
|
151
|
-
description: 'Link a selection to a resource (adds SpecificResource to annotation body)',
|
|
152
|
-
inputSchema: {
|
|
153
|
-
type: 'object',
|
|
154
|
-
properties: {
|
|
155
|
-
selectionId: { type: 'string', description: 'Selection ID' },
|
|
156
|
-
resourceId: { type: 'string', description: 'Target resource ID to link to' },
|
|
157
|
-
},
|
|
158
|
-
required: ['selectionId', 'resourceId'],
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
// Resource Generation from Selections
|
|
162
|
-
{
|
|
163
|
-
name: 'semiont_generate_resource_from_selection',
|
|
164
|
-
description: 'Generate a resource with AI-generated content from a selection',
|
|
165
|
-
inputSchema: {
|
|
166
|
-
type: 'object',
|
|
167
|
-
properties: {
|
|
168
|
-
selectionId: { type: 'string', description: 'Selection ID' },
|
|
169
|
-
name: { type: 'string', description: 'Resource name (optional)' },
|
|
170
|
-
entityTypes: {
|
|
171
|
-
type: 'array',
|
|
172
|
-
items: { type: 'string' },
|
|
173
|
-
description: 'Entity types for the new resource'
|
|
174
|
-
},
|
|
175
|
-
prompt: { type: 'string', description: 'AI generation prompt' },
|
|
176
|
-
},
|
|
177
|
-
required: ['selectionId'],
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
// Context and Analysis
|
|
181
|
-
{
|
|
182
|
-
name: 'semiont_get_contextual_summary',
|
|
183
|
-
description: 'Get a contextual summary for a selection',
|
|
184
|
-
inputSchema: {
|
|
185
|
-
type: 'object',
|
|
186
|
-
properties: {
|
|
187
|
-
selectionId: { type: 'string', description: 'Selection ID' },
|
|
188
|
-
includeRelated: { type: 'boolean', description: 'Include related resources' },
|
|
189
|
-
maxRelated: { type: 'number', description: 'Max related resources' },
|
|
190
|
-
},
|
|
191
|
-
required: ['selectionId'],
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'semiont_get_schema_description',
|
|
196
|
-
description: 'Get a natural language description of the graph schema',
|
|
197
|
-
inputSchema: {
|
|
198
|
-
type: 'object',
|
|
199
|
-
properties: {},
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: 'semiont_get_llm_context',
|
|
204
|
-
description: 'Get LLM-suitable context for a resource and optional selection',
|
|
205
|
-
inputSchema: {
|
|
206
|
-
type: 'object',
|
|
207
|
-
properties: {
|
|
208
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
209
|
-
selectionId: { type: 'string', description: 'Optional selection ID' },
|
|
210
|
-
includeReferences: { type: 'boolean', description: 'Include references (default: true)' },
|
|
211
|
-
includeSelections: { type: 'boolean', description: 'Include selections (default: true)' },
|
|
212
|
-
maxReferencedResources: { type: 'number', description: 'Max referenced docs (default: 5)' },
|
|
213
|
-
contextWindow: { type: 'number', description: 'Context window size (default: 1000)' },
|
|
214
|
-
},
|
|
215
|
-
required: ['resourceId'],
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
// Relationship Queries
|
|
219
|
-
{
|
|
220
|
-
name: 'semiont_get_resource_selections',
|
|
221
|
-
description: 'Get all selections in a resource',
|
|
222
|
-
inputSchema: {
|
|
223
|
-
type: 'object',
|
|
224
|
-
properties: {
|
|
225
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
226
|
-
},
|
|
227
|
-
required: ['resourceId'],
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: 'semiont_get_resource_highlights',
|
|
232
|
-
description: 'Get saved highlights in a resource',
|
|
233
|
-
inputSchema: {
|
|
234
|
-
type: 'object',
|
|
235
|
-
properties: {
|
|
236
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
237
|
-
},
|
|
238
|
-
required: ['resourceId'],
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: 'semiont_get_resource_references',
|
|
243
|
-
description: 'Get linked references in a resource',
|
|
244
|
-
inputSchema: {
|
|
245
|
-
type: 'object',
|
|
246
|
-
properties: {
|
|
247
|
-
resourceId: { type: 'string', description: 'Resource ID' },
|
|
248
|
-
},
|
|
249
|
-
required: ['resourceId'],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
// Handle resources list (empty - we don't provide resources)
|
|
256
|
-
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
257
|
-
return {
|
|
258
|
-
resources: [],
|
|
259
|
-
};
|
|
260
|
-
});
|
|
261
|
-
// Handle prompts list (empty - we don't provide prompts)
|
|
262
|
-
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
263
|
-
return {
|
|
264
|
-
prompts: [],
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
// Handle tool execution
|
|
268
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
269
|
-
const { name, arguments: args } = request.params;
|
|
270
|
-
try {
|
|
271
|
-
switch (name) {
|
|
272
|
-
case 'semiont_create_resource':
|
|
273
|
-
return await handlers.handleCreateResource(apiClient, args);
|
|
274
|
-
case 'semiont_get_resource':
|
|
275
|
-
return await handlers.handleGetResource(apiClient, args?.id);
|
|
276
|
-
case 'semiont_list_resources':
|
|
277
|
-
return await handlers.handleListResources(apiClient, args);
|
|
278
|
-
case 'semiont_detect_selections':
|
|
279
|
-
return await handlers.handleDetectAnnotations(apiClient, args);
|
|
280
|
-
case 'semiont_create_selection':
|
|
281
|
-
return await handlers.handleCreateAnnotation(apiClient, args);
|
|
282
|
-
case 'semiont_save_selection':
|
|
283
|
-
return await handlers.handleSaveAnnotation(apiClient, args);
|
|
284
|
-
case 'semiont_resolve_selection':
|
|
285
|
-
return await handlers.handleResolveAnnotation(apiClient, args);
|
|
286
|
-
case 'semiont_generate_resource_from_selection':
|
|
287
|
-
return await handlers.handleGenerateResourceFromAnnotation(apiClient, args);
|
|
288
|
-
case 'semiont_get_contextual_summary':
|
|
289
|
-
return await handlers.handleGetContextualSummary(apiClient, args);
|
|
290
|
-
case 'semiont_get_schema_description':
|
|
291
|
-
return await handlers.handleGetSchemaDescription(apiClient);
|
|
292
|
-
case 'semiont_get_llm_context':
|
|
293
|
-
return await handlers.handleGetLLMContext(apiClient, args);
|
|
294
|
-
case 'semiont_get_resource_selections':
|
|
295
|
-
return await handlers.handleGetResourceAnnotations(apiClient, args);
|
|
296
|
-
case 'semiont_get_resource_highlights':
|
|
297
|
-
return await handlers.handleGetResourceHighlights(apiClient, args || {});
|
|
298
|
-
case 'semiont_get_resource_references':
|
|
299
|
-
return await handlers.handleGetResourceReferences(apiClient, args || {});
|
|
300
|
-
default:
|
|
301
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
catch (error) {
|
|
305
|
-
return {
|
|
306
|
-
content: [{
|
|
307
|
-
type: 'text',
|
|
308
|
-
text: `Error calling Semiont API: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
309
|
-
}],
|
|
310
|
-
isError: true,
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
// Start the server
|
|
315
|
-
async function main() {
|
|
316
|
-
console.error('[MCP Server] Starting up...');
|
|
317
|
-
console.error('[MCP Server] Environment:', {
|
|
318
|
-
SEMIONT_ENV,
|
|
319
|
-
SEMIONT_API_URL,
|
|
320
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
321
|
-
cwd: process.cwd()
|
|
322
|
-
});
|
|
323
|
-
const transport = new StdioServerTransport();
|
|
324
|
-
console.error('[MCP Server] Connecting to transport...');
|
|
325
|
-
await server.connect(transport);
|
|
326
|
-
console.error('[MCP Server] Connected successfully');
|
|
327
|
-
// Keep the server alive until it receives a termination signal
|
|
328
|
-
process.on('SIGINT', async () => {
|
|
329
|
-
console.error('[MCP Server] Received SIGINT, shutting down...');
|
|
330
|
-
await server.close();
|
|
331
|
-
process.exit(0);
|
|
332
|
-
});
|
|
333
|
-
process.on('SIGTERM', async () => {
|
|
334
|
-
console.error('[MCP Server] Received SIGTERM, shutting down...');
|
|
335
|
-
await server.close();
|
|
336
|
-
process.exit(0);
|
|
337
|
-
});
|
|
338
|
-
// Add handler for unexpected exits
|
|
339
|
-
process.on('exit', (code) => {
|
|
340
|
-
console.error(`[MCP Server] Process exiting with code ${code}`);
|
|
341
|
-
});
|
|
342
|
-
process.on('uncaughtException', (error) => {
|
|
343
|
-
console.error('[MCP Server] Uncaught exception:', error);
|
|
344
|
-
process.exit(1);
|
|
345
|
-
});
|
|
346
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
347
|
-
console.error('[MCP Server] Unhandled rejection at:', promise, 'reason:', reason);
|
|
348
|
-
process.exit(1);
|
|
349
|
-
});
|
|
350
|
-
console.error('[MCP Server] Setting up keep-alive...');
|
|
351
|
-
// Keep the process alive
|
|
352
|
-
// The server will handle incoming messages via the transport
|
|
353
|
-
await new Promise(() => {
|
|
354
|
-
console.error('[MCP Server] Keep-alive promise created, server should stay running...');
|
|
355
|
-
// Log periodic heartbeat to show we're still alive
|
|
356
|
-
setInterval(() => {
|
|
357
|
-
console.error(`[MCP Server] Still alive at ${new Date().toISOString()}`);
|
|
358
|
-
}, 30000); // Every 30 seconds
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
main().catch((error) => {
|
|
362
|
-
console.error('[MCP Server] Fatal error in main:', error);
|
|
363
|
-
process.exit(1);
|
|
364
|
-
});
|
|
365
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;;;;GAKG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,2CAA2C;AAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IAC7B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAClE,CAAC;AACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;IACjC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACtE,CAAC;AACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;IACtC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAC5C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;AACpD,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG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mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Server Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests for the Semiont MCP (Model Context Protocol) server
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
7
|
-
// Mock environment variables
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
process.env.SEMIONT_API_URL = 'http://test.api.semiont.com';
|
|
10
|
-
process.env.SEMIONT_API_TOKEN = 'test-token-123';
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
delete process.env.SEMIONT_API_URL;
|
|
14
|
-
delete process.env.SEMIONT_API_TOKEN;
|
|
15
|
-
vi.clearAllMocks();
|
|
16
|
-
});
|
|
17
|
-
// Mock fetch globally
|
|
18
|
-
global.fetch = vi.fn();
|
|
19
|
-
describe('MCP Server', () => {
|
|
20
|
-
describe('Tool Registration', () => {
|
|
21
|
-
it('should register semiont_hello tool', async () => {
|
|
22
|
-
// Import the server module to trigger registration
|
|
23
|
-
await import('./index.js');
|
|
24
|
-
// The server should have registered the semiont_hello tool
|
|
25
|
-
// We can't directly test the Server instance, but we can verify
|
|
26
|
-
// the module loads without errors
|
|
27
|
-
expect(process.env.SEMIONT_API_URL).toBe('http://test.api.semiont.com');
|
|
28
|
-
expect(process.env.SEMIONT_API_TOKEN).toBe('test-token-123');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe('Tool Execution', () => {
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
// Reset fetch mock
|
|
34
|
-
global.fetch.mockReset();
|
|
35
|
-
});
|
|
36
|
-
it('should call API with authentication for hello tool', async () => {
|
|
37
|
-
// Mock successful API response
|
|
38
|
-
global.fetch.mockResolvedValue({
|
|
39
|
-
ok: true,
|
|
40
|
-
json: async () => ({
|
|
41
|
-
message: 'Hello, World!',
|
|
42
|
-
platform: 'test',
|
|
43
|
-
timestamp: new Date().toISOString(),
|
|
44
|
-
user: 'test@example.com'
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
// Since we can't directly test the server handlers without
|
|
48
|
-
// the full MCP infrastructure, we test the API interaction pattern
|
|
49
|
-
const url = `${process.env.SEMIONT_API_URL}/api/hello`;
|
|
50
|
-
const response = await fetch(url, {
|
|
51
|
-
method: 'GET',
|
|
52
|
-
headers: {
|
|
53
|
-
'Authorization': `Bearer ${process.env.SEMIONT_API_TOKEN}`,
|
|
54
|
-
'Content-Type': 'application/json',
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
expect(global.fetch).toHaveBeenCalledWith('http://test.api.semiont.com/api/hello', expect.objectContaining({
|
|
58
|
-
method: 'GET',
|
|
59
|
-
headers: expect.objectContaining({
|
|
60
|
-
'Authorization': 'Bearer test-token-123',
|
|
61
|
-
'Content-Type': 'application/json',
|
|
62
|
-
})
|
|
63
|
-
}));
|
|
64
|
-
const data = await response.json();
|
|
65
|
-
expect(data).toMatchObject({
|
|
66
|
-
message: 'Hello, World!',
|
|
67
|
-
platform: 'test',
|
|
68
|
-
user: 'test@example.com'
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
it('should handle API authentication failure', async () => {
|
|
72
|
-
// Mock 401 response
|
|
73
|
-
global.fetch.mockResolvedValue({
|
|
74
|
-
ok: false,
|
|
75
|
-
status: 401,
|
|
76
|
-
statusText: 'Unauthorized'
|
|
77
|
-
});
|
|
78
|
-
const url = `${process.env.SEMIONT_API_URL}/api/hello`;
|
|
79
|
-
const response = await fetch(url, {
|
|
80
|
-
method: 'GET',
|
|
81
|
-
headers: {
|
|
82
|
-
'Authorization': `Bearer ${process.env.SEMIONT_API_TOKEN}`,
|
|
83
|
-
'Content-Type': 'application/json',
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
expect(response.ok).toBe(false);
|
|
87
|
-
expect(response.status).toBe(401);
|
|
88
|
-
});
|
|
89
|
-
it('should call API with name parameter when provided', async () => {
|
|
90
|
-
const testName = 'TestUser';
|
|
91
|
-
// Mock successful API response
|
|
92
|
-
global.fetch.mockResolvedValue({
|
|
93
|
-
ok: true,
|
|
94
|
-
json: async () => ({
|
|
95
|
-
message: `Hello, ${testName}!`,
|
|
96
|
-
platform: 'test',
|
|
97
|
-
timestamp: new Date().toISOString(),
|
|
98
|
-
user: 'test@example.com'
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
const url = `${process.env.SEMIONT_API_URL}/api/hello/${encodeURIComponent(testName)}`;
|
|
102
|
-
const response = await fetch(url, {
|
|
103
|
-
method: 'GET',
|
|
104
|
-
headers: {
|
|
105
|
-
'Authorization': `Bearer ${process.env.SEMIONT_API_TOKEN}`,
|
|
106
|
-
'Content-Type': 'application/json',
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
expect(global.fetch).toHaveBeenCalledWith(`http://test.api.semiont.com/api/hello/${testName}`, expect.anything());
|
|
110
|
-
const data = await response.json();
|
|
111
|
-
expect(data.message).toContain(testName);
|
|
112
|
-
});
|
|
113
|
-
it('should handle network errors gracefully', async () => {
|
|
114
|
-
// Mock network error
|
|
115
|
-
global.fetch.mockRejectedValue(new Error('Network error'));
|
|
116
|
-
const url = `${process.env.SEMIONT_API_URL}/api/hello`;
|
|
117
|
-
await expect(fetch(url, {
|
|
118
|
-
method: 'GET',
|
|
119
|
-
headers: {
|
|
120
|
-
'Authorization': `Bearer ${process.env.SEMIONT_API_TOKEN}`,
|
|
121
|
-
'Content-Type': 'application/json',
|
|
122
|
-
},
|
|
123
|
-
})).rejects.toThrow('Network error');
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
describe('Environment Configuration', () => {
|
|
127
|
-
it('should use default API URL when not specified', async () => {
|
|
128
|
-
delete process.env.SEMIONT_API_URL;
|
|
129
|
-
// Re-import to get default values
|
|
130
|
-
const module = await import('./index.js');
|
|
131
|
-
// The module should use the default URL
|
|
132
|
-
// Since we can't access the const directly, we verify it doesn't crash
|
|
133
|
-
expect(module).toBeDefined();
|
|
134
|
-
});
|
|
135
|
-
it('should handle missing API token', async () => {
|
|
136
|
-
delete process.env.SEMIONT_API_TOKEN;
|
|
137
|
-
// Mock API call without token
|
|
138
|
-
global.fetch.mockResolvedValue({
|
|
139
|
-
ok: false,
|
|
140
|
-
status: 401,
|
|
141
|
-
statusText: 'Unauthorized'
|
|
142
|
-
});
|
|
143
|
-
const url = 'http://localhost:4000/api/hello';
|
|
144
|
-
const response = await fetch(url, {
|
|
145
|
-
method: 'GET',
|
|
146
|
-
headers: {
|
|
147
|
-
'Authorization': 'Bearer ',
|
|
148
|
-
'Content-Type': 'application/json',
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
expect(response.status).toBe(401);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
describe('Input Validation', () => {
|
|
155
|
-
it('should handle name parameter with special characters', () => {
|
|
156
|
-
const specialName = 'Test User & Co. <script>';
|
|
157
|
-
const encoded = encodeURIComponent(specialName);
|
|
158
|
-
expect(encoded).toBe('Test%20User%20%26%20Co.%20%3Cscript%3E');
|
|
159
|
-
// Verify the URL is properly constructed
|
|
160
|
-
const url = `http://test.api.semiont.com/api/hello/${encoded}`;
|
|
161
|
-
expect(url).toContain('Test%20User%20%26%20Co.%20%3Cscript%3E');
|
|
162
|
-
});
|
|
163
|
-
it('should handle very long name parameters', () => {
|
|
164
|
-
const longName = 'A'.repeat(150); // Exceeds typical 100 char limit
|
|
165
|
-
const encoded = encodeURIComponent(longName);
|
|
166
|
-
// The encoding should work regardless of length
|
|
167
|
-
expect(encoded).toBe(longName);
|
|
168
|
-
// Server should handle length validation
|
|
169
|
-
const url = `http://test.api.semiont.com/api/hello/${encoded}`;
|
|
170
|
-
expect(url.length).toBeGreaterThan(150);
|
|
171
|
-
});
|
|
172
|
-
it('should handle empty name parameter', () => {
|
|
173
|
-
const emptyName = '';
|
|
174
|
-
const encoded = encodeURIComponent(emptyName);
|
|
175
|
-
expect(encoded).toBe('');
|
|
176
|
-
// Should use the base URL without name
|
|
177
|
-
const baseUrl = 'http://test.api.semiont.com/api/hello';
|
|
178
|
-
const url = emptyName ? `${baseUrl}/${encoded}` : baseUrl;
|
|
179
|
-
expect(url).toBe(baseUrl);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAGzE,6BAA6B;AAC7B,UAAU,CAAC,GAAG,EAAE;IACd,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,6BAA6B,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACb,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACrC,EAAE,CAAC,aAAa,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,sBAAsB;AACtB,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAEvB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YAClD,mDAAmD;YACnD,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;YAE3B,2DAA2D;YAC3D,gEAAgE;YAChE,kCAAkC;YAClC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,6BA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