@peac/mappings-mcp 0.9.18
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 +23 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @peac/mappings-mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) integration for PEAC
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @peac/mappings-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
See [peacprotocol.org](https://peacprotocol.org) for full documentation.
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
Apache-2.0
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
PEAC Protocol is an open source project stewarded by Originary and community contributors.
|
|
22
|
+
|
|
23
|
+
[Originary](https://www.originary.xyz) | [Docs](https://peacprotocol.org) | [GitHub](https://github.com/peacprotocol/peac)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Context Protocol (MCP) integration
|
|
3
|
+
* Attach PEAC receipts to MCP tool responses
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* MCP Tool Response
|
|
7
|
+
*/
|
|
8
|
+
export interface MCPToolResponse {
|
|
9
|
+
tool: string;
|
|
10
|
+
result: unknown;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* MCP Tool Response with PEAC receipt
|
|
16
|
+
*/
|
|
17
|
+
export interface MCPToolResponseWithReceipt extends MCPToolResponse {
|
|
18
|
+
peac_receipt?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Attach PEAC receipt to MCP tool response
|
|
22
|
+
*
|
|
23
|
+
* @param response - MCP tool response
|
|
24
|
+
* @param receiptJWS - PEAC receipt JWS
|
|
25
|
+
* @returns MCP tool response with PEAC receipt attached
|
|
26
|
+
*/
|
|
27
|
+
export declare function attachReceipt(response: MCPToolResponse, receiptJWS: string): MCPToolResponseWithReceipt;
|
|
28
|
+
/**
|
|
29
|
+
* Extract PEAC receipt from MCP tool response
|
|
30
|
+
*
|
|
31
|
+
* @param response - MCP tool response (possibly with receipt)
|
|
32
|
+
* @returns PEAC receipt JWS or null if not present
|
|
33
|
+
*/
|
|
34
|
+
export declare function extractReceipt(response: MCPToolResponseWithReceipt): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Check if MCP tool response has a PEAC receipt
|
|
37
|
+
*
|
|
38
|
+
* @param response - MCP tool response
|
|
39
|
+
* @returns true if receipt is present
|
|
40
|
+
*/
|
|
41
|
+
export declare function hasReceipt(response: MCPToolResponseWithReceipt): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Create MCP tool response with PEAC receipt for paid API calls
|
|
44
|
+
*
|
|
45
|
+
* @param tool - Tool name
|
|
46
|
+
* @param result - Tool execution result
|
|
47
|
+
* @param receiptJWS - PEAC receipt JWS
|
|
48
|
+
* @param metadata - Optional metadata
|
|
49
|
+
* @returns MCP tool response with receipt
|
|
50
|
+
*/
|
|
51
|
+
export declare function createPaidToolResponse(tool: string, result: unknown, receiptJWS: string, metadata?: Record<string, unknown>): MCPToolResponseWithReceipt;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,MAAM,GACjB,0BAA0B,CAK5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,GAAG,IAAI,CAKlF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,0BAA0B,GAAG,OAAO,CAExE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,0BAA0B,CAQ5B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Model Context Protocol (MCP) integration
|
|
4
|
+
* Attach PEAC receipts to MCP tool responses
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.attachReceipt = attachReceipt;
|
|
8
|
+
exports.extractReceipt = extractReceipt;
|
|
9
|
+
exports.hasReceipt = hasReceipt;
|
|
10
|
+
exports.createPaidToolResponse = createPaidToolResponse;
|
|
11
|
+
/**
|
|
12
|
+
* Attach PEAC receipt to MCP tool response
|
|
13
|
+
*
|
|
14
|
+
* @param response - MCP tool response
|
|
15
|
+
* @param receiptJWS - PEAC receipt JWS
|
|
16
|
+
* @returns MCP tool response with PEAC receipt attached
|
|
17
|
+
*/
|
|
18
|
+
function attachReceipt(response, receiptJWS) {
|
|
19
|
+
return {
|
|
20
|
+
...response,
|
|
21
|
+
peac_receipt: receiptJWS,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extract PEAC receipt from MCP tool response
|
|
26
|
+
*
|
|
27
|
+
* @param response - MCP tool response (possibly with receipt)
|
|
28
|
+
* @returns PEAC receipt JWS or null if not present
|
|
29
|
+
*/
|
|
30
|
+
function extractReceipt(response) {
|
|
31
|
+
if (typeof response.peac_receipt === 'string' && response.peac_receipt.length > 0) {
|
|
32
|
+
return response.peac_receipt;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if MCP tool response has a PEAC receipt
|
|
38
|
+
*
|
|
39
|
+
* @param response - MCP tool response
|
|
40
|
+
* @returns true if receipt is present
|
|
41
|
+
*/
|
|
42
|
+
function hasReceipt(response) {
|
|
43
|
+
return extractReceipt(response) !== null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create MCP tool response with PEAC receipt for paid API calls
|
|
47
|
+
*
|
|
48
|
+
* @param tool - Tool name
|
|
49
|
+
* @param result - Tool execution result
|
|
50
|
+
* @param receiptJWS - PEAC receipt JWS
|
|
51
|
+
* @param metadata - Optional metadata
|
|
52
|
+
* @returns MCP tool response with receipt
|
|
53
|
+
*/
|
|
54
|
+
function createPaidToolResponse(tool, result, receiptJWS, metadata) {
|
|
55
|
+
const response = {
|
|
56
|
+
tool,
|
|
57
|
+
result,
|
|
58
|
+
...(metadata && { metadata }),
|
|
59
|
+
};
|
|
60
|
+
return attachReceipt(response, receiptJWS);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA0BH,sCAQC;AAQD,wCAKC;AAQD,gCAEC;AAWD,wDAaC;AA9DD;;;;;;GAMG;AACH,SAAgB,aAAa,CAC3B,QAAyB,EACzB,UAAkB;IAElB,OAAO;QACL,GAAG,QAAQ;QACX,YAAY,EAAE,UAAU;KACzB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,QAAoC;IACjE,IAAI,OAAO,QAAQ,CAAC,YAAY,KAAK,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClF,OAAO,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,QAAoC;IAC7D,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,IAAY,EACZ,MAAe,EACf,UAAkB,EAClB,QAAkC;IAElC,MAAM,QAAQ,GAAoB;QAChC,IAAI;QACJ,MAAM;QACN,GAAG,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC;KAC9B,CAAC;IAEF,OAAO,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peac/mappings-mcp",
|
|
3
|
+
"version": "0.9.18",
|
|
4
|
+
"description": "Model Context Protocol (MCP) integration for PEAC",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/peacprotocol/peac.git",
|
|
10
|
+
"directory": "packages/mappings/mcp"
|
|
11
|
+
},
|
|
12
|
+
"author": "jithinraj <7850727+jithinraj@users.noreply.github.com>",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/peacprotocol/peac/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/peacprotocol/peac#readme",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"clean": "rm -rf dist"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@peac/schema": "workspace:*"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.10.0",
|
|
36
|
+
"typescript": "^5.3.3",
|
|
37
|
+
"vitest": "^1.1.0"
|
|
38
|
+
}
|
|
39
|
+
}
|