@sebastienrousseau/crypto-mcp 0.0.0-stage → 0.0.7
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/LICENSE +8 -0
- package/README.md +138 -2
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +62 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +213 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +136 -0
- package/dist/tools/cbom.d.ts +3 -0
- package/dist/tools/cbom.d.ts.map +1 -0
- package/dist/tools/cbom.js +48 -0
- package/dist/tools/definitions.d.ts +7 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +237 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +36 -0
- package/dist/tools/keys.d.ts +4 -0
- package/dist/tools/keys.d.ts.map +1 -0
- package/dist/tools/keys.js +114 -0
- package/dist/tools/kms.d.ts +4 -0
- package/dist/tools/kms.d.ts.map +1 -0
- package/dist/tools/kms.js +57 -0
- package/dist/tools/result.d.ts +7 -0
- package/dist/tools/result.d.ts.map +1 -0
- package/dist/tools/result.js +21 -0
- package/dist/tools/signing.d.ts +5 -0
- package/dist/tools/signing.d.ts.map +1 -0
- package/dist/tools/signing.js +65 -0
- package/dist/tools/symmetric.d.ts +4 -0
- package/dist/tools/symmetric.d.ts.map +1 -0
- package/dist/tools/symmetric.js +58 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/package.json +59 -3
package/LICENSE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# `@sebastienrousseau/crypto-mcp`
|
|
4
|
+
|
|
5
|
+
> Model Context Protocol (MCP) Server for the Crypto Service Suite — exposing cryptographic operations, post-quantum primitives, and key management to AI assistants and agentic workflows.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sebastienrousseau/crypto-mcp)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://github.com/sebastienrousseau/crypto-service)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`@sebastienrousseau/crypto-mcp` implements the **Model Context Protocol (MCP)** specification, turning the Crypto Service Suite into a secure, tool-enabled cryptographic runtime for AI agents and LLM-driven environments (including Cursor, Antigravity, Claude Desktop, VS Code, and Zed).
|
|
16
|
+
|
|
17
|
+
Instead of relying on fragile shell scripts or unverified LLM math, agents invoke cryptographically verified tools backed by `@sebastienrousseau/crypto-lib`, `@sebastienrousseau/crypto-kms`, and `@sebastienrousseau/crypto-wasm`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Standard MCP Protocol**: Full compliance with the Model Context Protocol JSON-RPC 2.0 specification via stdio transport.
|
|
24
|
+
- **Post-Quantum Cryptography (PQC)**: Tools for NIST FIPS 203 (ML-KEM / Kyber), FIPS 204 (ML-DSA), and hybrid X25519 + ML-KEM key encapsulation.
|
|
25
|
+
- **Classical Primitives**: RSA-2048/4096, ECC (P-256, P-384, P-521, secp256k1), Ed25519, OpenPGP (RFC 4880/9580), and AES-256-GCM / ChaCha20-Poly1305.
|
|
26
|
+
- **Envelope Encryption**: Direct orchestration of multi-cloud Key Management Systems (AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault).
|
|
27
|
+
- **Cryptographic Bill of Materials (CBOM)**: Automated discovery and inventory of cryptographic assets for DORA Articles 9/13 and CRA compliance.
|
|
28
|
+
- **Zero Runtime Dependencies**: Lightweight, secure stdio architecture operating with strict input schema validation.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Global installation for MCP client configuration
|
|
36
|
+
npm install -g @sebastienrousseau/crypto-mcp
|
|
37
|
+
|
|
38
|
+
# Or use with npx directly
|
|
39
|
+
npx @sebastienrousseau/crypto-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
### Claude Desktop / Cursor / Antigravity (`mcpServers` config)
|
|
47
|
+
|
|
48
|
+
Add the server to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"crypto-service": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "@sebastienrousseau/crypto-mcp"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Tools Exposed
|
|
64
|
+
|
|
65
|
+
| Tool Name | Description | Key Parameters |
|
|
66
|
+
| --------------------- | ------------------------------------------------------------- | ----------------------------------------------------- |
|
|
67
|
+
| `crypto_generate_key` | Generate classical or post-quantum keypairs | `type` (rsa, ecc, ed25519, ml-kem-768), `passphrase` |
|
|
68
|
+
| `crypto_encrypt` | Encrypt data with symmetric, asymmetric, or hybrid algorithms | `data`, `key`, `algorithm`, `armor` |
|
|
69
|
+
| `crypto_decrypt` | Decrypt encrypted ciphertexts or armored blocks | `ciphertext`, `key`, `passphrase` |
|
|
70
|
+
| `crypto_sign` | Create cryptographic signatures (clearsign, detached, raw) | `data`, `privateKey`, `passphrase`, `detached` |
|
|
71
|
+
| `crypto_verify` | Verify digital signatures against public keys | `data`, `signature`, `publicKey` |
|
|
72
|
+
| `crypto_hash` | Compute cryptographic hashes or post-quantum signatures | `data`, `algorithm` (sha256, sha512, blake2b, blake3) |
|
|
73
|
+
| `crypto_kms_wrap` | Wrap a local data encryption key using cloud KMS | `provider` (aws, gcp, azure, vault), `keyId`, `dek` |
|
|
74
|
+
| `crypto_kms_unwrap` | Unwrap a wrapped data encryption key using cloud KMS | `provider`, `keyId`, `wrappedKey` |
|
|
75
|
+
| `crypto_inspect_key` | Parse armored OpenPGP keys or PEM certificates | `keyData` |
|
|
76
|
+
| `crypto_audit_cbom` | Audit a directory for cryptographic assets and produce CBOM | `targetPath`, `format` (cyclonedx, spdx, summary) |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Resources Exposed
|
|
81
|
+
|
|
82
|
+
- `crypto://standards/pqc`: Complete NIST FIPS 203, 204, 205 specification parameters and CNSA 2.0 migration timelines.
|
|
83
|
+
- `crypto://algorithms/matrix`: Comprehensive security strength, key size, and deprecation matrix.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Prompts Exposed
|
|
88
|
+
|
|
89
|
+
- `pqc-migration-plan`: Guided analysis prompt to evaluate legacy cryptographic risk and produce a phased transition roadmap.
|
|
90
|
+
- `dora-compliance-check`: Fiduciary audit checklist reviewing cryptographic agility, third-party risk, and CBOM completeness under Regulation (EU) 2022/2554.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Security & Memory Hygiene
|
|
95
|
+
|
|
96
|
+
`@sebastienrousseau/crypto-mcp` enforces strict separation of concerns:
|
|
97
|
+
|
|
98
|
+
- **No Private Key Retention**: Private keys and sensitive plaintext inputs are processed in-memory and never cached across MCP requests.
|
|
99
|
+
- **Input Validation**: Strict JSON schema bounds on all inputs prevent buffer overflow and injection attacks.
|
|
100
|
+
- **Stdio Transport Isolation**: The server communicates over standard input/output with zero open network ports.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pnpm --filter @sebastienrousseau/crypto-mcp run build
|
|
108
|
+
pnpm --filter @sebastienrousseau/crypto-mcp run test
|
|
109
|
+
pnpm --filter @sebastienrousseau/crypto-mcp run lint
|
|
110
|
+
pnpm --filter @sebastienrousseau/crypto-mcp run format
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
All 18 packages in the Crypto Service workspace maintain a **100% coverage floor** across statements, branches, functions, and lines.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
- [Full Suite Documentation](https://docs.crypto-service.co/)
|
|
120
|
+
- [API Reference (TypeDoc)](https://docs.crypto-service.co/packages/crypto-mcp/)
|
|
121
|
+
- [Developer Guide](../../DEVELOPMENT.md)
|
|
122
|
+
- [Security Policy](../../SECURITY.md)
|
|
123
|
+
- [Architecture & Design](../../ARCHITECTURE.md)
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Stability guarantees
|
|
128
|
+
|
|
129
|
+
Versions advance strictly one step at a time on the `0.0.x` line (`v0.0.1` → `v0.0.2` → `v0.0.3` ... → `v0.0.999` → `v0.1.0`). Work for every release iteration begins on a dedicated `feat/v<version>` branch.
|
|
130
|
+
|
|
131
|
+
All 18 packages in the workspace move in lockstep. Public API signatures, cipher output formats, and serialization schemas are strictly versioned. Breaking changes to serialized formats or algorithm defaults are considered major breaking changes. Minimum toolchain upgrades (e.g. Node.js LTS floor) are governed by [POLICIES.md](../../docs/POLICIES.md).
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
Dual-licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) or [MIT](https://opensource.org/licenses/MIT), at your option.
|
|
138
|
+
|
|
139
|
+
Copyright (c) 2022-2026 Sebastien Rousseau and The Crypto Service Suite contributors.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAKA,wBAAgB,GAAG,IAAI,IAAI,CAG1B"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.run = run;
|
|
5
|
+
const server_1 = require("./server");
|
|
6
|
+
function run() {
|
|
7
|
+
const server = new server_1.CryptoMcpServer();
|
|
8
|
+
server.listenStdio(process.stdin, process.stdout);
|
|
9
|
+
}
|
|
10
|
+
if (require.main === module) {
|
|
11
|
+
run();
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./tools"), exports);
|
|
19
|
+
__exportStar(require("./resources"), exports);
|
|
20
|
+
__exportStar(require("./prompts"), exports);
|
|
21
|
+
__exportStar(require("./server"), exports);
|
|
22
|
+
__exportStar(require("./cli"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,OAAO,EAAE,SAAS,EA2B9B,CAAC;AAEF,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAkC7B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROMPTS = void 0;
|
|
4
|
+
exports.getPrompt = getPrompt;
|
|
5
|
+
exports.PROMPTS = [
|
|
6
|
+
{
|
|
7
|
+
name: "pqc-migration-plan",
|
|
8
|
+
description: "Generate a phased Post-Quantum Cryptography (PQC) migration roadmap tailored to an enterprise repository or architecture.",
|
|
9
|
+
arguments: [
|
|
10
|
+
{
|
|
11
|
+
name: "targetSystem",
|
|
12
|
+
description: "Name or architecture description of the system being migrated (e.g. 'Wholesale Payment Gateway' or 'API Microservices').",
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "dora-compliance-check",
|
|
19
|
+
description: "Generate a fiduciary audit checklist for DORA Articles 9 and 13 cryptographic resilience and CBOM tracking.",
|
|
20
|
+
arguments: [
|
|
21
|
+
{
|
|
22
|
+
name: "organizationType",
|
|
23
|
+
description: "Type of financial entity (e.g. 'Credit Institution', 'Payment Service Provider', 'Investment Firm').",
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
async function getPrompt(name, args = {}) {
|
|
30
|
+
if (name === "pqc-migration-plan") {
|
|
31
|
+
const target = args.targetSystem || "Enterprise Application";
|
|
32
|
+
return {
|
|
33
|
+
description: `Post-Quantum Cryptography Migration Plan for ${target}`,
|
|
34
|
+
messages: [
|
|
35
|
+
{
|
|
36
|
+
role: "user",
|
|
37
|
+
content: {
|
|
38
|
+
type: "text",
|
|
39
|
+
text: `Please design a 4-phase Post-Quantum Cryptography (PQC) migration plan for ${target} in accordance with NIST FIPS 203/204/205 standards and NSA CNSA 2.0 timelines:\n\n1. Cryptographic Asset Discovery & CBOM Generation\n2. Hybrid Key Exchange (X25519MLKEM768 in TLS 1.3 per RFC 10024; hybrid X25519 + ML-KEM-768 for data at rest)\n3. Hardware & Memory Zeroization Audit (Wasm linear memory vs V8 GC heap)\n4. Complete Deprecation of Classical Public Key Infrastructure.`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (name === "dora-compliance-check") {
|
|
46
|
+
const org = args.organizationType || "Financial Entity";
|
|
47
|
+
return {
|
|
48
|
+
description: `DORA Articles 9 & 13 Cryptographic Resilience Audit for ${org}`,
|
|
49
|
+
messages: [
|
|
50
|
+
{
|
|
51
|
+
role: "user",
|
|
52
|
+
content: {
|
|
53
|
+
type: "text",
|
|
54
|
+
text: `Perform a DORA Regulation (EU) 2022/2554 compliance evaluation for ${org}:\n\n- Article 9: Technical cryptographic measures, encryption-in-transit, encryption-at-rest, and key management lifecycle.\n- Article 13: Continuous cryptographic agility and supply chain dependency auditing.\n- Cryptographic Bill of Materials (CBOM) inventory completeness in CycloneDX 1.6 format.`,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,SAAS,EAAE,WAAW,EAelC,CAAC;AAEF,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,qBAAqB,CAAC,CAmMhC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESOURCES = void 0;
|
|
4
|
+
exports.readResource = readResource;
|
|
5
|
+
exports.RESOURCES = [
|
|
6
|
+
{
|
|
7
|
+
uri: "crypto://standards/pqc",
|
|
8
|
+
name: "NIST Post-Quantum Cryptography Standards & Parameters",
|
|
9
|
+
description: "Specification parameters for FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), FIPS 205 (SLH-DSA), and FIPS 206 (FN-DSA).",
|
|
10
|
+
mimeType: "application/json",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
uri: "crypto://algorithms/matrix",
|
|
14
|
+
name: "Cryptographic Algorithm Security & Deprecation Matrix",
|
|
15
|
+
description: "Comprehensive security strength, key size, and deprecation schedule for enterprise cryptography.",
|
|
16
|
+
mimeType: "application/json",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
async function readResource(uri) {
|
|
20
|
+
if (uri === "crypto://standards/pqc") {
|
|
21
|
+
const data = {
|
|
22
|
+
standards: [
|
|
23
|
+
{
|
|
24
|
+
name: "ML-KEM",
|
|
25
|
+
fips: 203,
|
|
26
|
+
type: "Key Encapsulation Mechanism",
|
|
27
|
+
basis: "Module Learning with Errors (M-LWE)",
|
|
28
|
+
variants: [
|
|
29
|
+
{
|
|
30
|
+
level: 1,
|
|
31
|
+
name: "ML-KEM-512",
|
|
32
|
+
publicKeyBytes: 800,
|
|
33
|
+
ciphertextBytes: 768,
|
|
34
|
+
sharedSecretBytes: 32,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
level: 3,
|
|
38
|
+
name: "ML-KEM-768",
|
|
39
|
+
publicKeyBytes: 1184,
|
|
40
|
+
ciphertextBytes: 1088,
|
|
41
|
+
sharedSecretBytes: 32,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
level: 5,
|
|
45
|
+
name: "ML-KEM-1024",
|
|
46
|
+
publicKeyBytes: 1568,
|
|
47
|
+
ciphertextBytes: 1568,
|
|
48
|
+
sharedSecretBytes: 32,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "ML-DSA",
|
|
54
|
+
fips: 204,
|
|
55
|
+
type: "Digital Signature",
|
|
56
|
+
basis: "Module Learning with Errors (M-LWE)",
|
|
57
|
+
variants: [
|
|
58
|
+
{
|
|
59
|
+
level: 2,
|
|
60
|
+
name: "ML-DSA-44",
|
|
61
|
+
publicKeyBytes: 1312,
|
|
62
|
+
signatureBytes: 2420,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
level: 3,
|
|
66
|
+
name: "ML-DSA-65",
|
|
67
|
+
publicKeyBytes: 1952,
|
|
68
|
+
signatureBytes: 3309,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
level: 5,
|
|
72
|
+
name: "ML-DSA-87",
|
|
73
|
+
publicKeyBytes: 2592,
|
|
74
|
+
signatureBytes: 4627,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "SLH-DSA",
|
|
80
|
+
fips: 205,
|
|
81
|
+
type: "Stateless Hash-Based Digital Signature",
|
|
82
|
+
basis: "Hash Trees (SPHINCS+)",
|
|
83
|
+
variants: [
|
|
84
|
+
{
|
|
85
|
+
level: 1,
|
|
86
|
+
name: "SLH-DSA-128s",
|
|
87
|
+
publicKeyBytes: 32,
|
|
88
|
+
signatureBytes: 7856,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
level: 5,
|
|
92
|
+
name: "SLH-DSA-256s",
|
|
93
|
+
publicKeyBytes: 64,
|
|
94
|
+
signatureBytes: 29792,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
timelines: {
|
|
100
|
+
nsaCnsa2: {
|
|
101
|
+
softwareTransition: 2027,
|
|
102
|
+
webAndProtocols: 2030,
|
|
103
|
+
legacyDeprecation: 2033,
|
|
104
|
+
},
|
|
105
|
+
doraEnforcement: 2025,
|
|
106
|
+
cyberResilienceAct: 2027,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
contents: [
|
|
111
|
+
{
|
|
112
|
+
uri,
|
|
113
|
+
mimeType: "application/json",
|
|
114
|
+
text: JSON.stringify(data, null, 2),
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (uri === "crypto://algorithms/matrix") {
|
|
120
|
+
const matrix = {
|
|
121
|
+
symmetric: [
|
|
122
|
+
{
|
|
123
|
+
name: "AES-256-GCM",
|
|
124
|
+
securityBits: 256,
|
|
125
|
+
quantumSafe: true,
|
|
126
|
+
recommended: true,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "ChaCha20-Poly1305",
|
|
130
|
+
securityBits: 256,
|
|
131
|
+
quantumSafe: true,
|
|
132
|
+
recommended: true,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "3DES",
|
|
136
|
+
securityBits: 112,
|
|
137
|
+
quantumSafe: false,
|
|
138
|
+
recommended: false,
|
|
139
|
+
status: "DEPRECATED",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
asymmetric: [
|
|
143
|
+
{
|
|
144
|
+
name: "ML-KEM-768",
|
|
145
|
+
securityBits: 192,
|
|
146
|
+
quantumSafe: true,
|
|
147
|
+
recommended: true,
|
|
148
|
+
standard: "FIPS 203",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "RSA-2048",
|
|
152
|
+
securityBits: 112,
|
|
153
|
+
quantumSafe: false,
|
|
154
|
+
recommended: false,
|
|
155
|
+
status: "PHASING_OUT",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "RSA-4096",
|
|
159
|
+
securityBits: 128,
|
|
160
|
+
quantumSafe: false,
|
|
161
|
+
recommended: false,
|
|
162
|
+
status: "PHASING_OUT",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "ECDSA (P-256)",
|
|
166
|
+
securityBits: 128,
|
|
167
|
+
quantumSafe: false,
|
|
168
|
+
recommended: false,
|
|
169
|
+
status: "PHASING_OUT",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "Ed25519",
|
|
173
|
+
securityBits: 128,
|
|
174
|
+
quantumSafe: false,
|
|
175
|
+
recommended: false,
|
|
176
|
+
status: "PHASING_OUT",
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
hashes: [
|
|
180
|
+
{
|
|
181
|
+
name: "SHA-256",
|
|
182
|
+
securityBits: 256,
|
|
183
|
+
quantumSafe: true,
|
|
184
|
+
status: "SECURE",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "SHA-512",
|
|
188
|
+
securityBits: 512,
|
|
189
|
+
quantumSafe: true,
|
|
190
|
+
status: "SECURE",
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "SHA-1",
|
|
194
|
+
securityBits: 0,
|
|
195
|
+
quantumSafe: false,
|
|
196
|
+
status: "BROKEN",
|
|
197
|
+
},
|
|
198
|
+
{ name: "MD5", securityBits: 0, quantumSafe: false, status: "BROKEN" },
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
return {
|
|
202
|
+
contents: [
|
|
203
|
+
{
|
|
204
|
+
uri,
|
|
205
|
+
mimeType: "application/json",
|
|
206
|
+
text: JSON.stringify(matrix, null, 2),
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=index.js.map
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSONRPCRequest, JSONRPCResponse } from "./types";
|
|
2
|
+
export declare const SERVER_VERSION: string;
|
|
3
|
+
export declare class CryptoMcpServer {
|
|
4
|
+
private initialized;
|
|
5
|
+
private readonly name;
|
|
6
|
+
private readonly version;
|
|
7
|
+
isInitialized(): boolean;
|
|
8
|
+
handleRequest(request: JSONRPCRequest): Promise<JSONRPCResponse>;
|
|
9
|
+
listenStdio(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAuB,MAAM,SAAS,CAAC;AAU/E,eAAO,MAAM,cAAc,EAAE,MAIpB,CAAC;AAEV,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAKnC,aAAa,IAAI,OAAO;IAOlB,aAAa,CACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC;IAuGpB,WAAW,CAChB,KAAK,GAAE,MAAM,CAAC,cAA8B,EAC5C,MAAM,GAAE,MAAM,CAAC,cAA+B,GAC7C,IAAI;CAwBR"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CryptoMcpServer = exports.SERVER_VERSION = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_readline_1 = __importDefault(require("node:readline"));
|
|
10
|
+
const tools_1 = require("./tools");
|
|
11
|
+
const resources_1 = require("./resources");
|
|
12
|
+
const prompts_1 = require("./prompts");
|
|
13
|
+
exports.SERVER_VERSION = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, "..", "package.json"), "utf8")).version;
|
|
14
|
+
class CryptoMcpServer {
|
|
15
|
+
initialized = false;
|
|
16
|
+
name = "crypto-service";
|
|
17
|
+
version = exports.SERVER_VERSION;
|
|
18
|
+
isInitialized() {
|
|
19
|
+
return this.initialized;
|
|
20
|
+
}
|
|
21
|
+
async handleRequest(request) {
|
|
22
|
+
const id = request.id ?? null;
|
|
23
|
+
if (!request.jsonrpc || request.jsonrpc !== "2.0") {
|
|
24
|
+
return {
|
|
25
|
+
jsonrpc: "2.0",
|
|
26
|
+
id,
|
|
27
|
+
error: {
|
|
28
|
+
code: -32600,
|
|
29
|
+
message: "Invalid Request: jsonrpc must be '2.0'",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
switch (request.method) {
|
|
35
|
+
case "initialize": {
|
|
36
|
+
this.initialized = true;
|
|
37
|
+
const result = {
|
|
38
|
+
protocolVersion: "2024-11-05",
|
|
39
|
+
capabilities: {
|
|
40
|
+
tools: {},
|
|
41
|
+
resources: {},
|
|
42
|
+
prompts: {},
|
|
43
|
+
},
|
|
44
|
+
serverInfo: {
|
|
45
|
+
name: this.name,
|
|
46
|
+
version: this.version,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
return { jsonrpc: "2.0", id, result };
|
|
50
|
+
}
|
|
51
|
+
case "ping": {
|
|
52
|
+
return { jsonrpc: "2.0", id, result: {} };
|
|
53
|
+
}
|
|
54
|
+
case "tools/list": {
|
|
55
|
+
return { jsonrpc: "2.0", id, result: { tools: tools_1.TOOLS } };
|
|
56
|
+
}
|
|
57
|
+
case "tools/call": {
|
|
58
|
+
const params = request.params;
|
|
59
|
+
const toolName = params ? String(params.name) : "";
|
|
60
|
+
const toolArgs = params && params.arguments
|
|
61
|
+
? params.arguments
|
|
62
|
+
: {};
|
|
63
|
+
const result = await (0, tools_1.executeTool)(toolName, toolArgs);
|
|
64
|
+
return { jsonrpc: "2.0", id, result };
|
|
65
|
+
}
|
|
66
|
+
case "resources/list": {
|
|
67
|
+
return { jsonrpc: "2.0", id, result: { resources: resources_1.RESOURCES } };
|
|
68
|
+
}
|
|
69
|
+
case "resources/read": {
|
|
70
|
+
const params = request.params;
|
|
71
|
+
const uri = params ? String(params.uri) : "";
|
|
72
|
+
const result = await (0, resources_1.readResource)(uri);
|
|
73
|
+
return { jsonrpc: "2.0", id, result };
|
|
74
|
+
}
|
|
75
|
+
case "prompts/list": {
|
|
76
|
+
return { jsonrpc: "2.0", id, result: { prompts: prompts_1.PROMPTS } };
|
|
77
|
+
}
|
|
78
|
+
case "prompts/get": {
|
|
79
|
+
const params = request.params;
|
|
80
|
+
const promptName = params ? String(params.name) : "";
|
|
81
|
+
const promptArgs = params && params.arguments
|
|
82
|
+
? params.arguments
|
|
83
|
+
: {};
|
|
84
|
+
const result = await (0, prompts_1.getPrompt)(promptName, promptArgs);
|
|
85
|
+
return { jsonrpc: "2.0", id, result };
|
|
86
|
+
}
|
|
87
|
+
default:
|
|
88
|
+
return {
|
|
89
|
+
jsonrpc: "2.0",
|
|
90
|
+
id,
|
|
91
|
+
error: {
|
|
92
|
+
code: -32601,
|
|
93
|
+
message: `Method not found: ${request.method}`,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return {
|
|
100
|
+
jsonrpc: "2.0",
|
|
101
|
+
id,
|
|
102
|
+
error: {
|
|
103
|
+
code: -32603,
|
|
104
|
+
message: err.message,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
listenStdio(input = process.stdin, output = process.stdout) {
|
|
110
|
+
const rl = node_readline_1.default.createInterface({
|
|
111
|
+
input,
|
|
112
|
+
output: undefined,
|
|
113
|
+
terminal: false,
|
|
114
|
+
});
|
|
115
|
+
rl.on("line", async (line) => {
|
|
116
|
+
const trimmed = line.trim();
|
|
117
|
+
if (!trimmed)
|
|
118
|
+
return;
|
|
119
|
+
try {
|
|
120
|
+
const req = JSON.parse(trimmed);
|
|
121
|
+
const res = await this.handleRequest(req);
|
|
122
|
+
output.write(JSON.stringify(res) + "\n");
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
const parseError = {
|
|
126
|
+
jsonrpc: "2.0",
|
|
127
|
+
id: null,
|
|
128
|
+
error: { code: -32700, message: "Parse error: invalid JSON" },
|
|
129
|
+
};
|
|
130
|
+
output.write(JSON.stringify(parseError) + "\n");
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.CryptoMcpServer = CryptoMcpServer;
|
|
136
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbom.d.ts","sourceRoot":"","sources":["../../src/tools/cbom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAc,MAAM,UAAU,CAAC;AAqCnD,eAAO,MAAM,SAAS,EAAE,WAevB,CAAC"}
|