@verifik/mcp 0.1.2 → 0.1.3
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/README.md +152 -37
- package/data/catalog-snapshot.json +7677 -0
- package/docs/endpoints.md +626 -0
- package/lib/config.js +1 -1
- package/lib/filters.js +105 -2
- package/lib/meta-tools.js +4 -3
- package/package.json +3 -2
package/lib/filters.js
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/** Canonical catalog country names (as stored on AppFeature.country). */
|
|
4
|
+
const CATALOG_COUNTRY_NAMES = [
|
|
5
|
+
"Argentina",
|
|
6
|
+
"Bolivia",
|
|
7
|
+
"Brazil",
|
|
8
|
+
"Canada",
|
|
9
|
+
"Chile",
|
|
10
|
+
"Colombia",
|
|
11
|
+
"Costa Rica",
|
|
12
|
+
"Ecuador",
|
|
13
|
+
"El Salvador",
|
|
14
|
+
"Guatemala",
|
|
15
|
+
"Honduras",
|
|
16
|
+
"India",
|
|
17
|
+
"Mexico",
|
|
18
|
+
"Panama",
|
|
19
|
+
"Paraguay",
|
|
20
|
+
"Peru",
|
|
21
|
+
"República Dominicana",
|
|
22
|
+
"Spain",
|
|
23
|
+
"United States",
|
|
24
|
+
"Uruguay",
|
|
25
|
+
"Venezuela",
|
|
26
|
+
"world",
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/** ISO 3166-1 alpha-2 codes accepted as aliases for catalog country names. */
|
|
30
|
+
const COUNTRY_ISO_ALIASES = {
|
|
31
|
+
AR: "Argentina",
|
|
32
|
+
BO: "Bolivia",
|
|
33
|
+
BR: "Brazil",
|
|
34
|
+
CA: "Canada",
|
|
35
|
+
CL: "Chile",
|
|
36
|
+
CO: "Colombia",
|
|
37
|
+
CR: "Costa Rica",
|
|
38
|
+
DO: "República Dominicana",
|
|
39
|
+
EC: "Ecuador",
|
|
40
|
+
ES: "Spain",
|
|
41
|
+
GT: "Guatemala",
|
|
42
|
+
HN: "Honduras",
|
|
43
|
+
IN: "India",
|
|
44
|
+
MX: "Mexico",
|
|
45
|
+
PA: "Panama",
|
|
46
|
+
PE: "Peru",
|
|
47
|
+
PY: "Paraguay",
|
|
48
|
+
SV: "El Salvador",
|
|
49
|
+
US: "United States",
|
|
50
|
+
UY: "Uruguay",
|
|
51
|
+
VE: "Venezuela",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Normalize a country label for case- and accent-insensitive comparison.
|
|
56
|
+
* @param {string} value
|
|
57
|
+
*/
|
|
58
|
+
const normalizeCountryKey = (value) =>
|
|
59
|
+
String(value || "")
|
|
60
|
+
.normalize("NFD")
|
|
61
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
62
|
+
.toLowerCase()
|
|
63
|
+
.trim();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Resolve one filter token (catalog name or ISO code) to a normalized country key.
|
|
67
|
+
* @param {string} filterValue
|
|
68
|
+
*/
|
|
69
|
+
const resolveFilterCountryKey = (filterValue) => {
|
|
70
|
+
const trimmed = String(filterValue || "").trim();
|
|
71
|
+
if (!trimmed) return null;
|
|
72
|
+
|
|
73
|
+
const upper = trimmed.toUpperCase();
|
|
74
|
+
if (upper === "WORLD") return "world";
|
|
75
|
+
|
|
76
|
+
const isoAlias = COUNTRY_ISO_ALIASES[upper];
|
|
77
|
+
if (isoAlias) return normalizeCountryKey(isoAlias);
|
|
78
|
+
|
|
79
|
+
return normalizeCountryKey(trimmed);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} featureCountry
|
|
84
|
+
* @param {string[]} countryFilter
|
|
85
|
+
*/
|
|
86
|
+
const matchesCountryFilter = (featureCountry, countryFilter) => {
|
|
87
|
+
if (!countryFilter.length) return true;
|
|
88
|
+
|
|
89
|
+
const featureKey = normalizeCountryKey(featureCountry);
|
|
90
|
+
return countryFilter.some((filter) => resolveFilterCountryKey(filter) === featureKey);
|
|
91
|
+
};
|
|
92
|
+
|
|
3
93
|
/**
|
|
4
94
|
* @param {import("./types").AppFeature} feature
|
|
5
95
|
* @param {import("./types").McpConfig} config
|
|
@@ -7,12 +97,20 @@
|
|
|
7
97
|
*/
|
|
8
98
|
const isEligibleFeature = (feature, config, grantedFeatureCodes = null) => {
|
|
9
99
|
if (!feature?.code || !feature?.url) return false;
|
|
100
|
+
if (feature.legacy) return false;
|
|
10
101
|
if (config.smartCheckOnly && !feature.smartCheckEnabled) return false;
|
|
11
102
|
if (config.codeAllowlist.length && !config.codeAllowlist.includes(feature.code)) return false;
|
|
12
|
-
if (
|
|
103
|
+
if (!matchesCountryFilter(feature.country, config.countryFilter)) return false;
|
|
13
104
|
if (config.baseCategoryFilter.length && !config.baseCategoryFilter.includes(feature.baseCategory)) return false;
|
|
14
105
|
|
|
15
|
-
if (feature.
|
|
106
|
+
if (feature.clientHasAccess === false) return false;
|
|
107
|
+
|
|
108
|
+
if (
|
|
109
|
+
feature.clientHasAccess !== true &&
|
|
110
|
+
feature.requiresClientFeature &&
|
|
111
|
+
grantedFeatureCodes &&
|
|
112
|
+
!grantedFeatureCodes.has(feature.code)
|
|
113
|
+
) {
|
|
16
114
|
return false;
|
|
17
115
|
}
|
|
18
116
|
|
|
@@ -47,6 +145,11 @@ const toFeatureSummary = (feature) => ({
|
|
|
47
145
|
});
|
|
48
146
|
|
|
49
147
|
module.exports = {
|
|
148
|
+
CATALOG_COUNTRY_NAMES,
|
|
149
|
+
COUNTRY_ISO_ALIASES,
|
|
150
|
+
normalizeCountryKey,
|
|
151
|
+
resolveFilterCountryKey,
|
|
152
|
+
matchesCountryFilter,
|
|
50
153
|
isEligibleFeature,
|
|
51
154
|
filterFeatures,
|
|
52
155
|
toFeatureSummary,
|
package/lib/meta-tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { toFeatureSummary } = require("./filters");
|
|
3
|
+
const { toFeatureSummary, matchesCountryFilter } = require("./filters");
|
|
4
4
|
const { buildInputSchema } = require("./tool-schema");
|
|
5
5
|
|
|
6
6
|
const LIST_CATALOG_TOOL = "verifik_list_catalog";
|
|
@@ -16,7 +16,8 @@ const META_TOOL_DEFINITIONS = [
|
|
|
16
16
|
properties: {
|
|
17
17
|
country: {
|
|
18
18
|
type: "string",
|
|
19
|
-
description:
|
|
19
|
+
description:
|
|
20
|
+
"Optional comma-separated country filter. Accepts catalog country names (e.g. Colombia), ISO codes (e.g. CO), or world. Matching is case- and accent-insensitive.",
|
|
20
21
|
},
|
|
21
22
|
baseCategory: {
|
|
22
23
|
type: "string",
|
|
@@ -67,7 +68,7 @@ const handleListCatalog = async (catalogCache, args = {}) => {
|
|
|
67
68
|
|
|
68
69
|
const features = state.features.filter((feature) => {
|
|
69
70
|
if (smartCheckOnly === true && !feature.smartCheckEnabled) return false;
|
|
70
|
-
if (
|
|
71
|
+
if (!matchesCountryFilter(feature.country, countryFilter)) return false;
|
|
71
72
|
if (baseCategoryFilter.length && !baseCategoryFilter.includes(feature.baseCategory)) return false;
|
|
72
73
|
if (codeFilter.length && !codeFilter.includes(feature.code)) return false;
|
|
73
74
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verifik/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Use Verifik identity verification, document checks, and background-screening APIs from Cursor, Claude Desktop, or any MCP client — across Latin America and worldwide.",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"start": "node server.js",
|
|
18
18
|
"test": "node --test tests/*.test.js",
|
|
19
|
-
"test:sandbox": "node --test tests/*.test.js"
|
|
19
|
+
"test:sandbox": "node --test tests/*.test.js",
|
|
20
|
+
"generate:endpoints-doc": "node scripts/generate-endpoints-doc.mjs"
|
|
20
21
|
},
|
|
21
22
|
"engines": {
|
|
22
23
|
"node": ">=18"
|