visus-mcp 0.6.1 → 0.8.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/.claude/settings.local.json +33 -1
- package/.env.status +7 -0
- package/CHANGELOG.md +65 -0
- package/CLAUDE.md +200 -0
- package/README.md +15 -7
- package/SECURITY.md +2 -0
- package/STATUS.md +203 -9
- package/dist/browser/playwright-renderer.d.ts.map +1 -1
- package/dist/browser/playwright-renderer.js +71 -51
- package/dist/browser/playwright-renderer.js.map +1 -1
- package/dist/content-handlers/index.d.ts +36 -0
- package/dist/content-handlers/index.d.ts.map +1 -0
- package/dist/content-handlers/index.js +59 -0
- package/dist/content-handlers/index.js.map +1 -0
- package/dist/content-handlers/json-handler.d.ts +28 -0
- package/dist/content-handlers/json-handler.d.ts.map +1 -0
- package/dist/content-handlers/json-handler.js +116 -0
- package/dist/content-handlers/json-handler.js.map +1 -0
- package/dist/content-handlers/pdf-handler.d.ts +29 -0
- package/dist/content-handlers/pdf-handler.d.ts.map +1 -0
- package/dist/content-handlers/pdf-handler.js +77 -0
- package/dist/content-handlers/pdf-handler.js.map +1 -0
- package/dist/content-handlers/svg-handler.d.ts +35 -0
- package/dist/content-handlers/svg-handler.d.ts.map +1 -0
- package/dist/content-handlers/svg-handler.js +206 -0
- package/dist/content-handlers/svg-handler.js.map +1 -0
- package/dist/content-handlers/types.d.ts +42 -0
- package/dist/content-handlers/types.d.ts.map +1 -0
- package/dist/content-handlers/types.js +7 -0
- package/dist/content-handlers/types.js.map +1 -0
- package/dist/index.js +0 -0
- package/dist/tools/fetch.d.ts.map +1 -1
- package/dist/tools/fetch.js +62 -4
- package/dist/tools/fetch.js.map +1 -1
- package/package.json +4 -2
- package/server.json +3 -3
- package/src/browser/playwright-renderer.ts +74 -51
- package/src/content-handlers/index.ts +72 -0
- package/src/content-handlers/json-handler.ts +137 -0
- package/src/content-handlers/pdf-handler.ts +91 -0
- package/src/content-handlers/svg-handler.ts +243 -0
- package/src/content-handlers/types.ts +44 -0
- package/src/tools/fetch.ts +69 -4
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -47
- package/.github/ISSUE_TEMPLATE/false_positive.md +0 -43
- package/.github/ISSUE_TEMPLATE/new_pattern.md +0 -49
- package/.github/ISSUE_TEMPLATE/security_report.md +0 -31
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -39
- package/.mcpregistry_github_token +0 -1
- package/.mcpregistry_registry_token +0 -1
- package/CONTRIBUTING.md +0 -329
- package/LINKEDIN-STRATEGY.md +0 -367
- package/ROADMAP.md +0 -221
- package/SECURITY-AUDIT-v1.md +0 -277
- package/SUBMISSION.md +0 -66
- package/TROUBLESHOOT-AUTH-20260322-2019.md +0 -291
- package/TROUBLESHOOT-BUILD-20260319-1450.md +0 -546
- package/TROUBLESHOOT-FETCH-20260320-1150.md +0 -168
- package/TROUBLESHOOT-JEST-20260323-1357.md +0 -139
- package/TROUBLESHOOT-LAMBDA-20260322-1945.md +0 -183
- package/TROUBLESHOOT-PLAYWRIGHT-20260321-1549.md +0 -217
- package/TROUBLESHOOT-SSL-20260320-1138.md +0 -171
- package/TROUBLESHOOT-STRUCTURED-20260320-1200.md +0 -246
- package/TROUBLESHOOT-TEST-20260320-0942.md +0 -281
- package/VISUS-CLAUDE-CODE-PROMPT.md +0 -324
- package/VISUS-PROJECT-PLAN.md +0 -205
- package/cdk.json +0 -73
- package/infrastructure/app.ts +0 -39
- package/infrastructure/stack.ts +0 -297
- package/jest.config.js +0 -33
- package/jest.setup.js +0 -9
- package/test-output.txt +0 -4
- package/tests/auth-smoke.test.ts +0 -480
- package/tests/elicit-runner.test.ts +0 -232
- package/tests/fetch-tool.test.ts +0 -922
- package/tests/hitl-gate.test.ts +0 -267
- package/tests/injection-corpus.ts +0 -338
- package/tests/pii-allowlist.test.ts +0 -282
- package/tests/reader.test.ts +0 -353
- package/tests/sanitizer.test.ts +0 -358
- package/tests/search.test.ts +0 -456
- package/tests/threat-reporter.test.ts +0 -334
- package/tsconfig.cdk.json +0 -35
|
@@ -28,7 +28,39 @@
|
|
|
28
28
|
"Bash(git remote:*)",
|
|
29
29
|
"Bash(brew install:*)",
|
|
30
30
|
"Bash(mcp-publisher:*)",
|
|
31
|
-
"Bash(npm version:*)"
|
|
31
|
+
"Bash(npm version:*)",
|
|
32
|
+
"Bash(aws lambda get-function:*)",
|
|
33
|
+
"Bash(pkill:*)",
|
|
34
|
+
"Bash(docker info:*)",
|
|
35
|
+
"Bash(npx esbuild:*)",
|
|
36
|
+
"Bash(./node_modules/.bin/esbuild:*)",
|
|
37
|
+
"Bash(node_modules/.bin/esbuild:*)",
|
|
38
|
+
"Bash(zip:*)",
|
|
39
|
+
"Bash(aws lambda update-function-code:*)",
|
|
40
|
+
"Bash(aws lambda get-function-configuration:*)",
|
|
41
|
+
"Bash(aws sts get-caller-identity:*)",
|
|
42
|
+
"Bash(aws cognito-idp list-users:*)",
|
|
43
|
+
"Bash(aws cognito-idp admin-create-user:*)",
|
|
44
|
+
"Bash(aws cognito-idp admin-set-user-password:*)",
|
|
45
|
+
"Bash(aws cognito-idp initiate-auth:*)",
|
|
46
|
+
"Bash(TOKEN=\"eyJraWQiOiJ1eGNRZmJWbWx4WFBaSzdwYisxck5mcmxaaXBHZE5Wekw0WWFmMis5c25ZPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI3NDA4OTRjOC01MDYxLTcwOGMtMzkwYy1mMmIxMmRkOGY4MDciLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfOFVLQU9EQWZxIiwiY29nbml0bzp1c2VybmFtZSI6Ijc0MDg5NGM4LTUwNjEtNzA4Yy0zOTBjLWYyYjEyZGQ4ZjgwNyIsIm9yaWdpbl9qdGkiOiJmM2Y2ZjRhNi1lYWE2LTQ1NGMtYjFhMC0xYzY3MzgyNzYyOGMiLCJhdWQiOiIzam9yMTNhdXJjNThybHY4bDZjYW5iN29ldSIsImV2ZW50X2lkIjoiNWYzMWU5YjAtZmIxOS00NWE2LTkxNzEtNWYxYjQyZjcwZjdiIiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE3NzQzNTE4MzcsImV4cCI6MTc3NDM1NTQzNywiaWF0IjoxNzc0MzUxODM3LCJqdGkiOiI5ZmYwMzlhMi1hOGVkLTQ3ZWQtYjNiZS1jM2Q1NmU1MGEwM2MiLCJlbWFpbCI6InRlc3QtdXNlckBsYXRlb3MuYWkifQ.XxRcRpHWHNht0aVJMr2MJbDVS1fGBH0YchOjaxaYYBJFbptSRf_J_GT2q1EJLAFm9Ey1FlJvQF_oBpOKRd37DiYwbJZxltmAtlF-7hfiNQwfHnZ6T7oFERQx353RyZL3DHrHE2s6BbDFkJb69xwjuzn4ijMVrsZ_ny3qxHC02Fr37oumwbP_cfey3wjjjmONedUQwX6o0ajUK_Aafk20O-tWFDDUDk1Ua_TdPct0wOztYHcGhxE1Yo_g_mykwKLtI-ZSWiBaGj-GTGidgQ_RCJPKrQPK73xQAePvJMkB6SKlJg5tfnvnB1S_Hnsyg1bR3laZg1M-bP_3eTRAl6le5g\")",
|
|
47
|
+
"Bash(aws apigateway:*)",
|
|
48
|
+
"Bash(aws logs describe-log-groups:*)",
|
|
49
|
+
"Bash(python3:*)",
|
|
50
|
+
"Bash(echo:*)",
|
|
51
|
+
"Bash(ID_TOKEN=\"eyJraWQiOiJ1eGNRZmJWbWx4WFBaSzdwYisxck5mcmxaaXBHZE5Wekw0WWFmMis5c25ZPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI3NDA4OTRjOC01MDYxLTcwOGMtMzkwYy1mMmIxMmRkOGY4MDciLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfOFVLQU9EQWZxIiwiY29nbml0bzp1c2VybmFtZSI6Ijc0MDg5NGM4LTUwNjEtNzA4Yy0zOTBjLWYyYjEyZGQ4ZjgwNyIsIm9yaWdpbl9qdGkiOiIyMTY0OTkyMy1lMDcwLTRjMWQtYjFmYy1jZjZlODM2Y2E1OTIiLCJhdWQiOiIzam9yMTNhdXJjNThybHY4bDZjYW5iN29ldSIsImV2ZW50X2lkIjoiM2MxNzIwZjgtMTljMS00Y2MxLWI2MDctYWI5NzlmOTIzZGU1IiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE3NzQzNTIyNjMsImV4cCI6MTc3NDM1NTg2MywiaWF0IjoxNzc0MzUyMjYzLCJqdGkiOiIyY2Y3MWMwYi1hNzkwLTQzMjItYjQzZC1jZDRjNzIxZjdjZmIiLCJlbWFpbCI6InRlc3QtdXNlckBsYXRlb3MuYWkifQ.ljsffJWON0SykNe00nf1P1X0gtOLd4ccR4EmhRVFucOFulyEpB5Uyjbt3npuTah6liU2ZBTSWjKkdS0olRGFlLipzUMqDPqzINwwjkOMVQK5bf0l3f31FfdeQ_lKiYHKXbEDWJH8TRIvVy3OSl8I5UALn2swXyaWnLOO2mM6gcfYTr7Gt0JhfDohhKnvbr6kbGfCXu8kvp-uPGD4bKc7blmqwwKjaKQ49BukfhF_aC6fuiqsVydbYTO_fWbxTWITD39ULszaNbrGSBr0Q8ljWHC-t3qB9xlbXGOA3wbY13OaIc4P1kvzvQn6atP1FzZ5TSUb-DuDrS2lkGI-jnWjEA\")",
|
|
52
|
+
"Bash(/tmp/token.txt)",
|
|
53
|
+
"Bash(chmod:*)",
|
|
54
|
+
"Bash(/tmp/test-auth.sh)",
|
|
55
|
+
"Bash(/tmp/test-google.sh:*)",
|
|
56
|
+
"Bash(git reset:*)",
|
|
57
|
+
"Bash(npx visus-mcp:*)",
|
|
58
|
+
"WebSearch",
|
|
59
|
+
"WebFetch(domain:glama.ai)",
|
|
60
|
+
"Bash(unzip:*)",
|
|
61
|
+
"Bash(mkdir:*)",
|
|
62
|
+
"Bash(comm -13:*)",
|
|
63
|
+
"Bash(comm -23:*)"
|
|
32
64
|
],
|
|
33
65
|
"deny": [],
|
|
34
66
|
"ask": []
|
package/.env.status
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Sensitive infrastructure values for STATUS.md
|
|
2
|
+
# This file is gitignored and contains the real values that are replaced with placeholders in STATUS.md
|
|
3
|
+
|
|
4
|
+
AWS_ACCOUNT_ID=080746528746
|
|
5
|
+
API_ENDPOINT=https://wyomy29zd7.execute-api.us-east-1.amazonaws.com
|
|
6
|
+
LAMBDA_FUNCTION_NAME=VisusRendererStack-dev-RendererFunction3AA1789A-554zTOoz3FVg
|
|
7
|
+
MAINTAINER_EMAIL=lowmls@gmail.com
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **PDF Content Handler** (`src/content-handlers/pdf-handler.ts`)
|
|
13
|
+
- Handles `application/pdf` content type
|
|
14
|
+
- Extracts text and metadata (title, author, subject, keywords, creator, producer) from PDF files
|
|
15
|
+
- Passes all extracted text through the 43-pattern injection detection pipeline
|
|
16
|
+
- Returns sanitized plain text, discarding binary objects
|
|
17
|
+
- Returns structured error (`PDF_PARSE_FAILED`) for corrupt or encrypted PDFs
|
|
18
|
+
|
|
19
|
+
- **JSON Content Handler** (`src/content-handlers/json-handler.ts`)
|
|
20
|
+
- Handles `application/json` and `text/json` content types
|
|
21
|
+
- Recursively traverses JSON object tree and sanitizes all string values
|
|
22
|
+
- Preserves original JSON structure in output
|
|
23
|
+
- Handles arrays, nested objects, and mixed-type arrays correctly
|
|
24
|
+
- Falls back to plain text sanitization pipeline if JSON parsing fails
|
|
25
|
+
- Tracks and reports count of sanitized fields per request
|
|
26
|
+
|
|
27
|
+
- **SVG Content Handler** (`src/content-handlers/svg-handler.ts`)
|
|
28
|
+
- Handles `image/svg+xml` content type
|
|
29
|
+
- Strips dangerous elements unconditionally:
|
|
30
|
+
- `<script>` elements and all children
|
|
31
|
+
- `<use>` elements with external `href`/`xlink:href` attributes
|
|
32
|
+
- `<foreignObject>` elements and all children
|
|
33
|
+
- All event handler attributes (onload, onclick, onerror, etc.)
|
|
34
|
+
- `<set>` and `<animate>` elements referencing external resources
|
|
35
|
+
- `data:` URI attributes
|
|
36
|
+
- Extracts and scans text content (title, desc, text elements) for injection patterns
|
|
37
|
+
- Preserves safe presentation attributes (fill, stroke, transform, viewBox, etc.)
|
|
38
|
+
- Returns structured error (`SVG_PARSE_FAILED`) if XML parsing fails
|
|
39
|
+
|
|
40
|
+
- **Content Type Routing** (`src/content-handlers/index.ts`)
|
|
41
|
+
- Central routing system for content-type specific handlers
|
|
42
|
+
- Normalizes MIME types (strips parameters, lowercases)
|
|
43
|
+
- Routes content to appropriate handler based on MIME type
|
|
44
|
+
- Returns structured rejection (`UNSUPPORTED_CONTENT_TYPE`) for unsupported types
|
|
45
|
+
- No unhandled exceptions - all errors return structured responses
|
|
46
|
+
|
|
47
|
+
- **Updated `visus_fetch` Tool** (`src/tools/fetch.ts`)
|
|
48
|
+
- Integrated content handler routing for PDF, JSON, and SVG
|
|
49
|
+
- Checks Content-Type header and routes to specialized handlers before existing HTML/XML flow
|
|
50
|
+
- Maintains backward compatibility with existing HTML/XML/RSS conversion logic
|
|
51
|
+
|
|
52
|
+
- **Comprehensive Test Suite** (`tests/content-handlers.test.ts`)
|
|
53
|
+
- 20 test cases covering all three handlers
|
|
54
|
+
- Tests for clean content (no false positives)
|
|
55
|
+
- Tests for injection detection and sanitization
|
|
56
|
+
- Tests for error handling (corrupt/invalid content)
|
|
57
|
+
- Tests for edge cases (nested structures, arrays, malformed input)
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- Added `pdf-parse` dependency (v2.4.5) for PDF text extraction
|
|
62
|
+
|
|
63
|
+
## [0.6.2] - 2026-03-14
|
|
64
|
+
|
|
65
|
+
Previous releases documented in git history.
|
package/CLAUDE.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
4
|
|
|
5
|
+
**Repository:** https://github.com/visus-mcp/visus-mcp
|
|
6
|
+
|
|
5
7
|
## Project Overview
|
|
6
8
|
|
|
7
9
|
**Visus** (`visus-mcp`) is an MCP tool that provides Claude with secure, sanitized access to web pages. Unlike other MCP browser tools (Firecrawl, Playwright MCP, ScrapeGraphAI), Visus runs ALL fetched content through an injection sanitization pipeline before the LLM reads it.
|
|
@@ -71,6 +73,9 @@ npm publish --dry-run # Validate package before publishing
|
|
|
71
73
|
npx visus-mcp # Start MCP server
|
|
72
74
|
```
|
|
73
75
|
|
|
76
|
+
**IMPORTANT: On every npm release, keep `server.json` version in sync with `package.json` version.**
|
|
77
|
+
The MCP registry requires that the version field in `server.json` matches the published npm package version.
|
|
78
|
+
|
|
74
79
|
## Coding Standards (Lateos Conventions)
|
|
75
80
|
|
|
76
81
|
- **TypeScript strict mode** - No `any` types allowed
|
|
@@ -103,6 +108,8 @@ All tests must pass before Phase 1 is complete.
|
|
|
103
108
|
- 43 injection payloads (one per pattern category)
|
|
104
109
|
- 10 clean pages/content samples (should produce no detections)
|
|
105
110
|
|
|
111
|
+
---
|
|
112
|
+
|
|
106
113
|
## Standard Troubleshooting Protocol
|
|
107
114
|
|
|
108
115
|
Whenever you encounter an error, blocked deployment, or multi-step recovery task, you MUST generate a structured troubleshooting log automatically. This is not optional — it applies to every build, fix, and diagnostic task in this project.
|
|
@@ -118,6 +125,62 @@ Save to project root. Examples:
|
|
|
118
125
|
- `TROUBLESHOOT-LAMBDA-20260314-0900.md`
|
|
119
126
|
- `TROUBLESHOOT-SLIM-20260314-0629.md`
|
|
120
127
|
|
|
128
|
+
### Log Structure
|
|
129
|
+
|
|
130
|
+
Every troubleshooting log MUST follow this three-phase structure:
|
|
131
|
+
|
|
132
|
+
#### Phase 1: Investigation (read-only)
|
|
133
|
+
No changes to code or infrastructure. Gather facts, reproduce the error, read logs.
|
|
134
|
+
Only advance to Phase 2 after root cause is confirmed or a clear hypothesis is formed.
|
|
135
|
+
|
|
136
|
+
#### Phase 2: Fix Plan
|
|
137
|
+
Write out the proposed fix and alternatives considered. Do NOT execute yet.
|
|
138
|
+
If root cause shifts during Phase 2, return to Phase 1.
|
|
139
|
+
|
|
140
|
+
#### Phase 3: Execution
|
|
141
|
+
Implement the fix. Log every action. Update the SUMMARY at the end.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### Stop Conditions (mandatory — check before every action)
|
|
146
|
+
|
|
147
|
+
If any of the following are true, **STOP immediately**, log the blocker, and wait for user input:
|
|
148
|
+
|
|
149
|
+
| Condition | Action |
|
|
150
|
+
|-----------|--------|
|
|
151
|
+
| Deployment or build hangs >10 minutes | Kill process, document, ask user for direction |
|
|
152
|
+
| Same error appears >2 times in a row | Stop retrying, propose alternative approach |
|
|
153
|
+
| Root cause shifts away from original task | Re-confirm scope with user before continuing |
|
|
154
|
+
| A tool or service is unavailable (Docker, AWS, etc.) | Document and present options — do not loop |
|
|
155
|
+
| Success criteria cannot be verified | Stop and ask user how to validate |
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Environment Pre-flight
|
|
160
|
+
|
|
161
|
+
Run this checklist before ANY deployment or infrastructure task. Log each result.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# AWS credentials
|
|
165
|
+
aws sts get-caller-identity
|
|
166
|
+
|
|
167
|
+
# Docker health (required for CDK bundling)
|
|
168
|
+
docker info
|
|
169
|
+
|
|
170
|
+
# Disk space (ENOSPC will cause silent failures)
|
|
171
|
+
df -h /
|
|
172
|
+
|
|
173
|
+
# CDK version
|
|
174
|
+
npx cdk --version
|
|
175
|
+
|
|
176
|
+
# Node/npm
|
|
177
|
+
node --version && npm --version
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
If Docker is unavailable or disk space is low, use the manual Lambda deploy path (see Lambda Deployment below) rather than attempting CDK.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
121
184
|
### Entry Format (append after EVERY action)
|
|
122
185
|
|
|
123
186
|
```markdown
|
|
@@ -130,6 +193,24 @@ Save to project root. Examples:
|
|
|
130
193
|
**Status:** ✅ Success / ❌ Failed / ⚠️ Partial
|
|
131
194
|
```
|
|
132
195
|
|
|
196
|
+
### Ruled Out (maintain throughout session)
|
|
197
|
+
|
|
198
|
+
Append to this section whenever a suspected cause is eliminated. Prevents re-investigation.
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
## Ruled Out
|
|
202
|
+
- ❌ <Component>: <one-line reason> — confirmed <date/time>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Example:
|
|
206
|
+
```markdown
|
|
207
|
+
## Ruled Out
|
|
208
|
+
- ❌ Cognito JWT: Auth correctly returns 401 on unauthenticated requests — not the issue
|
|
209
|
+
- ❌ API Gateway routing: Routes confirmed correct in stack outputs — not the issue
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
133
214
|
### Rules
|
|
134
215
|
|
|
135
216
|
1. **Log BEFORE executing, not after** — write Goal and Reasoning first
|
|
@@ -137,6 +218,25 @@ Save to project root. Examples:
|
|
|
137
218
|
3. **On failure:** log the full error, state your revised reasoning, attempt one alternative, log that too
|
|
138
219
|
4. **Do not summarize or clean up errors** — paste raw output verbatim
|
|
139
220
|
5. **End every log with a SUMMARY section:** root cause, resolution, lessons learned, and open issues
|
|
221
|
+
6. **Populate "Ruled Out" in real time** — do not re-investigate eliminated causes
|
|
222
|
+
7. **Complete Phase 1 fully before making any changes** — no exceptions
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### CLAUDE.md Updates Required
|
|
227
|
+
|
|
228
|
+
At the end of every troubleshooting session, before closing, check whether any findings should be promoted to this file. Add a section to the troubleshoot doc:
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
## CLAUDE.md Updates Required
|
|
232
|
+
- [ ] <Finding that should become a permanent convention>
|
|
233
|
+
- [ ] <New known error to add to the registry>
|
|
234
|
+
- [ ] <New deployment step or warning>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Then apply those updates to CLAUDE.md as the final step of the session.
|
|
238
|
+
|
|
239
|
+
---
|
|
140
240
|
|
|
141
241
|
### Purpose
|
|
142
242
|
|
|
@@ -152,6 +252,8 @@ Goal: Restore MCP handler Lambda with proper dependency packaging
|
|
|
152
252
|
|
|
153
253
|
---
|
|
154
254
|
|
|
255
|
+
## Phase 1: Investigation
|
|
256
|
+
|
|
155
257
|
## [06:02:18] Step 1 - Locate MCP Handler Source
|
|
156
258
|
|
|
157
259
|
**Goal:** Find the mcp_handler.py source file in the project
|
|
@@ -163,14 +265,109 @@ Goal: Restore MCP handler Lambda with proper dependency packaging
|
|
|
163
265
|
|
|
164
266
|
---
|
|
165
267
|
|
|
268
|
+
## Ruled Out
|
|
269
|
+
- ❌ IAM permissions: Lambda execution role has correct policies — not the issue
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Phase 2: Fix Plan
|
|
274
|
+
...
|
|
275
|
+
|
|
276
|
+
## Phase 3: Execution
|
|
277
|
+
...
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
166
281
|
# RECOVERY SUMMARY
|
|
167
282
|
|
|
168
283
|
Final Status: ✅ RESTORED
|
|
169
284
|
Root Cause: Lambda package missing runtime dependencies
|
|
170
285
|
Resolution: Installed aws_lambda_powertools + aws_xray_sdk
|
|
171
286
|
Lessons Learned: Always verify dependencies in Lambda packages
|
|
287
|
+
|
|
288
|
+
## CLAUDE.md Updates Required
|
|
289
|
+
- [ ] Add aws_lambda_powertools to standard Lambda dependency checklist
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Known Errors Registry
|
|
295
|
+
|
|
296
|
+
When a root cause is confirmed, add it here. Future sessions check this list first before investigating.
|
|
297
|
+
|
|
298
|
+
| Error | Root Cause | Fix | Date Confirmed |
|
|
299
|
+
|-------|-----------|-----|----------------|
|
|
300
|
+
| `ERR_MODULE_NOT_FOUND: @modelcontextprotocol/sdk` in Lambda | `index.js` (MCP stdio server) included in Lambda bundle via `package.json` `"main"` field; SDK not bundled | Add `@modelcontextprotocol/sdk` to `externalModules` in `infrastructure/stack.ts` | 2026-03-24 |
|
|
301
|
+
| CDK `docker buildx` hangs indefinitely | Docker resource contention or disk pressure on Apple Silicon Mac | Use manual Lambda deploy script (see below); fix Docker separately | 2026-03-24 |
|
|
302
|
+
| `ENOSPC` on Claude Code startup | Mac disk full; `~/.claude/debug/` write fails | Free disk space; `rm -rf ~/.claude/debug/`; restart | 2026-03-24 |
|
|
303
|
+
| 401 Unauthorized after `cdk deploy` | CDK does NOT automatically redeploy API Gateway stages when Lambda code or authorizer config changes | After every `cdk deploy`, run: `aws apigateway create-deployment --rest-api-id <api-id> --stage-name <stage>` | 2026-03-24 |
|
|
304
|
+
| `unable to get local issuer certificate` in Lambda | undici HTTP client in AWS Lambda Node.js 20 runtime lacks proper CA certificate configuration | Replace undici with Node.js native `fetch()` API (available in Node 18+) which has proper CA handling in Lambda | 2026-03-24 |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Lambda Deployment
|
|
309
|
+
|
|
310
|
+
### Bundling Conventions
|
|
311
|
+
|
|
312
|
+
**CRITICAL: Always use `--format=cjs` for Lambda bundles.**
|
|
313
|
+
AWS SDK v3 uses dynamic `require()` internally. ESM output from esbuild will fail at Lambda runtime with `ERR_REQUIRE_ESM` or similar. CommonJS is the correct format for all Lambda deployments.
|
|
314
|
+
|
|
315
|
+
**Always externalize these packages:**
|
|
316
|
+
- `playwright-core` — added via Lambda layer
|
|
317
|
+
- `@sparticuz/chromium` — added via Lambda layer
|
|
318
|
+
- `@modelcontextprotocol/sdk` — only needed for stdio mode, not Lambda
|
|
319
|
+
|
|
320
|
+
**Entry point must always be `src/lambda-handler.ts`, NOT `src/index.ts`.**
|
|
321
|
+
`index.ts` is the MCP stdio server and imports packages that must not be in the Lambda bundle.
|
|
322
|
+
|
|
323
|
+
### Manual Deploy Script (use when CDK/Docker is unavailable)
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
#!/bin/bash
|
|
327
|
+
# scripts/deploy-lambda.sh
|
|
328
|
+
# Use this when CDK Docker bundling is blocked
|
|
329
|
+
|
|
330
|
+
set -e
|
|
331
|
+
|
|
332
|
+
echo "Building Lambda bundle..."
|
|
333
|
+
npm run build
|
|
334
|
+
|
|
335
|
+
npx esbuild src/lambda-handler.ts \
|
|
336
|
+
--bundle \
|
|
337
|
+
--platform=node \
|
|
338
|
+
--target=node20 \
|
|
339
|
+
--format=cjs \
|
|
340
|
+
--outfile=dist/lambda-bundle.js \
|
|
341
|
+
--external:playwright-core \
|
|
342
|
+
--external:@sparticuz/chromium \
|
|
343
|
+
--external:@modelcontextprotocol/sdk \
|
|
344
|
+
--sourcemap
|
|
345
|
+
|
|
346
|
+
echo "Zipping..."
|
|
347
|
+
cd dist && zip -r ../lambda.zip lambda-bundle.js lambda-bundle.js.map && cd ..
|
|
348
|
+
|
|
349
|
+
echo "Getting function name..."
|
|
350
|
+
FUNCTION_NAME=$(aws cloudformation describe-stacks \
|
|
351
|
+
--stack-name VisusStack-dev \
|
|
352
|
+
--query "Stacks[0].Outputs[?OutputKey=='LambdaFunctionName'].OutputValue" \
|
|
353
|
+
--output text)
|
|
354
|
+
|
|
355
|
+
echo "Deploying to Lambda: $FUNCTION_NAME"
|
|
356
|
+
aws lambda update-function-code \
|
|
357
|
+
--function-name "$FUNCTION_NAME" \
|
|
358
|
+
--zip-file fileb://lambda.zip
|
|
359
|
+
|
|
360
|
+
echo "Waiting for update..."
|
|
361
|
+
aws lambda wait function-updated --function-name "$FUNCTION_NAME"
|
|
362
|
+
|
|
363
|
+
echo "Testing health endpoint..."
|
|
364
|
+
curl -s https://3lsush2fx0.execute-api.us-east-1.amazonaws.com/dev/health | jq .
|
|
365
|
+
|
|
366
|
+
echo "Done. Check CloudWatch for ERR_MODULE_NOT_FOUND — should be gone."
|
|
172
367
|
```
|
|
173
368
|
|
|
369
|
+
After using manual deploy, run a full `cdk deploy` when Docker is restored to keep CloudFormation state in sync with live infrastructure.
|
|
370
|
+
|
|
174
371
|
---
|
|
175
372
|
|
|
176
373
|
## CRITICAL: Security Rules — Never Violate These
|
|
@@ -240,6 +437,8 @@ lateos-visus/
|
|
|
240
437
|
│ ├── browser/
|
|
241
438
|
│ │ └── playwright-renderer.ts # Headless Chromium page fetcher
|
|
242
439
|
│ └── types.ts # Shared TypeScript interfaces
|
|
440
|
+
├── scripts/
|
|
441
|
+
│ └── deploy-lambda.sh # Manual Lambda deploy (bypasses CDK/Docker)
|
|
243
442
|
└── tests/
|
|
244
443
|
├── sanitizer.test.ts
|
|
245
444
|
├── fetch-tool.test.ts
|
|
@@ -322,3 +521,4 @@ Both README.md and SECURITY.md must lead with the security narrative, not featur
|
|
|
322
521
|
- PII redaction types and format
|
|
323
522
|
- Honest limitations (novel obfuscation, AI-generated benign-looking instructions)
|
|
324
523
|
- Vulnerability reporting: security@lateos.ai or GitHub Security tab
|
|
524
|
+
- remember that my gitHub repo is located at https://github.com/visus-mcp/visus-mcp
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Visus — Secure Web Access for Claude
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/visus-mcp)
|
|
4
|
-
[](https://github.com/visus-mcp/visus-mcp)
|
|
5
5
|
[](https://github.com/visus-mcp/visus-mcp)
|
|
6
6
|
[](https://modelcontextprotocol.io)
|
|
7
7
|
[](https://github.com/visus-mcp/visus-mcp/blob/main/LICENSE)
|
|
@@ -47,17 +47,23 @@ visus-mcp fetches the same page and delivers:
|
|
|
47
47
|
## How Visus Works
|
|
48
48
|
|
|
49
49
|
```
|
|
50
|
-
URL → Playwright Render →
|
|
51
|
-
→
|
|
52
|
-
→
|
|
50
|
+
URL → Playwright Render → Content-Type Detection
|
|
51
|
+
→ Specialized Handlers (PDF/JSON/SVG) OR HTML Pipeline
|
|
52
|
+
→ Injection Sanitizer (43 patterns) → PII Redactor
|
|
53
|
+
→ Token Ceiling (24k cap) → Clean Content → Claude
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
### Security Pipeline
|
|
56
57
|
|
|
57
58
|
1. **Browser Rendering**: Headless Chromium via Playwright fetches the page
|
|
58
|
-
2. **
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
2. **Content-Type Routing**: Detects MIME type and routes to specialized handlers:
|
|
60
|
+
- **PDF** (`application/pdf`) — Extracts text and metadata, sanitizes all fields
|
|
61
|
+
- **JSON** (`application/json`) — Recursively sanitizes all string values, preserves structure
|
|
62
|
+
- **SVG** (`image/svg+xml`) — Strips dangerous elements (`<script>`, event handlers), scans text
|
|
63
|
+
- **HTML/XML/RSS** — Uses existing conversion and reader extraction pipeline
|
|
64
|
+
3. **Injection Detection**: 43 pattern categories scan for prompt injection attempts
|
|
65
|
+
4. **PII Redaction**: Emails, phone numbers, SSNs, credit cards, and IP addresses are redacted
|
|
66
|
+
5. **Clean Delivery**: Stripped, formatted, token-efficient content reaches your LLM — with a compliance report attached if anything was flagged
|
|
61
67
|
|
|
62
68
|
**This pipeline runs before content enters Claude's context window** — reducing token consumption, keeping PII out of conversation history, and generating audit logs when injection patterns are detected.
|
|
63
69
|
|
|
@@ -848,6 +854,8 @@ Copyright (c) 2026 Lateos (Leo Chongolnee)
|
|
|
848
854
|
|
|
849
855
|
Built by [Leo Chongolnee](https://github.com/leochong) (@leochong) as part of the Lateos platform.
|
|
850
856
|
|
|
857
|
+
**Repository:** https://github.com/visus-mcp/visus-mcp
|
|
858
|
+
|
|
851
859
|
Inspired by the MCP ecosystem and informed by CISSP/CEH security principles.
|
|
852
860
|
|
|
853
861
|
---
|