Skip to content

Commit ab664c1

Browse files
dreamorosisvozzam-walmsley
authored
fix: base url and outputs (#280)
Co-authored-by: Stefano Vozza <[email protected]> Co-authored-by: Michael Walmsley <[email protected]>
1 parent 40e6bbf commit ab664c1

File tree

13 files changed

+40
-31
lines changed

13 files changed

+40
-31
lines changed

.github/workflows/make-release.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Make Release
44
#
55
# === Automated activities ===
66
# 1. [Quality check] run unit tests and linting
7-
# 2. [Release] publish package to npmjs.org using the latest git commit, ensure provenance with NPM_CONFIG_PROVENANCE=true
7+
# 2. [Release] publish package to npmjs.org using OIDC authentication with automatic provenance attestations
88
# 3. [Create tag] create a new git tag using released version, i.e. v1.13.1
99
#
1010
# === Manual activities ===
@@ -28,12 +28,12 @@ jobs:
2828
run-e2e-tests:
2929
uses: ./.github/workflows/reusable-e2e.yml
3030
# This job publishes the packages to npm.
31-
# It uses the latest git commit sha as the version and ensures provenance with NPM_CONFIG_PROVENANCE flag.
31+
# It uses OIDC authentication with automatic provenance attestations.
3232
# We don't bump the version because we do that in the `make-version` workflow.
3333
# It also sets the RELEASE_VERSION output to be used by the next job to create a git tag.
3434
publish-npm:
3535
needs: [run-e2e-tests, run-unit-tests]
36-
# Needed as recommended by npm docs on publishing with provenance https://docs.npmjs.com/generating-provenance-statements
36+
# Needed for OIDC authentication with npm trusted publishing
3737
permissions:
3838
id-token: write
3939
environment: Release
@@ -46,18 +46,14 @@ jobs:
4646
with:
4747
ref: ${{ github.sha }}
4848
- name: Setup Node.js
49-
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
49+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
5050
with:
5151
node-version: "22"
5252
cache: "npm"
53-
- name: Setup auth tokens
54-
run: |
55-
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
5653
- name: Setup dependencies
5754
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5
5855
- name: Publish to npm
59-
run: |
60-
NPM_CONFIG_PROVENANCE=true npm publish
56+
run: npm publish
6157
- name: Set release version
6258
id: set-release-version
6359
run: |

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
2+
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
33
"assist": { "actions": { "source": { "organizeImports": "on" } } },
44
"linter": {
55
"enabled": true,

src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import {
88
const MCP_SERVER_NAME = 'powertools-for-aws-mcp' as const;
99

1010
// Allowed domain for security
11-
const ALLOWED_DOMAIN = 'docs.powertools.aws.dev';
11+
const ALLOWED_DOMAIN = 'docs.aws.amazon.com';
1212
// Base URL for Powertools documentation
13-
const POWERTOOLS_BASE_URL = 'https://docs.powertools.aws.dev/lambda';
13+
const POWERTOOLS_BASE_URL = 'https://docs.aws.amazon.com/powertools';
1414

1515
const FETCH_TIMEOUT_MS = 15000; // 15 seconds timeout for fetch operations
1616

src/logger.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { Console } from 'node:console';
12
import { getStringFromEnv } from '@aws-lambda-powertools/commons/utils/env';
2-
import { Logger, LogFormatter, LogItem } from '@aws-lambda-powertools/logger';
3+
import { LogFormatter, Logger, LogItem } from '@aws-lambda-powertools/logger';
34
import type {
45
LogAttributes,
56
LogLevel,
@@ -30,5 +31,19 @@ const logger = new Logger({
3031
logLevel,
3132
logFormatter: new CustomLogFormatter(),
3233
});
34+
/**
35+
* Since this MCP server uses the stdio protocol, we always
36+
* need to emit logs to `stderr` to avoid interfering with MCP's
37+
* communication over `stdout`.
38+
*
39+
* See https://modelcontextprotocol.io/docs/develop/build-server#logging-in-mcp-servers
40+
*/
41+
/* v8 ignore start */ if (process.env.NODE_ENV !== 'test') {
42+
// @ts-expect-error
43+
(logger as unknown).console = new Console({
44+
stdout: process.stderr,
45+
stderr: process.stderr,
46+
});
47+
} /* v8 ignore stop */
3348

3449
export { logger };

src/tools/fetchDocPage/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { tool } from './tool.ts';
2-
export { name, description } from './constants.ts';
1+
export { description, name } from './constants.ts';
32
export { schema } from './schemas.ts';
3+
export { tool } from './tool.ts';

src/tools/searchDocs/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { tool } from './tool.ts';
2-
export { name, description } from './constants.ts';
1+
export { description, name } from './constants.ts';
32
export { schema } from './schemas.ts';
3+
export { tool } from './tool.ts';

src/tools/searchDocs/tool.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ const tool = async (props: ToolProps): Promise<CallToolResult> => {
7575
// TODO: consume built/exported search index - #79
7676
const index = lunr(function () {
7777
this.ref('location');
78-
this.field('title', { boost: 10 });
79-
this.field('text');
78+
this.field('title', { boost: 1000 });
79+
this.field('text', { boost: 1 });
80+
this.field('tags', { boost: 1000000 });
8081

8182
for (const doc of searchIndexContent.docs) {
8283
if (!doc.location || !doc.title || !doc.text) continue;

tests/setupEnv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
22
import { expect, vi } from 'vitest';
33

4+
vi.stubEnv('NODE_ENV', 'test');
5+
46
// Mock console methods to prevent output during tests
57
vi.spyOn(console, 'error').mockReturnValue();
68
vi.spyOn(console, 'warn').mockReturnValue();

tests/tsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
"rootDir": "../",
55
"noEmit": true
66
},
7-
"include": [
8-
"../src/**/*",
9-
"./**/*"
10-
]
11-
}
7+
"include": ["../src/**/*", "./**/*"]
8+
}

tests/unit/fetchDocPage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { http, HttpResponse } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22
import { setupServer } from 'msw/node';
33
import {
44
afterAll,

0 commit comments

Comments
 (0)