@cyanheads/sanctions-screening-mcp-server 0.1.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.
Files changed (110) hide show
  1. package/AGENTS.md +452 -0
  2. package/CLAUDE.md +452 -0
  3. package/Dockerfile +126 -0
  4. package/LICENSE +201 -0
  5. package/README.md +354 -0
  6. package/changelog/0.1.x/0.1.0.md +26 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +37 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +87 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +11 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +70 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/index.d.ts +12 -0
  17. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/index.js +9 -0
  19. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  20. package/dist/mcp-server/prompts/definitions/vet-counterparty.prompt.d.ts +14 -0
  21. package/dist/mcp-server/prompts/definitions/vet-counterparty.prompt.d.ts.map +1 -0
  22. package/dist/mcp-server/prompts/definitions/vet-counterparty.prompt.js +42 -0
  23. package/dist/mcp-server/prompts/definitions/vet-counterparty.prompt.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/designation.resource.d.ts +25 -0
  25. package/dist/mcp-server/resources/definitions/designation.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/designation.resource.js +57 -0
  27. package/dist/mcp-server/resources/definitions/designation.resource.js.map +1 -0
  28. package/dist/mcp-server/resources/definitions/entity.resource.d.ts +17 -0
  29. package/dist/mcp-server/resources/definitions/entity.resource.d.ts.map +1 -0
  30. package/dist/mcp-server/resources/definitions/entity.resource.js +40 -0
  31. package/dist/mcp-server/resources/definitions/entity.resource.js.map +1 -0
  32. package/dist/mcp-server/resources/definitions/index.d.ts +32 -0
  33. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  34. package/dist/mcp-server/resources/definitions/index.js +11 -0
  35. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  36. package/dist/mcp-server/resources/definitions/sources.resource.d.ts +9 -0
  37. package/dist/mcp-server/resources/definitions/sources.resource.d.ts.map +1 -0
  38. package/dist/mcp-server/resources/definitions/sources.resource.js +50 -0
  39. package/dist/mcp-server/resources/definitions/sources.resource.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/_shared.d.ts +13 -0
  41. package/dist/mcp-server/tools/definitions/_shared.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/_shared.js +13 -0
  43. package/dist/mcp-server/tools/definitions/_shared.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/get-designation.tool.d.ts +78 -0
  45. package/dist/mcp-server/tools/definitions/get-designation.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/get-designation.tool.js +168 -0
  47. package/dist/mcp-server/tools/definitions/get-designation.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts +55 -0
  49. package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/get-entity.tool.js +176 -0
  51. package/dist/mcp-server/tools/definitions/get-entity.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/index.d.ts +306 -0
  53. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/index.js +21 -0
  55. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/list-sources.tool.d.ts +23 -0
  57. package/dist/mcp-server/tools/definitions/list-sources.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/list-sources.tool.js +106 -0
  59. package/dist/mcp-server/tools/definitions/list-sources.tool.js.map +1 -0
  60. package/dist/mcp-server/tools/definitions/resolve-entity.tool.d.ts +51 -0
  61. package/dist/mcp-server/tools/definitions/resolve-entity.tool.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/definitions/resolve-entity.tool.js +148 -0
  63. package/dist/mcp-server/tools/definitions/resolve-entity.tool.js.map +1 -0
  64. package/dist/mcp-server/tools/definitions/screen-name.tool.d.ts +82 -0
  65. package/dist/mcp-server/tools/definitions/screen-name.tool.d.ts.map +1 -0
  66. package/dist/mcp-server/tools/definitions/screen-name.tool.js +172 -0
  67. package/dist/mcp-server/tools/definitions/screen-name.tool.js.map +1 -0
  68. package/dist/mcp-server/tools/definitions/trace-ownership.tool.d.ts +74 -0
  69. package/dist/mcp-server/tools/definitions/trace-ownership.tool.d.ts.map +1 -0
  70. package/dist/mcp-server/tools/definitions/trace-ownership.tool.js +273 -0
  71. package/dist/mcp-server/tools/definitions/trace-ownership.tool.js.map +1 -0
  72. package/dist/services/screening/fixtures.d.ts +17 -0
  73. package/dist/services/screening/fixtures.d.ts.map +1 -0
  74. package/dist/services/screening/fixtures.js +162 -0
  75. package/dist/services/screening/fixtures.js.map +1 -0
  76. package/dist/services/screening/gleif-ingest.d.ts +68 -0
  77. package/dist/services/screening/gleif-ingest.d.ts.map +1 -0
  78. package/dist/services/screening/gleif-ingest.js +251 -0
  79. package/dist/services/screening/gleif-ingest.js.map +1 -0
  80. package/dist/services/screening/sanctions-ingest.d.ts +46 -0
  81. package/dist/services/screening/sanctions-ingest.d.ts.map +1 -0
  82. package/dist/services/screening/sanctions-ingest.js +688 -0
  83. package/dist/services/screening/sanctions-ingest.js.map +1 -0
  84. package/dist/services/screening/schema.d.ts +52 -0
  85. package/dist/services/screening/schema.d.ts.map +1 -0
  86. package/dist/services/screening/schema.js +125 -0
  87. package/dist/services/screening/schema.js.map +1 -0
  88. package/dist/services/screening/screening-service.d.ts +203 -0
  89. package/dist/services/screening/screening-service.d.ts.map +1 -0
  90. package/dist/services/screening/screening-service.js +702 -0
  91. package/dist/services/screening/screening-service.js.map +1 -0
  92. package/dist/services/screening/text-matching.d.ts +53 -0
  93. package/dist/services/screening/text-matching.d.ts.map +1 -0
  94. package/dist/services/screening/text-matching.js +514 -0
  95. package/dist/services/screening/text-matching.js.map +1 -0
  96. package/dist/services/screening/types.d.ts +154 -0
  97. package/dist/services/screening/types.d.ts.map +1 -0
  98. package/dist/services/screening/types.js +24 -0
  99. package/dist/services/screening/types.js.map +1 -0
  100. package/dist/services/screening/xml.d.ts +29 -0
  101. package/dist/services/screening/xml.d.ts.map +1 -0
  102. package/dist/services/screening/xml.js +46 -0
  103. package/dist/services/screening/xml.js.map +1 -0
  104. package/package.json +119 -0
  105. package/scripts/_mirror-context.ts +21 -0
  106. package/scripts/mirror-init.ts +66 -0
  107. package/scripts/mirror-refresh.ts +56 -0
  108. package/scripts/mirror-seed.ts +36 -0
  109. package/scripts/mirror-verify.ts +44 -0
  110. package/server.json +148 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,354 @@
