Skip to content

Commit a308b7f

Browse files
dreamorosisvozza
andauthored
feat: consume md docs directly (#78)
Co-authored-by: Stefano Vozza <[email protected]>
1 parent 35e8cea commit a308b7f

40 files changed

+2233
-3192
lines changed

package-lock.json

Lines changed: 539 additions & 588 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,22 @@
5757
"@types/cacache": "^17.0.2",
5858
"@types/node": "^22.14.1",
5959
"cacache": "^19.0.1",
60-
"cheerio": "^1.0.0",
6160
"lunr": "^2.3.9",
6261
"lunr-languages": "^1.14.0",
63-
"make-fetch-happen": "^14.0.3",
64-
"node-html-markdown": "^1.3.0",
6562
"zod": "^3.25.51"
6663
},
6764
"devDependencies": {
6865
"@biomejs/biome": "^1.9.4",
6966
"@modelcontextprotocol/inspector": "^0.13.0",
7067
"@types/lunr": "^2.3.7",
7168
"@types/make-fetch-happen": "^10.0.4",
72-
"@vitest/coverage-v8": "^3.2.1",
69+
"@vitest/coverage-v8": "^3.2.3",
7370
"changelogen": "^0.6.1",
7471
"husky": "^9.1.7",
7572
"lint-staged": "^16.1.0",
73+
"msw": "^2.10.2",
7674
"rimraf": "^6.0.1",
7775
"typescript": "^5.8.3",
78-
"vitest": "^3.2.0"
76+
"vitest": "^3.2.3"
7977
}
8078
}

src/cacheManager.ts

Lines changed: 0 additions & 223 deletions
This file was deleted.

src/configs.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/constants.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1-
// Constants for cache configuration
2-
const FOURTEEN_DAYS_MS = 14 * 24 * 60 * 60 * 1000; // 14 days in milliseconds
3-
const DEFAULT_CACHE_MODE: RequestCache = 'default';
4-
const DEFAULT_RETRIES = 3;
5-
const DEFAULT_RETRY_FACTOR = 2;
6-
const DEFAULT_MIN_TIMEOUT = 1000; // 1 second
7-
const DEFAULT_MAX_TIMEOUT = 10000; // 10 seconds
1+
import { tmpdir } from 'node:os';
2+
import { join } from 'node:path';
3+
import { getStringFromEnv } from '@aws-lambda-powertools/commons/utils/env';
84

9-
/**
10-
* Represents different content types for the fetch service
11-
*/
12-
const ContentType = {
13-
WEB_PAGE: 'web-page',
14-
MARKDOWN: 'markdown',
15-
} as const;
5+
const MCP_SERVER_NAME = 'powertools-for-aws-mcp' as const;
166

177
// Allowed domain for security
188
const ALLOWED_DOMAIN = 'docs.powertools.aws.dev';
199
// Base URL for Powertools documentation
2010
const POWERTOOLS_BASE_URL = 'https://docs.powertools.aws.dev/lambda';
2111

22-
// Constants for performance tuning
2312
const FETCH_TIMEOUT_MS = 15000; // 15 seconds timeout for fetch operations
2413

2514
const runtimes = ['java', 'dotnet', 'typescript', 'python'] as const;
2615

16+
const CACHE_BASE_PATH = getStringFromEnv({
17+
key: 'CACHE_BASE_PATH',
18+
defaultValue: join(tmpdir(), 'powertools-mcp'),
19+
});
20+
2721
export {
28-
FOURTEEN_DAYS_MS,
29-
DEFAULT_CACHE_MODE,
30-
DEFAULT_RETRIES,
31-
DEFAULT_RETRY_FACTOR,
32-
DEFAULT_MIN_TIMEOUT,
33-
DEFAULT_MAX_TIMEOUT,
34-
ContentType,
22+
MCP_SERVER_NAME,
3523
ALLOWED_DOMAIN,
3624
FETCH_TIMEOUT_MS,
3725
runtimes,
3826
POWERTOOLS_BASE_URL,
27+
CACHE_BASE_PATH,
3928
};

0 commit comments

Comments
 (0)