accessflow-mcp-server 1.0.15 → 1.1.0-beta.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/services/apiSchemas.d.ts +200 -0
- package/dist/services/apiSchemas.d.ts.map +1 -0
- package/dist/services/apiSchemas.js +95 -0
- package/dist/services/apiSchemas.js.map +1 -0
- package/dist/services/apiService.d.ts +37 -0
- package/dist/services/apiService.d.ts.map +1 -0
- package/dist/services/apiService.js +198 -0
- package/dist/services/apiService.js.map +1 -0
- package/dist/services/loggerService.d.ts +3 -0
- package/dist/services/loggerService.d.ts.map +1 -0
- package/dist/services/loggerService.js +38 -0
- package/dist/services/loggerService.js.map +1 -0
- package/dist/services/rulesService.d.ts +10 -0
- package/dist/services/rulesService.d.ts.map +1 -0
- package/dist/services/rulesService.js +70 -0
- package/dist/services/rulesService.js.map +1 -0
- package/dist/tools/getIssueRemediation.d.ts +16 -0
- package/dist/tools/getIssueRemediation.d.ts.map +1 -0
- package/dist/tools/getIssueRemediation.js +77 -0
- package/dist/tools/getIssueRemediation.js.map +1 -0
- package/dist/tools/getMostUrgentIssues.d.ts +7 -0
- package/dist/tools/getMostUrgentIssues.d.ts.map +1 -0
- package/dist/tools/getMostUrgentIssues.js +94 -0
- package/dist/tools/getMostUrgentIssues.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +21 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/resolveIssue.d.ts +16 -0
- package/dist/tools/resolveIssue.d.ts.map +1 -0
- package/dist/tools/resolveIssue.js +70 -0
- package/dist/tools/resolveIssue.js.map +1 -0
- package/dist/tools/toolRegistry.d.ts +19 -0
- package/dist/tools/toolRegistry.d.ts.map +1 -0
- package/dist/tools/toolRegistry.js +9 -0
- package/dist/tools/toolRegistry.js.map +1 -0
- package/dist/types/issues.d.ts +32 -0
- package/dist/types/issues.d.ts.map +1 -0
- package/dist/types/issues.js +6 -0
- package/dist/types/issues.js.map +1 -0
- package/dist/types/remediation.d.ts +24 -0
- package/dist/types/remediation.d.ts.map +1 -0
- package/dist/types/remediation.js +6 -0
- package/dist/types/remediation.js.map +1 -0
- package/dist/utils/domains.d.ts +2 -0
- package/dist/utils/domains.d.ts.map +1 -0
- package/dist/utils/domains.js +14 -0
- package/dist/utils/domains.js.map +1 -0
- package/dist/utils/issues.d.ts +16 -0
- package/dist/utils/issues.d.ts.map +1 -0
- package/dist/utils/issues.js +24 -0
- package/dist/utils/issues.js.map +1 -0
- package/dist/utils/middleware.d.ts +14 -0
- package/dist/utils/middleware.d.ts.map +1 -0
- package/dist/utils/middleware.js +37 -0
- package/dist/utils/middleware.js.map +1 -0
- package/dist/utils/remediation.d.ts +27 -0
- package/dist/utils/remediation.d.ts.map +1 -0
- package/dist/utils/remediation.js +139 -0
- package/dist/utils/remediation.js.map +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +14 -0
- package/dist/utils.js.map +1 -0
- package/package.json +48 -14
- package/TOOL_REFERENCE.md +0 -126
- package/assets/MCP_banner.png +0 -0
- package/bin/flow-mcp +0 -4
- package/build/index.d.ts +0 -12
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -95
- package/build/index.js.map +0 -1
- package/build/prompts/formatUrgentIssues.d.ts +0 -4
- package/build/prompts/formatUrgentIssues.d.ts.map +0 -1
- package/build/prompts/formatUrgentIssues.js +0 -78
- package/build/prompts/formatUrgentIssues.js.map +0 -1
- package/build/prompts/index.d.ts +0 -4
- package/build/prompts/index.d.ts.map +0 -1
- package/build/prompts/index.js +0 -12
- package/build/prompts/index.js.map +0 -1
- package/build/prompts/types.d.ts +0 -22
- package/build/prompts/types.d.ts.map +0 -1
- package/build/prompts/types.js +0 -2
- package/build/prompts/types.js.map +0 -1
- package/build/rules.json +0 -4591
- package/build/services/accessflow.d.ts +0 -6
- package/build/services/accessflow.d.ts.map +0 -1
- package/build/services/accessflow.js +0 -8
- package/build/services/accessflow.js.map +0 -1
- package/build/tools/getIssueRemediation.d.ts +0 -4
- package/build/tools/getIssueRemediation.d.ts.map +0 -1
- package/build/tools/getIssueRemediation.js +0 -165
- package/build/tools/getIssueRemediation.js.map +0 -1
- package/build/tools/getMostUrgentIssues.d.ts +0 -4
- package/build/tools/getMostUrgentIssues.d.ts.map +0 -1
- package/build/tools/getMostUrgentIssues.js +0 -106
- package/build/tools/getMostUrgentIssues.js.map +0 -1
- package/build/tools/index.d.ts +0 -9
- package/build/tools/index.d.ts.map +0 -1
- package/build/tools/index.js +0 -19
- package/build/tools/index.js.map +0 -1
- package/build/tools/types.d.ts +0 -19
- package/build/tools/types.d.ts.map +0 -1
- package/build/tools/types.js +0 -2
- package/build/tools/types.js.map +0 -1
- package/build/utils/config.d.ts +0 -8
- package/build/utils/config.d.ts.map +0 -1
- package/build/utils/config.js +0 -26
- package/build/utils/config.js.map +0 -1
- package/build/utils/database.d.ts +0 -13
- package/build/utils/database.d.ts.map +0 -1
- package/build/utils/database.js +0 -64
- package/build/utils/database.js.map +0 -1
- package/build/utils/domain.d.ts +0 -2
- package/build/utils/domain.d.ts.map +0 -1
- package/build/utils/domain.js +0 -11
- package/build/utils/domain.js.map +0 -1
- package/build/utils/logger.d.ts +0 -18
- package/build/utils/logger.d.ts.map +0 -1
- package/build/utils/logger.js +0 -51
- package/build/utils/logger.js.map +0 -1
- package/build/utils/responses.d.ts +0 -19
- package/build/utils/responses.d.ts.map +0 -1
- package/build/utils/responses.js +0 -41
- package/build/utils/responses.js.map +0 -1
- package/build/utils/validation.d.ts +0 -7
- package/build/utils/validation.d.ts.map +0 -1
- package/build/utils/validation.js +0 -47
- package/build/utils/validation.js.map +0 -1
- package/mcp-config.json +0 -11
- package/src/index.ts +0 -125
- package/src/services/accessflow.ts +0 -9
- package/src/tools/getIssueRemediation.ts +0 -218
- package/src/tools/getMostUrgentIssues.ts +0 -144
- package/src/tools/index.ts +0 -33
- package/src/tools/types.ts +0 -20
- package/src/utils/domain.ts +0 -13
- package/test.mjs +0 -63
- package/tsconfig.json +0 -20
- /package/{src → dist/data}/rules.json +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const sanitizeDomain = (domain) => {
|
|
2
|
+
if (!domain)
|
|
3
|
+
return '';
|
|
4
|
+
domain = domain.trim();
|
|
5
|
+
domain = domain.replace(/^https?:\/\//, '');
|
|
6
|
+
domain = domain.replace(/^www\./, '');
|
|
7
|
+
const slashIndex = domain.indexOf('/');
|
|
8
|
+
if (slashIndex !== -1) {
|
|
9
|
+
domain = domain.slice(0, slashIndex);
|
|
10
|
+
}
|
|
11
|
+
domain = domain.replace(/\.+$/, '');
|
|
12
|
+
return domain;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/utils/domains.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAU,EAAE;IACvD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEvB,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAEvB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAE5C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with accessibility issues
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes severity to uppercase string
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeSeverity(severity?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes WCAG level or returns default
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeWCAGLevel(wcagLevel?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes criteria or returns default
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeCriteria(criteria?: string): string;
|
|
16
|
+
//# sourceMappingURL=issues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/utils/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with accessibility issues
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes severity to uppercase string
|
|
6
|
+
*/
|
|
7
|
+
export function normalizeSeverity(severity) {
|
|
8
|
+
if (!severity)
|
|
9
|
+
return 'UNKNOWN';
|
|
10
|
+
return severity.toUpperCase();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes WCAG level or returns default
|
|
14
|
+
*/
|
|
15
|
+
export function normalizeWCAGLevel(wcagLevel) {
|
|
16
|
+
return wcagLevel || 'Unknown';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Normalizes criteria or returns default
|
|
20
|
+
*/
|
|
21
|
+
export function normalizeCriteria(criteria) {
|
|
22
|
+
return criteria || 'Unknown';
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/utils/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAkB;IACnD,OAAO,SAAS,IAAI,SAAS,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IACjD,OAAO,QAAQ,IAAI,SAAS,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from 'fastmcp';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if domain and API key are configured
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasValidCredentials(domain: string, apiKey: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the registration message when credentials are missing
|
|
8
|
+
*/
|
|
9
|
+
export declare function getRegistrationMessage(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a tool's execute function with credential validation middleware
|
|
12
|
+
*/
|
|
13
|
+
export declare function withCredentialCheck(domain: string, apiKey: string, tool: Tool<any, any>): Tool<any, any>;
|
|
14
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/utils/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAQ/C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GACnB,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAiBhB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if domain and API key are configured
|
|
3
|
+
*/
|
|
4
|
+
export function hasValidCredentials(domain, apiKey) {
|
|
5
|
+
return Boolean(domain && domain.trim() && apiKey && apiKey.trim());
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns the registration message when credentials are missing
|
|
9
|
+
*/
|
|
10
|
+
export function getRegistrationMessage() {
|
|
11
|
+
return `Unlock full accessibility guidance!
|
|
12
|
+
|
|
13
|
+
It looks like you don't have an active accessFlow license or API key yet.
|
|
14
|
+
|
|
15
|
+
Get instant access to remediation insights and fix accessibility issues right from VS Code, powered by accessFlow's accessibility engine.
|
|
16
|
+
|
|
17
|
+
Register now to activate your license and start improving accessibility today.`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wraps a tool's execute function with credential validation middleware
|
|
21
|
+
*/
|
|
22
|
+
export function withCredentialCheck(domain, apiKey, tool) {
|
|
23
|
+
const originalExecute = tool.execute;
|
|
24
|
+
if (!originalExecute) {
|
|
25
|
+
throw new Error('Tool must have an execute function');
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...tool,
|
|
29
|
+
execute: async (args, context) => {
|
|
30
|
+
if (!hasValidCredentials(domain, apiKey)) {
|
|
31
|
+
return getRegistrationMessage();
|
|
32
|
+
}
|
|
33
|
+
return originalExecute(args, context);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/utils/middleware.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,MAAc;IAChE,OAAO,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;;;+EAMsE,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAc,EACd,MAAc,EACd,IAAoB;IAEpB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;IAErC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,OAAqB,EAAE,EAAE;YACtD,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzC,OAAO,sBAAsB,EAAE,CAAC;YAClC,CAAC;YAED,OAAO,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting remediation responses
|
|
3
|
+
*/
|
|
4
|
+
import type { ApiIssueRemediation, ApiRule } from '../types/remediation.js';
|
|
5
|
+
/**
|
|
6
|
+
* Extracts related rule ID from various formats
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractRuleId(relatedRuleId?: string | {
|
|
9
|
+
$oid: string;
|
|
10
|
+
} | {
|
|
11
|
+
toString: () => string;
|
|
12
|
+
}): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Extracts date from various formats
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractDate(date?: {
|
|
17
|
+
$date: number;
|
|
18
|
+
} | number | string): Date;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts code blocks from HTML resolution
|
|
21
|
+
*/
|
|
22
|
+
export declare function extractCodeBlocks(htmlResolution: string): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Formats the remediation response as markdown
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatRemediationResponse(issue: ApiIssueRemediation, rule?: ApiRule | null): string;
|
|
27
|
+
//# sourceMappingURL=remediation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remediation.d.ts","sourceRoot":"","sources":["../../src/utils/remediation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;GAEG;AACH,wBAAgB,aAAa,CAC3B,aAAa,CAAC,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;CAAE,GACrE,MAAM,GAAG,IAAI,CAuBf;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAc5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAclE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,mBAAmB,EAC1B,IAAI,GAAE,OAAO,GAAG,IAAW,GAC1B,MAAM,CAgGR"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for formatting remediation responses
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extracts related rule ID from various formats
|
|
6
|
+
*/
|
|
7
|
+
export function extractRuleId(relatedRuleId) {
|
|
8
|
+
if (!relatedRuleId) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (typeof relatedRuleId === 'string') {
|
|
12
|
+
return relatedRuleId;
|
|
13
|
+
}
|
|
14
|
+
if (typeof relatedRuleId === 'object') {
|
|
15
|
+
if ('$oid' in relatedRuleId) {
|
|
16
|
+
return relatedRuleId.$oid;
|
|
17
|
+
}
|
|
18
|
+
if ('toString' in relatedRuleId &&
|
|
19
|
+
typeof relatedRuleId.toString === 'function') {
|
|
20
|
+
return relatedRuleId.toString();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extracts date from various formats
|
|
27
|
+
*/
|
|
28
|
+
export function extractDate(date) {
|
|
29
|
+
if (!date) {
|
|
30
|
+
return new Date();
|
|
31
|
+
}
|
|
32
|
+
if (typeof date === 'number' || typeof date === 'string') {
|
|
33
|
+
return new Date(date);
|
|
34
|
+
}
|
|
35
|
+
if (typeof date === 'object' && '$date' in date) {
|
|
36
|
+
return new Date(date.$date);
|
|
37
|
+
}
|
|
38
|
+
return new Date();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Extracts code blocks from HTML resolution
|
|
42
|
+
*/
|
|
43
|
+
export function extractCodeBlocks(htmlResolution) {
|
|
44
|
+
const codeBlocks = htmlResolution.match(/<pre[^>]*><code[^>]*>(.*?)<\/code><\/pre>/gs) || [];
|
|
45
|
+
return codeBlocks.map((block) => {
|
|
46
|
+
return block
|
|
47
|
+
.replace(/<pre[^>]*><code[^>]*>/, '')
|
|
48
|
+
.replace(/<\/code><\/pre>/, '')
|
|
49
|
+
.replace(/</g, '<')
|
|
50
|
+
.replace(/>/g, '>')
|
|
51
|
+
.replace(/"/g, '"')
|
|
52
|
+
.replace(/&/g, '&')
|
|
53
|
+
.trim();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Formats the remediation response as markdown
|
|
58
|
+
*/
|
|
59
|
+
export function formatRemediationResponse(issue, rule = null) {
|
|
60
|
+
// 1. Short summary of the problem
|
|
61
|
+
const summary = rule?.shortDescription ||
|
|
62
|
+
`Accessibility issue detected: ${issue.displayName}`;
|
|
63
|
+
// 2. WCAG reference & severity
|
|
64
|
+
const wcagLevel = issue.WCAGLevel || 'Unknown';
|
|
65
|
+
const severity = issue.severity?.toUpperCase() || 'Unknown';
|
|
66
|
+
const criteria = issue.criteria || 'Unknown';
|
|
67
|
+
const wcagLink = rule?.issueWCAGLink || '';
|
|
68
|
+
// 3. Code-level fix suggestions
|
|
69
|
+
let codeFix = '\n## Code-Level Fix\n\n';
|
|
70
|
+
if (rule) {
|
|
71
|
+
codeFix += rule.shortDescription
|
|
72
|
+
? `**Solution:** ${rule.shortDescription}\n\n`
|
|
73
|
+
: '';
|
|
74
|
+
// Show the current problematic code
|
|
75
|
+
if (issue.HTML) {
|
|
76
|
+
codeFix += '**Current code:**\n```html\n' + issue.HTML + '\n```\n\n';
|
|
77
|
+
}
|
|
78
|
+
// Extract code examples from the HTML resolution if available
|
|
79
|
+
if (rule.issueResolution) {
|
|
80
|
+
const codeBlocks = extractCodeBlocks(rule.issueResolution);
|
|
81
|
+
if (codeBlocks.length > 0) {
|
|
82
|
+
codeBlocks.forEach((cleanCode, index) => {
|
|
83
|
+
codeFix += `**Suggested fix ${index + 1}:**\n\`\`\`html\n${cleanCode}\n\`\`\`\n\n`;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Add suggested fix details if available
|
|
88
|
+
if (rule.suggestedFix && rule.suggestedFix.length > 0) {
|
|
89
|
+
codeFix += '**Quick Fix Suggestions:**\n';
|
|
90
|
+
rule.suggestedFix.forEach((fix, index) => {
|
|
91
|
+
codeFix += `${index + 1}. **${fix.suggestedFixType || 'Fix'}**: `;
|
|
92
|
+
if (fix.suggestedFixKey) {
|
|
93
|
+
codeFix += `Add attribute \`${fix.suggestedFixKey}="${fix.suggestedFixValue}"\`\n`;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
codeFix += `${fix.suggestedFixValue || 'N/A'}\n`;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
codeFix += '\n';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
codeFix += 'No specific rule found for this issue.\n\n';
|
|
104
|
+
}
|
|
105
|
+
// 4. Links back to remediation panel
|
|
106
|
+
const issueDate = extractDate(issue.date ||
|
|
107
|
+
issue.modified);
|
|
108
|
+
const confidence = issue.confidence ?? 0;
|
|
109
|
+
const occurrences = issue.occurrences ?? 0;
|
|
110
|
+
const webpath = issue.webpath || 'N/A';
|
|
111
|
+
const selector = issue.selector || 'N/A';
|
|
112
|
+
const remediationLinks = `
|
|
113
|
+
## 📚 Additional Resources
|
|
114
|
+
|
|
115
|
+
- **WCAG Reference:** ${wcagLink
|
|
116
|
+
? `[${wcagLevel} - ${criteria}](${wcagLink})`
|
|
117
|
+
: `${wcagLevel} - ${criteria}`}
|
|
118
|
+
- **Tutorial:** ${rule?.issueTutorialLink || 'Contact your AccessFlow administrator'}
|
|
119
|
+
- **Issue Location:** ${webpath} (Selector: \`${selector}\`)
|
|
120
|
+
- **AccessFlow Panel:** View full remediation details in your AccessFlow dashboard
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
**Issue ID:** ${issue.displayName} | **Detected:** ${issueDate.toLocaleDateString()} | **Confidence:** ${confidence}%`;
|
|
124
|
+
return `# ${summary}
|
|
125
|
+
|
|
126
|
+
## WCAG Reference & Severity
|
|
127
|
+
|
|
128
|
+
- **Severity:** ${severity}
|
|
129
|
+
- **WCAG Level:** ${wcagLevel}
|
|
130
|
+
- **Criteria:** ${criteria}
|
|
131
|
+
- **Occurrences:** ${occurrences} time(s) on this page
|
|
132
|
+
|
|
133
|
+
${codeFix}
|
|
134
|
+
|
|
135
|
+
${remediationLinks}
|
|
136
|
+
|
|
137
|
+
After fixing the issue, call the tool resolveIssue with issueDisplayName parameter of the issue that was fixed.`;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=remediation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remediation.js","sourceRoot":"","sources":["../../src/utils/remediation.ts"],"names":[],"mappings":"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"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAiB/C,CAAC"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const sanitizeDomain = (domain) => {
|
|
2
|
+
if (!domain)
|
|
3
|
+
return '';
|
|
4
|
+
domain = domain.trim();
|
|
5
|
+
domain = domain.replace(/^https?:\/\//, '');
|
|
6
|
+
domain = domain.replace(/^www\./, '');
|
|
7
|
+
const slashIndex = domain.indexOf('/');
|
|
8
|
+
if (slashIndex !== -1) {
|
|
9
|
+
domain = domain.slice(0, slashIndex);
|
|
10
|
+
}
|
|
11
|
+
domain = domain.replace(/\.+$/, '');
|
|
12
|
+
return domain;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAU,EAAE;IACvD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEvB,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAEvB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAE5C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accessflow-mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "AccessFlow MCP Server for accessibility issue remediation",
|
|
5
|
-
"main": "
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
6
15
|
"bin": {
|
|
7
|
-
"
|
|
16
|
+
"accessflow-mcp-server": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.0.0"
|
|
8
25
|
},
|
|
9
26
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
27
|
+
"dev": "tsx src/index.ts",
|
|
28
|
+
"build": "tsc && rm -rf dist/data && cp -r src/data dist/data 2>/dev/null || true && rm -rf dist/**/__tests__ dist/**/*.test.js dist/**/*.test.d.ts dist/**/*.test.js.map dist/**/*.test.d.ts.map 2>/dev/null || true",
|
|
29
|
+
"start": "node dist/index.js",
|
|
30
|
+
"prepublishOnly": "npm run build",
|
|
31
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"test:coverage": "vitest run --coverage"
|
|
14
35
|
},
|
|
15
36
|
"keywords": [
|
|
16
37
|
"mcp",
|
|
17
38
|
"accessibility",
|
|
18
39
|
"wcag",
|
|
19
|
-
"remediation"
|
|
40
|
+
"remediation",
|
|
41
|
+
"accessflow",
|
|
42
|
+
"mcp-server"
|
|
20
43
|
],
|
|
21
44
|
"author": "AccessFlow",
|
|
22
45
|
"license": "ISC",
|
|
23
|
-
"type": "module",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@modelcontextprotocol/sdk": "^1.15.1"
|
|
26
|
-
},
|
|
27
46
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^24.
|
|
29
|
-
"typescript": "^
|
|
47
|
+
"@types/node": "^24.10.1",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
49
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
50
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
51
|
+
"eslint": "^9.39.1",
|
|
52
|
+
"eslint-config-prettier": "^10.1.8",
|
|
53
|
+
"pino-pretty": "^13.1.2",
|
|
54
|
+
"prettier": "^3.6.2",
|
|
55
|
+
"ts-node": "^10.9.2",
|
|
56
|
+
"tsx": "^4.20.6",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vitest": "^2.1.8"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"dotenv": "^17.2.3",
|
|
62
|
+
"fastmcp": "^3.23.0",
|
|
63
|
+
"pino": "^10.1.0"
|
|
30
64
|
}
|
|
31
65
|
}
|
package/TOOL_REFERENCE.md
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# AccessFlow MCP Tools
|
|
2
|
-
|
|
3
|
-
Quick reference for MCP clien## Tool: `getMostUrgentIssues`
|
|
4
|
-
|
|
5
|
-
Get the 10 most critical accessibility issues prioritized by severity, then by site occurrences, then by page occurrences for the configured website.
|
|
6
|
-
|
|
7
|
-
**Parameters:** None (uses configured WEBSITE_ID)
|
|
8
|
-
|
|
9
|
-
**Prioritization Logic:**
|
|
10
|
-
|
|
11
|
-
1. **Primary**: Severity (EXTREME > HIGH > MEDIUM > LOW)
|
|
12
|
-
2. **Secondary**: Site occurrences (how many locations on the site)
|
|
13
|
-
3. **Tertiary**: Page occurrences (how many times on the current page)
|
|
14
|
-
|
|
15
|
-
**Example:**
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"tool": "getMostUrgentIssues",
|
|
20
|
-
"arguments": {}
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Returns:** Prioritized list with issue IDs, severity levels, occurrence counts, and locations for the configured website.accessibility tools.
|
|
25
|
-
|
|
26
|
-
## Configuration
|
|
27
|
-
|
|
28
|
-
The MCP server requires these environment variables:
|
|
29
|
-
|
|
30
|
-
- `MONGO_URI`: MongoDB connection string
|
|
31
|
-
- `WEBSITE_ID`: The website ID to filter accessibility issues for
|
|
32
|
-
|
|
33
|
-
Example MCP configuration:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"mcp": {
|
|
38
|
-
"servers": {
|
|
39
|
-
"flow-mcp": {
|
|
40
|
-
"command": "node",
|
|
41
|
-
"args": ["/path/to/flow-mcp/build/index.js"],
|
|
42
|
-
"env": {
|
|
43
|
-
"MONGO_URI": "mongodb://localhost:27017/accessflow",
|
|
44
|
-
"WEBSITE_ID": "68790033a1951a20af80f22b"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Tool: `getIssueRemediation`
|
|
53
|
-
|
|
54
|
-
Get detailed fix guidance for a specific accessibility issue from the configured website.
|
|
55
|
-
|
|
56
|
-
**Parameters:**
|
|
57
|
-
|
|
58
|
-
- `issueDisplayName` (string, required): Issue ID from AccessFlow
|
|
59
|
-
|
|
60
|
-
**Example:**
|
|
61
|
-
|
|
62
|
-
```json
|
|
63
|
-
{
|
|
64
|
-
"tool": "getIssueRemediation",
|
|
65
|
-
"arguments": {
|
|
66
|
-
"issueDisplayName": "Untagged-Headings-276b188870"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Returns:** Remediation guide with WCAG references, code examples, and fix instructions. Returns an error if the issue doesn't belong to the configured website.
|
|
72
|
-
|
|
73
|
-
## Tool: `getMostUrgentIssues`
|
|
74
|
-
|
|
75
|
-
Get the 10 most critical accessibility issues prioritized by severity.
|
|
76
|
-
|
|
77
|
-
**Parameters:**
|
|
78
|
-
|
|
79
|
-
- `website_id` (string, required): The website ID to get issues for. Only issues from this specific website will be returned.
|
|
80
|
-
|
|
81
|
-
**Example:**
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"tool": "getMostUrgentIssues",
|
|
86
|
-
"arguments": {
|
|
87
|
-
"website_id": "68790033a1951a20af80f22b"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**Returns:** Prioritized list with issue IDs, severity levels, and locations.
|
|
93
|
-
|
|
94
|
-
## Workflow
|
|
95
|
-
|
|
96
|
-
1. **Get priorities:** `getMostUrgentIssues` → See which issues need attention first (filtered to configured website)
|
|
97
|
-
2. **Get fix details:** `getIssueRemediation` with specific issue IDs → Get step-by-step remediation
|
|
98
|
-
3. **Fix in order:** Start with EXTREME severity, then HIGH → MEDIUM → LOW
|
|
99
|
-
|
|
100
|
-
## Getting Website ID
|
|
101
|
-
|
|
102
|
-
You can find your website ID using the flow-db-mcp tool:
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"tool": "readDocuments",
|
|
107
|
-
"arguments": {
|
|
108
|
-
"collectionName": "websites",
|
|
109
|
-
"projection": { "_id": 1, "domain": 1, "name": 1 }
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Severity Levels
|
|
115
|
-
|
|
116
|
-
- 🔴 **EXTREME** - Critical accessibility barriers
|
|
117
|
-
- 🟠 **HIGH** - Significant usability issues
|
|
118
|
-
- 🟡 **MEDIUM** - Moderate accessibility concerns
|
|
119
|
-
- 🟢 **LOW** - Minor improvements needed
|
|
120
|
-
|
|
121
|
-
## Error Handling
|
|
122
|
-
|
|
123
|
-
- Invalid issue ID → Returns "Issue Not Found" message
|
|
124
|
-
- Website ID mismatch → Returns "Website Mismatch Error" message
|
|
125
|
-
- Database connection issues → Returns connection error
|
|
126
|
-
- Missing parameters → Returns parameter validation error
|
package/assets/MCP_banner.png
DELETED
|
Binary file
|
package/bin/flow-mcp
DELETED
package/build/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export declare class AccessFlowMCPServer {
|
|
3
|
-
private server;
|
|
4
|
-
private environment;
|
|
5
|
-
private domain;
|
|
6
|
-
private apiKey;
|
|
7
|
-
private rules;
|
|
8
|
-
constructor();
|
|
9
|
-
private setupToolHandlers;
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAeA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAoB;;IAmCjC,OAAO,CAAC,iBAAiB;IAiDnB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB3B"}
|
package/build/index.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
import rulesData from "./rules.json" with { type: "json" };
|
|
6
|
-
import { getToolDefinitions, getToolHandler } from "./tools/index.js";
|
|
7
|
-
import { sanitizeDomain } from "./utils/domain.js";
|
|
8
|
-
export class AccessFlowMCPServer {
|
|
9
|
-
server;
|
|
10
|
-
environment;
|
|
11
|
-
domain;
|
|
12
|
-
apiKey;
|
|
13
|
-
rules = rulesData;
|
|
14
|
-
constructor() {
|
|
15
|
-
this.server = new Server({
|
|
16
|
-
name: "flow-mcp",
|
|
17
|
-
version: "1.0.0",
|
|
18
|
-
}, {
|
|
19
|
-
capabilities: {
|
|
20
|
-
tools: {},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
this.environment = process.env.ENVIRONMENT || "https://accessflow.accessibe.com";
|
|
24
|
-
// Get DOMAIN Key from environment variable
|
|
25
|
-
this.domain = sanitizeDomain(process.env.DOMAIN || "");
|
|
26
|
-
if (!this.domain) {
|
|
27
|
-
console.error("DOMAIN environment variable is required");
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
// Get API Key from environment variable
|
|
31
|
-
this.apiKey = process.env.API_KEY || "";
|
|
32
|
-
if (!this.apiKey) {
|
|
33
|
-
console.error("API_KEY environment variable is required");
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
this.setupToolHandlers();
|
|
37
|
-
}
|
|
38
|
-
setupToolHandlers() {
|
|
39
|
-
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
40
|
-
return {
|
|
41
|
-
tools: getToolDefinitions(),
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
45
|
-
const { name, arguments: args } = request.params;
|
|
46
|
-
try {
|
|
47
|
-
const handler = getToolHandler(name);
|
|
48
|
-
if (!handler) {
|
|
49
|
-
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
50
|
-
}
|
|
51
|
-
const headers = {
|
|
52
|
-
"x-api-key": this.apiKey,
|
|
53
|
-
"x-accessflow-domain": this.domain,
|
|
54
|
-
"Content-Type": "application/json",
|
|
55
|
-
};
|
|
56
|
-
if (this.environment.toLowerCase().includes("test")) {
|
|
57
|
-
const basicAuth = Buffer.from("test:acsb123").toString("base64");
|
|
58
|
-
headers["Authorization"] = `Basic ${basicAuth}`;
|
|
59
|
-
}
|
|
60
|
-
const context = {
|
|
61
|
-
rules: this.rules,
|
|
62
|
-
environment: this.environment,
|
|
63
|
-
apiKey: this.apiKey,
|
|
64
|
-
headers: headers,
|
|
65
|
-
};
|
|
66
|
-
return await handler(args || {}, context);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
if (error instanceof McpError) {
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
73
|
-
throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
async run() {
|
|
78
|
-
const transport = new StdioServerTransport();
|
|
79
|
-
await this.server.connect(transport);
|
|
80
|
-
console.error("AccessFlow MCP Server running on stdio");
|
|
81
|
-
// Handle graceful shutdown
|
|
82
|
-
process.on("SIGINT", async () => {
|
|
83
|
-
console.error("Shutting down AccessFlow MCP Server...");
|
|
84
|
-
process.exit(0);
|
|
85
|
-
});
|
|
86
|
-
process.on("SIGTERM", async () => {
|
|
87
|
-
console.error("Shutting down AccessFlow MCP Server...");
|
|
88
|
-
process.exit(0);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Start the server
|
|
93
|
-
const server = new AccessFlowMCPServer();
|
|
94
|
-
server.run().catch(console.error);
|
|
95
|
-
//# sourceMappingURL=index.js.map
|