@kasarlabs/scarb-mcp 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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/bin/scarb-mcp.js +14 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +71 -0
  6. package/build/index.js.map +1 -0
  7. package/build/lib/types/index.d.ts +39 -0
  8. package/build/lib/types/index.js +2 -0
  9. package/build/lib/types/index.js.map +1 -0
  10. package/build/lib/utils/common.d.ts +3 -0
  11. package/build/lib/utils/common.js +33 -0
  12. package/build/lib/utils/common.js.map +1 -0
  13. package/build/lib/utils/index.d.ts +25 -0
  14. package/build/lib/utils/index.js +153 -0
  15. package/build/lib/utils/index.js.map +1 -0
  16. package/build/lib/utils/path.d.ts +2 -0
  17. package/build/lib/utils/path.js +44 -0
  18. package/build/lib/utils/path.js.map +1 -0
  19. package/build/lib/utils/preparation.d.ts +23 -0
  20. package/build/lib/utils/preparation.js +140 -0
  21. package/build/lib/utils/preparation.js.map +1 -0
  22. package/build/lib/utils/utils.d.ts +7 -0
  23. package/build/lib/utils/utils.js +55 -0
  24. package/build/lib/utils/utils.js.map +1 -0
  25. package/build/lib/utils/workspace.d.ts +48 -0
  26. package/build/lib/utils/workspace.js +121 -0
  27. package/build/lib/utils/workspace.js.map +1 -0
  28. package/build/schemas/index.d.ts +92 -0
  29. package/build/schemas/index.js +71 -0
  30. package/build/schemas/index.js.map +1 -0
  31. package/build/tools/build.d.ts +3 -0
  32. package/build/tools/build.js +22 -0
  33. package/build/tools/build.js.map +1 -0
  34. package/build/tools/execute.d.ts +23 -0
  35. package/build/tools/execute.js +34 -0
  36. package/build/tools/execute.js.map +1 -0
  37. package/build/tools/init.d.ts +15 -0
  38. package/build/tools/init.js +23 -0
  39. package/build/tools/init.js.map +1 -0
  40. package/build/tools/install.d.ts +19 -0
  41. package/build/tools/install.js +56 -0
  42. package/build/tools/install.js.map +1 -0
  43. package/build/tools/prove.d.ts +28 -0
  44. package/build/tools/prove.js +41 -0
  45. package/build/tools/prove.js.map +1 -0
  46. package/build/tools/verify.d.ts +20 -0
  47. package/build/tools/verify.js +25 -0
  48. package/build/tools/verify.js.map +1 -0
  49. package/package.json +43 -0
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { proveProgramSchema } from '../schemas/index.js';
3
+ export declare const proveProgram: (params: z.infer<typeof proveProgramSchema>) => Promise<{
4
+ status: string;
5
+ message: string;
6
+ proofPath: string;
7
+ result: {
8
+ status: string;
9
+ message: string;
10
+ proofPath: string;
11
+ output: string;
12
+ error: string | undefined;
13
+ };
14
+ projectPath: string;
15
+ errors?: undefined;
16
+ metadata?: undefined;
17
+ } | {
18
+ status: string;
19
+ errors: string[];
20
+ metadata: {
21
+ error_type: string;
22
+ needs_exact_forwarding: boolean;
23
+ };
24
+ message?: undefined;
25
+ proofPath?: undefined;
26
+ result?: undefined;
27
+ projectPath?: undefined;
28
+ }>;
@@ -0,0 +1,41 @@
1
+ import { checkScarbInstalled, cleanProject, formatCompilationError, } from '../lib/utils/index.js';
2
+ import { proveProject } from '../lib/utils/workspace.js';
3
+ import { exec } from 'child_process';
4
+ import { promisify } from 'util';
5
+ import * as path from 'path';
6
+ const execPromise = promisify(exec);
7
+ export const proveProgram = async (params) => {
8
+ let projectDir = '';
9
+ try {
10
+ await checkScarbInstalled();
11
+ const result = await proveProject({
12
+ projectDir: params.path || process.cwd(),
13
+ executionId: params.executionId.toString(),
14
+ });
15
+ const fullPath = path.join(projectDir, result.proofPath);
16
+ return {
17
+ status: 'success',
18
+ message: 'Program proved successfully',
19
+ proofPath: fullPath,
20
+ result: result,
21
+ projectPath: projectDir,
22
+ };
23
+ }
24
+ catch (error) {
25
+ const errors = formatCompilationError(error);
26
+ return {
27
+ status: 'failure',
28
+ errors: errors,
29
+ metadata: {
30
+ error_type: 'proving_error',
31
+ needs_exact_forwarding: true,
32
+ },
33
+ };
34
+ }
35
+ finally {
36
+ if (projectDir) {
37
+ await cleanProject(projectDir);
38
+ }
39
+ }
40
+ };
41
+ //# sourceMappingURL=prove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prove.js","sourceRoot":"","sources":["../../src/tools/prove.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAOpC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,MAA0C,EAC1C,EAAE;IACF,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,IAAI,CAAC;QACH,MAAM,mBAAmB,EAAE,CAAC;QAE5B,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;YAChC,UAAU,EAAE,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE;YACxC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;SAC3C,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAEzD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,6BAA6B;YACtC,SAAS,EAAE,QAAQ;YACnB,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,UAAU;SACxB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE;gBACR,UAAU,EAAE,eAAe;gBAC3B,sBAAsB,EAAE,IAAI;aAC7B;SACF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { verifyProgramSchema } from '../schemas/index.js';
3
+ export declare const verifyProgram: (params: z.infer<typeof verifyProgramSchema>) => Promise<{
4
+ status: string;
5
+ message: string;
6
+ result: {
7
+ status: string;
8
+ message: string;
9
+ output: string;
10
+ error: string | undefined;
11
+ };
12
+ projectPath: string | undefined;
13
+ error?: undefined;
14
+ } | {
15
+ status: string;
16
+ message: string;
17
+ error: any;
18
+ result?: undefined;
19
+ projectPath?: undefined;
20
+ }>;
@@ -0,0 +1,25 @@
1
+ import { checkScarbInstalled } from '../lib/utils/index.js';
2
+ import { verifyProject } from '../lib/utils/workspace.js';
3
+ export const verifyProgram = async (params) => {
4
+ try {
5
+ await checkScarbInstalled();
6
+ const result = await verifyProject({
7
+ projectDir: params.path || process.cwd(),
8
+ proofPath: params.proofFile,
9
+ });
10
+ return {
11
+ status: 'success',
12
+ message: 'Program verification completed',
13
+ result: result,
14
+ projectPath: params.path,
15
+ };
16
+ }
17
+ catch (error) {
18
+ return {
19
+ status: 'failure',
20
+ message: `Verification failed: ${error.message}`,
21
+ error: error.message,
22
+ };
23
+ }
24
+ };
25
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/tools/verify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAChC,MAA2C,EAC3C,EAAE;IACF,IAAI,CAAC;QACH,MAAM,mBAAmB,EAAE,CAAC;QAE5B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;YACjC,UAAU,EAAE,MAAM,CAAC,IAAI,IAAK,OAAO,CAAC,GAAG,EAAa;YACpD,SAAS,EAAE,MAAM,CAAC,SAAmB;SACtC,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,gCAAgC;YACzC,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM,CAAC,IAAI;SACzB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,wBAAwB,KAAK,CAAC,OAAO,EAAE;YAChD,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@kasarlabs/scarb-mcp",
3
+ "version": "0.1.0",
4
+ "main": "index.js",
5
+ "type": "module",
6
+ "bin": {
7
+ "scarb-mcp": "./bin/scarb-mcp.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc && chmod 755 build/index.js",
11
+ "clean": "rm -rf build",
12
+ "clean:all": "rm -rf build node_modules",
13
+ "start": "node build/index.js"
14
+ },
15
+ "files": [
16
+ "build"
17
+ ],
18
+ "dependencies": {
19
+ "@kasarlabs/ask-starknet-core": "0.1.0",
20
+ "@modelcontextprotocol/sdk": "^1.11.2",
21
+ "dotenv": "^16.4.7",
22
+ "fs-extra": "^11.3.2",
23
+ "winston": "^3.17.0",
24
+ "zod": "^3.24.2"
25
+ },
26
+ "devDependencies": {
27
+ "@types/fs-extra": "^11.0.4",
28
+ "@types/node": "^22.13.10",
29
+ "typescript": "^5.8.2"
30
+ },
31
+ "keywords": [
32
+ "mcp",
33
+ "starknet",
34
+ "scarb"
35
+ ],
36
+ "author": "kasarlabs",
37
+ "license": "MIT",
38
+ "description": "MCP server for Scarb Cairo compilation and program execution operations.",
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "gitHead": "2239ec60f8e369abd318807cecd22fe97c0ab917"
43
+ }