1
+ <div align="center">
2
+ <h1>sanctions-screening-mcp-server</h1>
3
+ <p><b>Screen names against the consolidated OFAC, EU, UK, and UN sanctions lists and resolve legal entities against GLEIF, fuzzy-matched offline over a local SQLite + FTS5 mirror. A screening aid, not a compliance determination.</b>
4
+ <div>6 Tools • 3 Resources • 1 Prompt</div>
5
+ </p>
6
+ </div>
7
+
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
+
12
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ > [!IMPORTANT]
19
+ > **This is a screening aid, not legal or compliance certification.** Every tool returns *potential matches* with a transparent score and source provenance — never a verdict. A hit means "review this candidate against the official source"; an empty result never means "cleared." Real sanctions compliance is a legal process — it requires human review and a qualified compliance determination. This server feeds that process; it does not perform it, and its output is not a compliance record.
20
+
21
+ ## Overview
22
+
23
+ `sanctions-screening-mcp-server` turns the world's open sanctions data plus the global legal-entity registry into one screening-and-resolution workflow, answered offline and fuzzy-matched. It screens a name against the consolidated US (OFAC), EU, UK, and UN sanctions lists at once, and resolves legal entities against the GLEIF Legal Entity Identifier (LEI) database with corporate-ownership tracing.
24
+
25
+ All sources are bulk-downloadable, keyless, and clear for redistribution. The server mirrors them to a local SQLite + FTS5 index and serves matches from that mirror — no live API key, no per-request rate limit on the hot path. The agent sees screening verbs (`screen_name`, `resolve_entity`, `trace_ownership`); which list answered a query surfaces only as provenance on each hit.
26
+
27
+ The matching model is transparent by design: strict token matching first (exact-normalized, then all-tokens-present via FTS5), with a scored Jaro-Winkler + phonetic fuzzy fallback. Approximate hits carry the **raw Jaro-Winkler similarity (0–1)** — a real measurement, never a fabricated "confidence percentage."
28
+
29
+ ## Tools
30
+
31
+ Six tools organized around two workflows — screen a name against the watchlists, and resolve a legal entity to its global identifier and ownership graph:
32
+
33
+ | Tool | Description |
34
+ |:---|:---|
35
+ | `sanctions_screen_name` | Screen a name (person, company, vessel, aircraft) against all loaded watchlists at once — OFAC SDN + Consolidated, EU, UK, UN — alias- and fuzzy-aware. Returns scored potential matches with source list, program, designation date, and the matched alias. |
36
+ | `sanctions_get_designation` | Fetch the full record for one sanctions designation by source list + entry ID: all aliases, identifiers, addresses, dates/places of birth, nationalities, program, legal basis, and designation date. |
37
+ | `sanctions_resolve_entity` | Resolve a company / organization name (+ optional jurisdiction) to ranked candidate GLEIF LEIs. Turns a free-text counterparty name into a stable global identifier. |
38
+ | `sanctions_get_entity` | Fetch the full GLEIF Level 1 record for one LEI — legal name, trading names, addresses, registration status, jurisdiction — plus a sanctions cross-reference screened on the legal name. |
39
+ | `sanctions_trace_ownership` | Trace the GLEIF Level 2 corporate-ownership graph for an LEI (parents and/or children, BFS to a bounded depth), optionally screening every node for beneficial-ownership screening. |
40
+ | `sanctions_list_sources` | List the loaded watchlists and GLEIF datasets with record counts, source URLs, licenses, and the mirror's readiness and as-of timestamps. |
41
+
42
+ ### `sanctions_screen_name`
43
+
44
+ The 80% entry point — "is this entity on a watchlist?"
45
+
46
+ - Fans out across all four sanctions lists (OFAC SDN + Consolidated, EU, UK, UN) in one call; the source surfaces only as provenance per hit
47
+ - Alias-aware: matches against every published primary name, a.k.a., and f.k.a., not just the canonical name
48
+ - Strict mode (default): exact-normalized equality, then all-tokens-present via FTS5 — handles word-order swaps and missing interior words with no fuzzy library
49
+ - Fuzzy mode (opt-in, or automatic when strict finds nothing): adds Jaro-Winkler similarity and Double-Metaphone phonetic matching for transliteration-class misses
50
+ - Hits labeled `exact` / `strong` / `approximate`; approximate hits carry the raw Jaro-Winkler score (0–1)
51
+ - Filter by entity type, source list subset, similarity floor (`min_score`), and result limit
52
+ - On an empty result, returns guidance on how to broaden — and states explicitly that no match is **not** a clearance
53
+
54
+ ---
55
+
56
+ ### `sanctions_get_designation`
57
+
58
+ The drill-in after `sanctions_screen_name` surfaces a candidate.
59
+
60
+ - Full normalized record by `source` + `entry_id` (the `sourceEntryId` from a screen hit)
61
+ - All published aliases, structured identifiers (passport / national ID / tax / registration), addresses, dates and places of birth, nationalities, sanctioning program, legal basis, and designation date
62
+ - Preserves source sparsity — missing fields mean the source omitted them; the record is never padded with fabricated data
63
+
64
+ ---
65
+
66
+ ### `sanctions_resolve_entity`
67
+
68
+ The bridge from a free-text counterparty name to a stable LEI that the entity tools key off.
69
+
70
+ - Resolves a company / organization name to ranked GLEIF LEI candidates
71
+ - Optional ISO 3166-1 alpha-2 jurisdiction filter and registration-status filter (`issued` default, `lapsed`, or `any`)
72
+ - Same strict-then-fuzzy matching model as name screening; approximate hits carry the raw Jaro-Winkler score
73
+ - Matches against legal names and published other/trading names
74
+
75
+ ---
76
+
77
+ ### `sanctions_get_entity`
78
+
79
+ Who is this legal entity — plus a watchlist cross-reference in the same call.
80
+
81
+ - Full GLEIF Level 1 record: legal name, other/trading names, legal and headquarters addresses, registration status, jurisdiction, registration authority and ID, last-update date
82
+ - Cross-references the entity's legal name against all loaded watchlists (strict match only — auto-fuzzy on a generic legal name would flood the result with single-common-token false positives)
83
+ - LEI input is regex-validated (20 chars: 18 alphanumerics + 2 check digits)
84
+
85
+ ---
86
+
87
+ ### `sanctions_trace_ownership`
88
+
89
+ Beneficial-ownership screening — the cross-source workflow that single-list tools can't do.
90
+
91
+ - Traverses the GLEIF Level 2 ownership graph breadth-first to a bounded depth (1–5)
92
+ - `direction`: walk `parents` (who owns it), `children` (what it owns), or `both`
93
+ - Returns nodes (with role and depth) and directed ownership edges with relationship type
94
+ - `screen_nodes: true` screens every entity in the graph against all watchlists — "is anyone in this ownership chain sanctioned?"
95
+ - Per-node screen is strict-only and reports `screenedNodeCount` / `flaggedNodeCount` so a caller can see coverage at a glance
96
+
97
+ ---
98
+
99
+ ## Resources and prompts
100
+
101
+ | Type | Name | Description |
102
+ |:---|:---|:---|
103
+ | Resource | `sanctions://designation/{source}/{entryId}` | One sanctions designation by source + entry ID (URI mirror of `sanctions_get_designation`). |
104
+ | Resource | `sanctions://entity/{lei}` | One GLEIF Level 1 entity by LEI (URI mirror of `sanctions_get_entity`'s entity payload, without the screening cross-reference). |
105
+ | Resource | `sanctions://sources` | Loaded lists + GLEIF datasets with counts and refresh timestamps (URI mirror of `sanctions_list_sources`). |
106
+ | Prompt | `sanctions_vet_counterparty` | Sequences the tools into a full counterparty due-diligence pass: resolve → trace ownership → screen the entity and every beneficial owner → summarize with provenance and the decision-support caveat. |
107
+
108
+ All resource data is also reachable via the tools, which are the primary path for tool-only MCP clients. The resources are a convenience for resource-capable clients only.
109
+
110
+ ## Source lists
111
+
112
+ The server aggregates five upstream sources behind the screening surface. All are bulk, keyless, and clear for redistribution.
113
+
114
+ | Source | Role | License |
115
+ |:---|:---|:---|
116
+ | **OFAC SDN + Consolidated** (US Treasury) | Primary US sanctions/watchlist — individuals, entities, vessels, aircraft, with a.k.a. aliases | US Government public domain |
117
+ | **EU Consolidated Financial Sanctions List** | EU-designated persons and entities | Freely redistributable |
118
+ | **UK Sanctions List (UKSL, FCDO)** | UK sanctions targets — persons, entities, ships | Open Government Licence v3.0 |
119
+ | **UN Security Council Consolidated List** | UN-designated individuals and entities across all regimes | Freely redistributable |
120
+ | **GLEIF LEI (Level 1 + Level 2)** | Who-is-who (entity reference) and who-owns-whom (corporate ownership) | CC0 1.0 Universal |
121
+
122
+ The UK source is the **UK Sanctions List (UKSL)**, the single authoritative UK source since the OFSI Consolidated List closed on 28 January 2026.
123
+
124
+ ### First run: populate the mirror
125
+
126
+ The mirror is **not bundled** — the sanctions lists and the GLEIF golden copy are downloaded and normalized on first run. Run the init lifecycle script out-of-band before screening:
127
+
128
+ ```sh
129
+ bun run mirror:init
130
+ ```
131
+
132
+ This harvests all four sanctions lists in full, rebuilds the per-alias name index, then streams the GLEIF golden copy (Level 1 entities + Level 2 ownership relationships). It is resumable and intended to run once, off the request path.
133
+
134
+ | Script | Purpose |
135
+ |:---|:---|
136
+ | `bun run mirror:init` | Full initial load of all sources (sanctions lists + GLEIF golden copy). |
137
+ | `bun run mirror:refresh` | Re-harvest the sanctions lists and apply GLEIF deltas. Also runs on a cron under HTTP transport. |
138
+ | `bun run mirror:verify` | Report mirror readiness and per-source record counts. |
139
+ | `bun run mirror:seed` | Load a small synthetic fixture for local smoke tests (no downloads). |
140
+
141
+ Set `SANCTIONS_INIT_SKIP_GLEIF=1` on `mirror:init` to load only the (small) sanctions lists and skip GLEIF.
142
+
143
+ > **GLEIF memory note:** the GLEIF Level 1 ingest is the memory-heavy leg — the full golden copy is roughly 3.3M LEI records (~490 MB compressed) and ~890 MB of resident memory during the streaming ingest. The four sanctions lists and the GLEIF deltas / Level 2 ownership data are light by comparison. Size the host accordingly for `mirror:init`, or skip GLEIF with `SANCTIONS_INIT_SKIP_GLEIF=1` if you only need watchlist screening.
144
+
145
+ ## Features
146
+
147
+ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
148
+
149
+ - Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
150
+ - Unified error handling — handlers throw, framework catches, classifies, and formats
151
+ - Typed error contracts with recovery hints (`mirror_not_ready`, `designation_not_found`, `lei_not_found`)
152
+ - Pluggable auth: `none`, `jwt`, `oauth` (defaults to `none` — all data is public)
153
+ - Structured logging with optional OpenTelemetry tracing
154
+ - STDIO and Streamable HTTP transports
155
+
156
+ Sanctions-specific:
157
+
158
+ - Multi-source, workflow-organized surface — one screen fans out across OFAC, EU, UK, and UN internally; sources surface only as provenance
159
+ - Local SQLite + FTS5 mirror via the framework `MirrorService` — offline, no live API key, no per-request rate limit
160
+ - Normalized common schema across the four sanctions lists, with a denormalized per-alias name index (one row per name and per alias) so a query matches any of an entity's names in one FTS scan
161
+ - Strict-then-fuzzy matching: exact-normalized → all-tokens-present (FTS5) → Jaro-Winkler + Double-Metaphone, capped to bound work on short queries
162
+ - GLEIF Level 1 + Level 2 ingest for entity resolution and beneficial-ownership tracing
163
+
164
+ Agent-friendly output:
165
+
166
+ - Real signal, not synthetic confidence — approximate hits carry the raw Jaro-Winkler similarity (0–1); strict hits carry a `match_type` (`exact` / `strong`), never a fabricated percentage
167
+ - Provenance on every hit — source list, sanctioning program, designation date, the exact name/alias that matched, and its type (`primary` / `aka` / `fka` / `low-quality-aka`)
168
+ - Decision-support caveat carried in every screening tool's output — a hit is a candidate to verify, an empty result is not a clearance
169
+ - Freshness surfaced via `sanctions_list_sources` — each source's record count and the mirror's as-of timestamp, so an agent can judge staleness
170
+
171
+ ## Getting started
172
+
173
+ Add the following to your MCP client configuration file. The server is offline-first — populate the mirror with `bun run mirror:init` before screening (see [Source lists](#source-lists)).
174
+
175
+ ```json
176
+ {
177
+ "mcpServers": {
178
+ "sanctions-screening-mcp-server": {
179
+ "type": "stdio",
180
+ "command": "bunx",
181
+ "args": ["@cyanheads/sanctions-screening-mcp-server@latest"],
182
+ "env": {
183
+ "MCP_TRANSPORT_TYPE": "stdio",
184
+ "MCP_LOG_LEVEL": "info"
185
+ }
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ Or with npx (no Bun required):
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "sanctions-screening-mcp-server": {
197
+ "type": "stdio",
198
+ "command": "npx",
199
+ "args": ["-y", "@cyanheads/sanctions-screening-mcp-server@latest"],
200
+ "env": {
201
+ "MCP_TRANSPORT_TYPE": "stdio",
202
+ "MCP_LOG_LEVEL": "info"
203
+ }
204
+ }
205
+ }
206
+ }
207
+ ```
208
+
209
+ For Streamable HTTP, set the transport and start the server:
210
+
211
+ ```sh
212
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
213
+ # Server listens at http://localhost:3010/mcp
214
+ ```
215
+
216
+ ### Prerequisites
217
+
218
+ - [Bun v1.3](https://bun.sh/) or higher (or Node.js v24+).
219
+ - Disk for the local mirror (the populated SQLite files; GLEIF Level 1 dominates). No API key for any source.
220
+
221
+ ### Installation
222
+
223
+ 1. **Clone the repository:**
224
+
225
+ ```sh
226
+ git clone https://github.com/cyanheads/sanctions-screening-mcp-server.git
227
+ ```
228
+
229
+ 2. **Navigate into the directory:**
230
+
231
+ ```sh
232
+ cd sanctions-screening-mcp-server
233
+ ```
234
+
235
+ 3. **Install dependencies:**
236
+
237
+ ```sh
238
+ bun install
239
+ ```
240
+
241
+ 4. **Configure environment:**
242
+
243
+ ```sh
244
+ cp .env.example .env
245
+ # edit .env if you need to override defaults (all optional)
246
+ ```
247
+
248
+ 5. **Populate the mirror:**
249
+
250
+ ```sh
251
+ bun run mirror:init
252
+ ```
253
+
254
+ ## Configuration
255
+
256
+ All sources are keyless — there is no required API key. Every variable below is optional with a sensible default.
257
+
258
+ | Variable | Description | Default |
259
+ |:---|:---|:---|
260
+ | `SANCTIONS_MIRROR_PATH` | Filesystem path for the SQLite mirror; a persistent volume on a hosted deployment. | `./data/sanctions.db` |
261
+ | `SANCTIONS_REFRESH_CRON` | Cron for the scheduled refresh of sanctions lists + GLEIF deltas (HTTP transport only). | `0 4 * * *` |
262
+ | `SANCTIONS_FUZZY_MIN_SCORE` | Default Jaro-Winkler similarity floor for fuzzy matches when `min_score` is omitted. | `0.85` |
263
+ | `SANCTIONS_FUZZY_MAX_RESULTS` | Hard cap on fuzzy candidates scored per query, to bound work on short queries. | `50` |
264
+ | `OFAC_SDN_URL` | Override for the OFAC SDN advanced-XML file. | official SLS URL |
265
+ | `OFAC_CONSOLIDATED_URL` | Override for the OFAC Consolidated advanced-XML file. | official SLS URL |
266
+ | `EU_FSF_URL` | Override for the EU consolidated XML file (includes the static public token path component). | official EU URL |
267
+ | `UK_SANCTIONS_URL` | Override for the UK Sanctions List (UKSL) XML file. | official FCDO URL |
268
+ | `UN_SC_URL` | Override for the UN Security Council consolidated XML file. | official UN URL |
269
+ | `GLEIF_GOLDEN_COPY_BASE_URL` | Override for the GLEIF golden-copy / delta download API. | `https://goldencopy.gleif.org` |
270
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
271
+ | `MCP_HTTP_PORT` | Port for the HTTP server. | `3010` |
272
+ | `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
273
+
274
+ Source URLs default to the verified official endpoints; overrides exist for testing and for pinning a mirror in restricted environments. The EU "token" is a static public path component, not a credential.
275
+
276
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
277
+
278
+ ## Running the server
279
+
280
+ ### Local development
281
+
282
+ - **Build and run:**
283
+
284
+ ```sh
285
+ # One-time build
286
+ bun run rebuild
287
+
288
+ # Run the built server
289
+ bun run start:stdio
290
+ # or
291
+ bun run start:http
292
+ ```
293
+
294
+ - **Run checks and tests:**
295
+
296
+ ```sh
297
+ bun run devcheck # Lint, format, typecheck, security, changelog sync
298
+ bun run test # Vitest test suite
299
+ bun run lint:mcp # Validate MCP definitions against spec
300
+ ```
301
+
302
+ ### Docker
303
+
304
+ ```sh
305
+ docker build -t sanctions-screening-mcp-server .
306
+ docker run --rm -p 3010:3010 -v sanctions-data:/usr/src/app/data sanctions-screening-mcp-server
307
+ ```
308
+
309
+ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/sanctions-screening-mcp-server`. The image runs under Bun, so the mirror uses `bun:sqlite` (no native build). Mount a volume at the mirror path (`/usr/src/app/data` by default) so the populated mirror survives container restarts, and run `bun run mirror:init` inside the container (`docker exec`) to populate it. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.
310
+
311
+ ## Project structure
312
+
313
+ | Directory | Purpose |
314
+ |:---|:---|
315
+ | `src/index.ts` | `createApp()` entry point — registers tools/resources/prompts, inits the screening service, schedules the HTTP refresh. |
316
+ | `src/config` | Server-specific environment variable parsing and validation with Zod. |
317
+ | `src/mcp-server/tools` | Tool definitions (`*.tool.ts`) — the six screening/resolution tools. |
318
+ | `src/mcp-server/resources` | Resource definitions (`*.resource.ts`) — the three URI mirrors. |
319
+ | `src/mcp-server/prompts` | Prompt definitions (`*.prompt.ts`) — the counterparty vetting prompt. |
320
+ | `src/services/screening` | The screening service — local mirror, normalized schema, source ingesters (OFAC/EU/UK/UN/GLEIF), and the strict/fuzzy matching engine. |
321
+ | `scripts/mirror-*.ts` | Mirror lifecycle CLI — init, refresh, verify, seed. |
322
+ | `tests/` | Unit and integration tests mirroring `src/`. |
323
+
324
+ ## Development guide
325
+
326
+ See [`CLAUDE.md`/`AGENTS.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
327
+
328
+ - Handlers throw, framework catches — no `try/catch` in tool logic
329
+ - Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
330
+ - Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`
331
+ - Wrap external sources: validate raw → normalize to the common schema → return the output schema; never fabricate fields a source omits, and never synthesize a confidence score
332
+
333
+ ## Attribution
334
+
335
+ This server redistributes open data from the following sources, cited here per their terms:
336
+
337
+ - **OFAC** SDN and Consolidated lists — US Department of the Treasury, Office of Foreign Assets Control (US Government public domain).
338
+ - **EU** Consolidated Financial Sanctions List — European Commission / EEAS (freely redistributable).
339
+ - **UK Sanctions List** — UK Foreign, Commonwealth & Development Office, licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) (attribution required).
340
+ - **UN** Security Council Consolidated List — United Nations Security Council (freely redistributable).
341
+ - **GLEIF** LEI data — Global Legal Entity Identifier Foundation, [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/).
342
+
343
+ ## Contributing
344
+
345
+ Issues and pull requests are welcome. Run checks and tests before submitting:
346
+
347
+ ```sh
348
+ bun run devcheck
349
+ bun run test
350
+ ```
351
+
352
+ ## License
353
+
354
+ Apache-2.0 — see [LICENSE](./LICENSE) for details.
@@ -0,0 +1,26 @@
1
+ ---
2
+ summary: "Initial release: screen names against OFAC, EU, UK, and UN sanctions lists and resolve legal entities against GLEIF, fuzzy-matched offline over a local SQLite + FTS5 mirror. A screening aid, not a compliance determination."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.0 — 2026-06-13
8
+
9
+ ## Added
10
+
11
+ - **`sanctions_screen_name`** — screen a name (person, organization, vessel, aircraft) against all loaded watchlists (OFAC SDN + Consolidated, EU, UK, UN) at once. Strict mode (exact-normalized → all-tokens-present via FTS5) with a scored Jaro-Winkler + Double-Metaphone fuzzy fallback (opt-in, or auto when strict is empty). Hits are labeled `exact`/`strong`/`approximate`; approximate hits carry the raw Jaro-Winkler similarity (0–1) — never a fabricated confidence score.
12
+ - **`sanctions_get_designation`** — full normalized record for one designation by source + entry ID: aliases, identifiers, addresses, dates of birth, nationalities, program, legal basis, designation date.
13
+ - **`sanctions_resolve_entity`** — resolve a company name (+ optional jurisdiction) to ranked GLEIF LEI candidates.
14
+ - **`sanctions_get_entity`** — full GLEIF Level 1 record for an LEI plus a sanctions cross-reference screened on the legal name.
15
+ - **`sanctions_trace_ownership`** — GLEIF Level 2 ownership graph (parents/children, BFS to depth) with optional per-node beneficial-ownership screening.
16
+ - **`sanctions_list_sources`** — loaded lists + GLEIF datasets with record counts, source URLs, licenses, and mirror readiness/as-of timestamps.
17
+ - **Resources** — `sanctions://designation/{source}/{entryId}`, `sanctions://entity/{lei}`, `sanctions://sources`.
18
+ - **Prompt** — `sanctions_vet_counterparty` sequences the tools into a full counterparty due-diligence pass.
19
+ - **MirrorService data path** — two local SQLite + FTS5 mirrors (a sanctions `designation` mirror with a per-alias `name` index carrying Double-Metaphone phonetic keys, and a GLEIF `lei_entity` mirror with a `lei_relationship` ownership table). Ingesters for OFAC SDN/Consolidated, EU, UK Sanctions List, UN SC Consolidated, and GLEIF golden copy (L1 + L2). Real corpus loads out-of-band via `mirror:init`; `mirror:refresh`, `mirror:verify`, and `mirror:seed` round out the lifecycle.
20
+ - **Decision-support framing** — every screening tool's description and output carries the caveat that results are potential matches to verify, not a compliance determination, and that an empty result is not a clearance.
21
+
22
+ agent-notes: |
23
+ New runtime deps: better-sqlite3 (Node SQLite driver for the MirrorService;
24
+ bun:sqlite is used under Bun) and fast-xml-parser (source XML parsing).
25
+ Populate the mirror out-of-band with `bun run mirror:init` before screening;
26
+ `bun run mirror:seed` loads a small synthetic fixture for local smoke tests.