@pagopa/dx-mcpserver 0.1.5 → 0.2.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.
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { RetrieveAndGenerateCommand, } from "@aws-sdk/client-bedrock-agent-runtime";
|
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
|
3
|
+
/**
|
|
4
|
+
* Restricts the model to answer only from the retrieved KB documents.
|
|
5
|
+
* Must include $search_results$ for Bedrock to inject retrieved content.
|
|
6
|
+
* If the query is off-topic or no relevant docs are found, the model is
|
|
7
|
+
* instructed to decline rather than fall back to general knowledge.
|
|
8
|
+
*/
|
|
9
|
+
const SCOPED_PROMPT_TEMPLATE = `You are a documentation assistant for PagoPA DX (Developer Experience).
|
|
10
|
+
Your sole purpose is to answer questions about PagoPA DX tools, infrastructure patterns, GitHub workflows, Terraform modules, and developer best practices.
|
|
11
|
+
|
|
12
|
+
Rules you must always follow:
|
|
13
|
+
1. Answer ONLY using the information in the search results below. Never use external or general knowledge.
|
|
14
|
+
2. If the search results do not contain enough information to answer, respond: "I don't have information about this topic in the PagoPA DX knowledge base."
|
|
15
|
+
3. If the question is unrelated to PagoPA DX (e.g. general trivia, unrelated technologies, off-topic subjects), respond: "This question is outside the scope of the PagoPA DX documentation. I can only help with PagoPA DX tools, infrastructure, and developer workflows."
|
|
16
|
+
4. Never answer questions about unrelated topics, even if you have general knowledge about them.
|
|
17
|
+
|
|
18
|
+
Search results from the PagoPA DX knowledge base:
|
|
19
|
+
$search_results$
|
|
20
|
+
|
|
21
|
+
$output_format_instructions$`;
|
|
3
22
|
/**
|
|
4
23
|
* Calls Bedrock RetrieveAndGenerate API to get an AI-generated answer
|
|
5
24
|
* based on documents from a knowledge base.
|
|
6
25
|
*
|
|
26
|
+
* A scoped prompt template is applied so the model is constrained to answer
|
|
27
|
+
* only from the retrieved KB documents, refusing off-topic queries.
|
|
28
|
+
*
|
|
7
29
|
* @param knowledgeBaseId The ID of the knowledge base to query
|
|
8
30
|
* @param modelArn The ARN of the Bedrock model to use for generation
|
|
9
31
|
* @param query The user's natural language query
|
|
@@ -20,6 +42,11 @@ export async function retrieveAndGenerate(knowledgeBaseId, modelArn, query, kbAg
|
|
|
20
42
|
},
|
|
21
43
|
retrieveAndGenerateConfiguration: {
|
|
22
44
|
knowledgeBaseConfiguration: {
|
|
45
|
+
generationConfiguration: {
|
|
46
|
+
promptTemplate: {
|
|
47
|
+
textPromptTemplate: SCOPED_PROMPT_TEMPLATE,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
23
50
|
knowledgeBaseId,
|
|
24
51
|
modelArn,
|
|
25
52
|
retrievalConfiguration: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/dx-mcpserver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An MCP server that supports developers using DX tools.",
|
|
6
6
|
"repository": {
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-bedrock-agent-runtime": "^3.583.0",
|
|
23
|
-
"@aws-sdk/client-s3": "^3.
|
|
23
|
+
"@aws-sdk/client-s3": "^3.808.0",
|
|
24
24
|
"@aws-sdk/s3-request-presigner": "^3.583.0",
|
|
25
25
|
"@logtape/logtape": "^1.3.7",
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
28
|
"axios": "^1.13.6",
|
|
29
29
|
"zod": "^3.25.76",
|
|
30
|
-
"@pagopa/azure-tracing": "^0.4.
|
|
31
|
-
"@pagopa/dx-mcpprompts": "^0.2.
|
|
30
|
+
"@pagopa/azure-tracing": "^0.4.17",
|
|
31
|
+
"@pagopa/dx-mcpprompts": "^0.2.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.19.15",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tsx": "^4.21.0",
|
|
39
39
|
"typescript": "~5.9.3",
|
|
40
40
|
"vitest": "^3.2.4",
|
|
41
|
-
"@pagopa/eslint-config": "^6.0.
|
|
41
|
+
"@pagopa/eslint-config": "^6.0.2"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"start": "tsx src/cli.ts",
|