@abgov/adsp-sdk-mcp-server 0.0.0
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 +51 -0
- package/assets/docs/architecture.md +79 -0
- package/assets/docs/getting-started.md +118 -0
- package/assets/docs/important-notes.md +47 -0
- package/assets/docs/index.md +9 -0
- package/assets/docs/platform/deployment.md +80 -0
- package/assets/docs/platform/getting-started.md +66 -0
- package/assets/docs/platform/operations.md +8 -0
- package/assets/docs/platform/platform-django-sdk.md +330 -0
- package/assets/docs/platform/platform-dotnet-sdk.md +457 -0
- package/assets/docs/platform/platform-flask-sdk.md +355 -0
- package/assets/docs/platform/platform-node-sdk.md +433 -0
- package/assets/docs/platform/platform-spring-sdk.md +344 -0
- package/assets/docs/platform/platform.md +8 -0
- package/assets/docs/services/access-service.md +75 -0
- package/assets/docs/services/agent-service.md +316 -0
- package/assets/docs/services/cache-service.md +61 -0
- package/assets/docs/services/calendar-service.md +86 -0
- package/assets/docs/services/comment-service.md +87 -0
- package/assets/docs/services/configuration-service.md +92 -0
- package/assets/docs/services/directory-service.md +57 -0
- package/assets/docs/services/event-service.md +122 -0
- package/assets/docs/services/feedback-service.md +152 -0
- package/assets/docs/services/file-service.md +164 -0
- package/assets/docs/services/form-service.md +149 -0
- package/assets/docs/services/notification-service.md +151 -0
- package/assets/docs/services/pdf-service.md +116 -0
- package/assets/docs/services/pii-service.md +45 -0
- package/assets/docs/services/push-service.md +106 -0
- package/assets/docs/services/services.md +6 -0
- package/assets/docs/services/status-service.md +29 -0
- package/assets/docs/services/task-service.md +139 -0
- package/assets/docs/services/tenant-service.md +18 -0
- package/assets/docs/services/token-handler.md +135 -0
- package/assets/docs/services/value-service.md +80 -0
- package/assets/docs/services/verify-service.md +61 -0
- package/assets/docs/tutorials/access-service/access-service.md +9 -0
- package/assets/docs/tutorials/access-service/adsp-clients.md +29 -0
- package/assets/docs/tutorials/access-service/application-clients.md +61 -0
- package/assets/docs/tutorials/access-service/front-end-access.md +53 -0
- package/assets/docs/tutorials/access-service/introduction.md +33 -0
- package/assets/docs/tutorials/access-service/tenants.md +68 -0
- package/assets/docs/tutorials/access-service/themes.md +43 -0
- package/assets/docs/tutorials/feedback-service/accessing-data.md +41 -0
- package/assets/docs/tutorials/feedback-service/feedback-service.md +9 -0
- package/assets/docs/tutorials/feedback-service/installation.md +142 -0
- package/assets/docs/tutorials/feedback-service/introduction.md +28 -0
- package/assets/docs/tutorials/feedback-service/security.md +40 -0
- package/assets/docs/tutorials/feedback-service/triggering.md +21 -0
- package/assets/docs/tutorials/file-service/file-service.md +9 -0
- package/assets/docs/tutorials/file-service/file-types.md +35 -0
- package/assets/docs/tutorials/file-service/introduction.md +34 -0
- package/assets/docs/tutorials/file-service/security.md +31 -0
- package/assets/docs/tutorials/file-service/working-with.md +65 -0
- package/assets/docs/tutorials/form-service/Integration.md +31 -0
- package/assets/docs/tutorials/form-service/ai-agent.md +450 -0
- package/assets/docs/tutorials/form-service/building-forms.md +264 -0
- package/assets/docs/tutorials/form-service/cheat-sheet.md +1461 -0
- package/assets/docs/tutorials/form-service/custom-error-messages.md +87 -0
- package/assets/docs/tutorials/form-service/data-registers.md +204 -0
- package/assets/docs/tutorials/form-service/file-uploader.md +81 -0
- package/assets/docs/tutorials/form-service/form-app.md +72 -0
- package/assets/docs/tutorials/form-service/form-editor.md +62 -0
- package/assets/docs/tutorials/form-service/form-service.md +9 -0
- package/assets/docs/tutorials/form-service/form-submissions.md +77 -0
- package/assets/docs/tutorials/form-service/instructions.md +173 -0
- package/assets/docs/tutorials/form-service/introduction.md +66 -0
- package/assets/docs/tutorials/form-service/repeated-items.md +87 -0
- package/assets/docs/tutorials/form-service/security.md +36 -0
- package/assets/docs/tutorials/form-service/steppers.md +237 -0
- package/assets/docs/tutorials/notification-service/emailAttachment.md +75 -0
- package/assets/docs/tutorials/notification-service/events.md +20 -0
- package/assets/docs/tutorials/notification-service/introduction.md +37 -0
- package/assets/docs/tutorials/notification-service/notification-service.md +9 -0
- package/assets/docs/tutorials/notification-service/notification-types.md +86 -0
- package/assets/docs/tutorials/notification-service/subscribers.md +33 -0
- package/assets/docs/tutorials/pdf-service/building-a-template.md +339 -0
- package/assets/docs/tutorials/pdf-service/generate-a-pdf.md +150 -0
- package/assets/docs/tutorials/pdf-service/handlebars.md +51 -0
- package/assets/docs/tutorials/pdf-service/introduction.md +26 -0
- package/assets/docs/tutorials/pdf-service/pdf-service.md +9 -0
- package/assets/docs/tutorials/pdf-service/puppeteer.md +25 -0
- package/assets/docs/tutorials/pdf-service/video.md +18 -0
- package/assets/docs/tutorials/status-service/Introduction.md +46 -0
- package/assets/docs/tutorials/status-service/health.md +51 -0
- package/assets/docs/tutorials/status-service/notices.md +34 -0
- package/assets/docs/tutorials/status-service/notifications.md +107 -0
- package/assets/docs/tutorials/status-service/status-service.md +9 -0
- package/assets/docs/tutorials/status-service/status.md +35 -0
- package/assets/docs/tutorials/status-service/webhooks.md +24 -0
- package/assets/docs/tutorials/task-service/introduction.md +23 -0
- package/assets/docs/tutorials/task-service/task-app.md +43 -0
- package/assets/docs/tutorials/task-service/task-definitions.md +49 -0
- package/assets/docs/tutorials/task-service/task-queues.md +67 -0
- package/assets/docs/tutorials/task-service/task-service.md +9 -0
- package/assets/docs/tutorials/tutorials.md +8 -0
- package/package.json +18 -0
- package/src/docs/docsRepository.d.ts +22 -0
- package/src/docs/docsRepository.js +110 -0
- package/src/docs/docsRepository.js.map +1 -0
- package/src/main.d.ts +2 -0
- package/src/main.js +16 -0
- package/src/main.js.map +1 -0
- package/src/sdk-reference/reference.d.ts +17 -0
- package/src/sdk-reference/reference.js +547 -0
- package/src/sdk-reference/reference.js.map +1 -0
- package/src/sdk-reference/search.d.ts +6 -0
- package/src/sdk-reference/search.js +41 -0
- package/src/sdk-reference/search.js.map +1 -0
- package/src/server.d.ts +6 -0
- package/src/server.js +30 -0
- package/src/server.js.map +1 -0
- package/src/tools/registerDocsTools.d.ts +3 -0
- package/src/tools/registerDocsTools.js +66 -0
- package/src/tools/registerDocsTools.js.map +1 -0
- package/src/tools/registerQuickstartTool.d.ts +2 -0
- package/src/tools/registerQuickstartTool.js +82 -0
- package/src/tools/registerQuickstartTool.js.map +1 -0
- package/src/tools/registerSdkTools.d.ts +2 -0
- package/src/tools/registerSdkTools.js +43 -0
- package/src/tools/registerSdkTools.js.map +1 -0
- package/src/tools/types.d.ts +12 -0
- package/src/tools/types.js +3 -0
- package/src/tools/types.js.map +1 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Task App
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 4
|
|
5
|
+
parent: Task Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
The _Task App_ is a standalone application designed to allow users to securely log in and perform various tasks. It leverages the _Task Service_ APIs to retrieve the necessary tasks and data, presenting a list of tasks that users need to complete. Each task is displayed with a dedicated view, enabling users to complete them efficiently. This setup allows tasks of a particular type to be generated by an application and subsequently completed within the Task App.
|
|
12
|
+
|
|
13
|
+
The task list is user-centric, time-ordered, and prioritized, ensuring that staff members can address tasks in a structured manner. These tasks typically arise from actions taken by end-users, such as filling out forms that then require staff attention. In general, the Task App can manage any task generated by the Task Service.
|
|
14
|
+
|
|
15
|
+
However, in practice, the Task App is currently configured to work only with the [Form Service](/adsp-monorepo/tutorials/form-service/introduction.html). Its primary feature is enabling GoA staff to review and process forms submitted through the Form Service. Other task types can be incorporated as needed, either by ADSP or other teams that request development access to the app, especially when the new types can be generalized and utilized by other ministries.
|
|
16
|
+
|
|
17
|
+
## Security
|
|
18
|
+
|
|
19
|
+
The task app is only intended for a GoA audience. Anyone logging into the _app_ must have the roles described in the [task queue section](/adsp-monorepo/tutorials/task-service/task-queues.html) in order to access any task related information.
|
|
20
|
+
|
|
21
|
+
#### Client Security
|
|
22
|
+
|
|
23
|
+
The _Task App_ uses the _task-app_ keycloak client, configured in your tenant, to access the necessary resources, specifically _urn:ads:platform:task-app_. If your tenant is recent you may already have the client added to your keycloak tenant; however, if not, you can add it yourself. The task-app client requires no particular configuration.
|
|
24
|
+
|
|
25
|
+
## Form Review and Disposition
|
|
26
|
+
|
|
27
|
+
When you first sign in to the app, e.g.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
https://task.adsp-uat.alberta.ca/\<your tenant name\>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
you are presented with a list of queues, each with a dashboard indicating the number of tasks that need to be completed and other queue metrics.
|
|
34
|
+
|
|
35
|
+
{: width="800" }
|
|
36
|
+
|
|
37
|
+
Clicking on the link to the queue will show the list of tasks in the queue. You can filter the list for those that are yours, pending, or active tasks.
|
|
38
|
+
|
|
39
|
+
{: width="800" }
|
|
40
|
+
|
|
41
|
+
Finally, clicking on the "Open" button will bring up the information to be reviewed, and allow the reviewer to determine the disposition of the form, if the role permits.
|
|
42
|
+
|
|
43
|
+
{: width="600" }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Task Definitions
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 3
|
|
5
|
+
parent: Task Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Task
|
|
10
|
+
|
|
11
|
+
A task is defined by:
|
|
12
|
+
|
|
13
|
+
- a name,
|
|
14
|
+
- a priority [normal, high, urgent],
|
|
15
|
+
- an optional description,
|
|
16
|
+
- an optional, generic, application defined ID string,
|
|
17
|
+
- an application defined context.
|
|
18
|
+
|
|
19
|
+
### Name
|
|
20
|
+
|
|
21
|
+
The name is used to identify the type of task to be performed, such as "Form Review", or "Signature Required". Between the name and the description a worker should be able to determine what is being requested of them.
|
|
22
|
+
|
|
23
|
+
### Record ID
|
|
24
|
+
|
|
25
|
+
The record ID is used to associate data with the task. For example, the _form review_ task would use the ID of the form intake data, so the application can display the data to be reviewed. Of course, the record ID is just a string without any a-priori meaning associated with it. You can use it for anything, really.
|
|
26
|
+
|
|
27
|
+
### Context
|
|
28
|
+
|
|
29
|
+
The context is used to provide any extra information that is needed for the worker to complete the task; things such as:
|
|
30
|
+
|
|
31
|
+
- its difficulty,
|
|
32
|
+
- its time frame,
|
|
33
|
+
- constraints,
|
|
34
|
+
- resource references,
|
|
35
|
+
- etc.
|
|
36
|
+
|
|
37
|
+
In the end, the context depends entirely on what sort of task is being defined. Therefore the context is simply defined as a generic JSON object that gets associated with the task, and it is up to the application to define and interpret its data.
|
|
38
|
+
|
|
39
|
+
Developers should try to keep the concept of _context_ separate from that of _data_ (the record ID). Data is the specific information or material that the task processes or analyzes, while context is the set of conditions, constraints, and circumstances that affect _how_ the task is performed.
|
|
40
|
+
|
|
41
|
+
## APIs
|
|
42
|
+
|
|
43
|
+
There are several [API endpoints](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Task%20service) that provide the basic operations needed to manage tasks within a queue. These operations include:
|
|
44
|
+
|
|
45
|
+
- assigning workers to tasks
|
|
46
|
+
- setting task priority
|
|
47
|
+
- managing task status
|
|
48
|
+
|
|
49
|
+
as well as the basic CRU operations for adding, updating, and retrieving the data. Note: tasks cannot be deleted, then can only be cancelled or completed.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Task Queues
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 2
|
|
5
|
+
parent: Task Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Task Queues
|
|
10
|
+
|
|
11
|
+
Task queues hold time-ordered sets of information that require processing, either by individuals or computer algorithms. Tasks can be scheduled, prioritized, and assigned to owners. Larger tasks might include subtasks or milestones. However, the task queue itself does not specify the type of data it contains; any type of data can be pushed onto a queue. It is the responsibility of the application developer to [define the data types](/adsp-monorepo/tutorials/task-service/task-definitions.html) and ensure the consistency of the queue's contents.
|
|
12
|
+
|
|
13
|
+
The service uses [RabbitMQ](https://www.rabbitmq.com/) for task management. The latter is not exposed to developers; however, it is managed by an abstract set of API wrappers that ensure easy, fault-tolerant, access to the underlying message queuing framework.
|
|
14
|
+
|
|
15
|
+
To start using the service, login to the ADSP Tenant-management-webapp and select the _Task Service_. There you will be able to create your first _task queue_. Queues are identified by a _namespace:name_ pair which you specify when creating one. There is no particular significance to the naming convention, it just gives you a means to help organize things when the number of queues in your tenant are large.
|
|
16
|
+
|
|
17
|
+
## Metrics
|
|
18
|
+
|
|
19
|
+
Several queue metrics are tracked by the Task Service, including
|
|
20
|
+
|
|
21
|
+
- the average, min, and max size of the queue
|
|
22
|
+
- the number of tasks created, completed, and cancelled since queue creation
|
|
23
|
+
- the number of tasks with a given status
|
|
24
|
+
- the number of tasks with a given priority
|
|
25
|
+
- the average, minimum, and maximum number of active tasks
|
|
26
|
+
|
|
27
|
+
The metrics can be filtered by active tasks only, and the information restricted to just status and priority metrics.
|
|
28
|
+
|
|
29
|
+
## Security
|
|
30
|
+
|
|
31
|
+
Developers must assign access roles to each _queue_ created. The _Task Service_ defines two types of users:
|
|
32
|
+
|
|
33
|
+
- **Assigner**: Assigners are able to assign tasks to individuals for completion.
|
|
34
|
+
- **Worker**: Workers are those that can complete a task.
|
|
35
|
+
|
|
36
|
+
In the Tenant-Management-Webapp developers can assign user types to one or more tenant-defined keycloak roles. Note: this security is important enough that this step is mandatory. If, when testing you find you are getting 403's, make sure your test user has the right tenant-defined roles. You can assign user types to these roles via the _Queue permissions_ pane in the Queue editor:
|
|
37
|
+
|
|
38
|
+
{: width="800" }
|
|
39
|
+
|
|
40
|
+
In addition to the _queue specific_ roles, users must have one or more of the following in order to access any task related data:
|
|
41
|
+
|
|
42
|
+
- **task-reader**: Users can see the task data, but are unable to update it.
|
|
43
|
+
- **task-writer**: Users can update task data
|
|
44
|
+
- **task-admin**: Users can assign tasks to other individuals.
|
|
45
|
+
|
|
46
|
+
## APIs
|
|
47
|
+
|
|
48
|
+
Once your queue is created you can then start accessing it through [the APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Task%20service). There are endpoints to:
|
|
49
|
+
|
|
50
|
+
- push data onto a queue
|
|
51
|
+
- assign individuals to a task
|
|
52
|
+
- retrieve lists of workers and assigners
|
|
53
|
+
- retrieve queue metrics
|
|
54
|
+
|
|
55
|
+
as well as other, basic, CRUD operations. Note: you cannot remove queues that have tasks within them.
|
|
56
|
+
|
|
57
|
+
## Events
|
|
58
|
+
|
|
59
|
+
Various events are triggered throughout the lifecycle of a task. These events can notify users about important developments. Additionally, all events are logged to ensure traceability and auditability. The events include:
|
|
60
|
+
|
|
61
|
+
- task-updated
|
|
62
|
+
- task-created
|
|
63
|
+
- task-priority-set
|
|
64
|
+
- task-assigned
|
|
65
|
+
- task-started
|
|
66
|
+
- task-completed
|
|
67
|
+
- task-cancelled
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@abgov/adsp-sdk-mcp-server",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Government of Alberta - MCP server for ADSP documentation and Node SDK reference lookup.",
|
|
6
|
+
"repository": "https://github.com/GovAlta/adsp-monorepo",
|
|
7
|
+
"bin": {
|
|
8
|
+
"adsp-sdk-mcp-server": "./src/main.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
12
|
+
"tslib": "^2.3.0",
|
|
13
|
+
"zod": "^3.25.76"
|
|
14
|
+
},
|
|
15
|
+
"types": "./src/main.d.ts",
|
|
16
|
+
"main": "./src/main.js",
|
|
17
|
+
"type": "commonjs"
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface AdspDoc {
|
|
2
|
+
path: string;
|
|
3
|
+
title: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AdspDocSearchResult {
|
|
7
|
+
path: string;
|
|
8
|
+
title: string;
|
|
9
|
+
snippet: string;
|
|
10
|
+
score: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function loadDocs(docsRoot: string): AdspDoc[];
|
|
13
|
+
export declare class DocsRepository {
|
|
14
|
+
private readonly docs;
|
|
15
|
+
constructor(docsRoot: string);
|
|
16
|
+
list(): {
|
|
17
|
+
path: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}[];
|
|
20
|
+
read(path: string): AdspDoc | undefined;
|
|
21
|
+
search(query: string, limit?: number): AdspDocSearchResult[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocsRepository = void 0;
|
|
4
|
+
exports.loadDocs = loadDocs;
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
/**
|
|
8
|
+
* Non-Node platform SDK docs excluded so results stay focused on the Node SDK covered by this package.
|
|
9
|
+
*/
|
|
10
|
+
const EXCLUDED_DOC_PATHS = new Set([
|
|
11
|
+
'platform/platform-dotnet-sdk.md',
|
|
12
|
+
'platform/platform-django-sdk.md',
|
|
13
|
+
'platform/platform-flask-sdk.md',
|
|
14
|
+
'platform/platform-spring-sdk.md',
|
|
15
|
+
]);
|
|
16
|
+
const STOP_WORDS = new Set([
|
|
17
|
+
'a', 'an', 'the', 'to', 'of', 'in', 'on', 'for', 'and', 'or', 'is', 'are',
|
|
18
|
+
'how', 'do', 'does', 'i', 'what', 'with', 'from', 'this', 'that', 'it', 'be',
|
|
19
|
+
]);
|
|
20
|
+
function parseFrontmatter(raw) {
|
|
21
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(raw);
|
|
22
|
+
if (!match) {
|
|
23
|
+
return { body: raw };
|
|
24
|
+
}
|
|
25
|
+
const titleMatch = /^title:\s*(.+)$/m.exec(match[1]);
|
|
26
|
+
const title = titleMatch?.[1].trim().replace(/^["']|["']$/g, '');
|
|
27
|
+
return { title, body: raw.slice(match[0].length) };
|
|
28
|
+
}
|
|
29
|
+
function listMarkdownFiles(dir, root = dir) {
|
|
30
|
+
return (0, fs_1.readdirSync)(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
31
|
+
const fullPath = (0, path_1.join)(dir, entry.name);
|
|
32
|
+
if (entry.isDirectory()) {
|
|
33
|
+
return listMarkdownFiles(fullPath, root);
|
|
34
|
+
}
|
|
35
|
+
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
36
|
+
return [(0, path_1.relative)(root, fullPath).split(path_1.sep).join('/')];
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function tokenize(text) {
|
|
42
|
+
return text.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
43
|
+
}
|
|
44
|
+
function countTerms(tokens) {
|
|
45
|
+
const counts = new Map();
|
|
46
|
+
for (const token of tokens) {
|
|
47
|
+
counts.set(token, (counts.get(token) ?? 0) + 1);
|
|
48
|
+
}
|
|
49
|
+
return counts;
|
|
50
|
+
}
|
|
51
|
+
function buildSnippet(content, terms, radius = 160) {
|
|
52
|
+
const lower = content.toLowerCase();
|
|
53
|
+
const index = terms.reduce((found, term) => (found >= 0 ? found : lower.indexOf(term)), -1);
|
|
54
|
+
if (index < 0) {
|
|
55
|
+
return content.slice(0, radius * 2).replace(/\s+/g, ' ').trim();
|
|
56
|
+
}
|
|
57
|
+
const start = Math.max(0, index - radius);
|
|
58
|
+
const end = Math.min(content.length, index + radius);
|
|
59
|
+
const snippet = content.slice(start, end).replace(/\s+/g, ' ').trim();
|
|
60
|
+
return `${start > 0 ? '…' : ''}${snippet}${end < content.length ? '…' : ''}`;
|
|
61
|
+
}
|
|
62
|
+
function loadDocs(docsRoot) {
|
|
63
|
+
return listMarkdownFiles(docsRoot)
|
|
64
|
+
.filter((path) => !EXCLUDED_DOC_PATHS.has(path))
|
|
65
|
+
.map((path) => {
|
|
66
|
+
const raw = (0, fs_1.readFileSync)((0, path_1.join)(docsRoot, path), 'utf8');
|
|
67
|
+
const { title, body } = parseFrontmatter(raw);
|
|
68
|
+
return { path, title: title || path, content: body.trim() };
|
|
69
|
+
})
|
|
70
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
71
|
+
}
|
|
72
|
+
class DocsRepository {
|
|
73
|
+
docs;
|
|
74
|
+
constructor(docsRoot) {
|
|
75
|
+
this.docs = loadDocs(docsRoot).map((doc) => ({
|
|
76
|
+
...doc,
|
|
77
|
+
titleCounts: countTerms(tokenize(doc.title)),
|
|
78
|
+
bodyCounts: countTerms(tokenize(doc.content)),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
list() {
|
|
82
|
+
return this.docs.map(({ path, title }) => ({ path, title }));
|
|
83
|
+
}
|
|
84
|
+
read(path) {
|
|
85
|
+
const doc = this.docs.find((d) => d.path === path);
|
|
86
|
+
return doc && { path: doc.path, title: doc.title, content: doc.content };
|
|
87
|
+
}
|
|
88
|
+
search(query, limit = 5) {
|
|
89
|
+
const terms = tokenize(query).filter((term) => !STOP_WORDS.has(term));
|
|
90
|
+
if (terms.length === 0) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
return this.docs
|
|
94
|
+
.map((doc) => ({
|
|
95
|
+
doc,
|
|
96
|
+
score: terms.reduce((score, term) => score + (doc.titleCounts.get(term) ?? 0) * 5 + (doc.bodyCounts.get(term) ?? 0), 0),
|
|
97
|
+
}))
|
|
98
|
+
.filter(({ score }) => score > 0)
|
|
99
|
+
.sort((a, b) => b.score - a.score)
|
|
100
|
+
.slice(0, limit)
|
|
101
|
+
.map(({ doc, score }) => ({
|
|
102
|
+
path: doc.path,
|
|
103
|
+
title: doc.title,
|
|
104
|
+
snippet: buildSnippet(doc.content, terms),
|
|
105
|
+
score,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.DocsRepository = DocsRepository;
|
|
110
|
+
//# sourceMappingURL=docsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsRepository.js","sourceRoot":"","sources":["../../../../../libs/adsp-sdk-mcp-server/src/docs/docsRepository.ts"],"names":[],"mappings":";;;AAwFA,4BASC;AAjGD,2BAA+C;AAC/C,+BAA2C;AAe3C;;GAEG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,gCAAgC;IAChC,iCAAiC;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;IACzE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;CAC7E,CAAC,CAAC;AAOH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,KAAK,GAAG,mCAAmC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACvB,CAAC;IAED,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAEjE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD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CA4CC"}
|
package/src/main.d.ts
ADDED
package/src/main.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const server_1 = require("./server");
|
|
6
|
+
async function main() {
|
|
7
|
+
const server = (0, server_1.createAdspMcpServer)();
|
|
8
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
9
|
+
await server.connect(transport);
|
|
10
|
+
}
|
|
11
|
+
main().catch((err) => {
|
|
12
|
+
// eslint-disable-next-line no-console
|
|
13
|
+
console.error('Failed to start adsp-sdk-mcp-server:', err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=main.js.map
|
package/src/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../libs/adsp-sdk-mcp-server/src/main.ts"],"names":[],"mappings":";;;AACA,wEAAiF;AACjF,qCAA+C;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,IAAA,4BAAmB,GAAE,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type SdkSymbolKind = 'function' | 'class' | 'interface' | 'type' | 'enum' | 'const' | 'decorator';
|
|
2
|
+
export interface SdkSymbolDoc {
|
|
3
|
+
name: string;
|
|
4
|
+
kind: SdkSymbolKind;
|
|
5
|
+
module: string;
|
|
6
|
+
summary: string;
|
|
7
|
+
details?: string;
|
|
8
|
+
example?: string;
|
|
9
|
+
deprecated?: boolean;
|
|
10
|
+
seeAlso?: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Curated reference for every symbol exported from the root of `@abgov/adsp-service-sdk`
|
|
14
|
+
* (libs/adsp-service-sdk/src/index.ts). Coverage against that export list is enforced by
|
|
15
|
+
* reference.spec.ts so this stays in sync as the SDK evolves.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SDK_REFERENCE: SdkSymbolDoc[];
|