bostrom-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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/dist/clients/graphql.d.ts +1 -0
  3. package/dist/clients/graphql.js +17 -0
  4. package/dist/clients/graphql.js.map +1 -0
  5. package/dist/clients/ipfs.d.ts +1 -0
  6. package/dist/clients/ipfs.js +15 -0
  7. package/dist/clients/ipfs.js.map +1 -0
  8. package/dist/clients/lcd.d.ts +2 -0
  9. package/dist/clients/lcd.js +14 -0
  10. package/dist/clients/lcd.js.map +1 -0
  11. package/dist/clients/rpc.d.ts +1 -0
  12. package/dist/clients/rpc.js +10 -0
  13. package/dist/clients/rpc.js.map +1 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +26 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/services/economy.d.ts +41 -0
  18. package/dist/services/economy.js +64 -0
  19. package/dist/services/economy.js.map +1 -0
  20. package/dist/services/governance.d.ts +24 -0
  21. package/dist/services/governance.js +50 -0
  22. package/dist/services/governance.js.map +1 -0
  23. package/dist/services/graph.d.ts +30 -0
  24. package/dist/services/graph.js +62 -0
  25. package/dist/services/graph.js.map +1 -0
  26. package/dist/services/infra.d.ts +34 -0
  27. package/dist/services/infra.js +45 -0
  28. package/dist/services/infra.js.map +1 -0
  29. package/dist/services/lithium.d.ts +55 -0
  30. package/dist/services/lithium.js +146 -0
  31. package/dist/services/lithium.js.map +1 -0
  32. package/dist/tools/economy.d.ts +2 -0
  33. package/dist/tools/economy.js +39 -0
  34. package/dist/tools/economy.js.map +1 -0
  35. package/dist/tools/governance.d.ts +2 -0
  36. package/dist/tools/governance.js +58 -0
  37. package/dist/tools/governance.js.map +1 -0
  38. package/dist/tools/graph.d.ts +2 -0
  39. package/dist/tools/graph.js +58 -0
  40. package/dist/tools/graph.js.map +1 -0
  41. package/dist/tools/infra.d.ts +2 -0
  42. package/dist/tools/infra.js +38 -0
  43. package/dist/tools/infra.js.map +1 -0
  44. package/dist/tools/lithium.d.ts +2 -0
  45. package/dist/tools/lithium.js +208 -0
  46. package/dist/tools/lithium.js.map +1 -0
  47. package/dist/util.d.ts +31 -0
  48. package/dist/util.js +72 -0
  49. package/dist/util.js.map +1 -0
  50. package/package.json +42 -0
package/dist/util.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /** BigInt-safe JSON serializer with pretty-printing */
2
+ export declare function jsonStringify(obj: unknown): string;
3
+ /** Format a successful tool response, truncating if too large */
4
+ export declare function ok(data: unknown): ToolResult;
5
+ /** Format an error tool response */
6
+ export declare function err(message: string): ToolResult;
7
+ /** Wrap a tool handler with try/catch error handling */
8
+ export declare function safe<T>(fn: (args: T) => Promise<ToolResult>): (args: T) => Promise<ToolResult>;
9
+ /** Build pagination hint for list-returning tools */
10
+ export declare function paginationHint(toolName: string, currentOffset: number, limit: number, totalOrItems: number | unknown[]): PaginationHint | null;
11
+ export interface PaginationHint {
12
+ next_call: {
13
+ tool: string;
14
+ params: Record<string, unknown>;
15
+ };
16
+ }
17
+ export interface ToolResult {
18
+ [key: string]: unknown;
19
+ content: Array<{
20
+ type: "text";
21
+ text: string;
22
+ }>;
23
+ isError?: boolean;
24
+ }
25
+ /** Read-only tool annotations (all our tools are read-only) */
26
+ export declare const READ_ONLY_ANNOTATIONS: {
27
+ readOnlyHint: true;
28
+ destructiveHint: false;
29
+ idempotentHint: true;
30
+ openWorldHint: true;
31
+ };
package/dist/util.js ADDED
@@ -0,0 +1,72 @@
1
+ /** BigInt-safe JSON serializer with pretty-printing */
2
+ export function jsonStringify(obj) {
3
+ return JSON.stringify(obj, (_key, value) => (typeof value === "bigint" ? value.toString() : value), 2);
4
+ }
5
+ const MAX_RESPONSE_CHARS = 40_000;
6
+ const MAX_STRING_VALUE_CHARS = 2_000;
7
+ /** Recursively truncate long string values inside an object */
8
+ function truncateDeep(data) {
9
+ if (typeof data === "string") {
10
+ if (data.length > MAX_STRING_VALUE_CHARS) {
11
+ return data.slice(0, MAX_STRING_VALUE_CHARS) + "… (truncated)";
12
+ }
13
+ return data;
14
+ }
15
+ if (Array.isArray(data))
16
+ return data.map(truncateDeep);
17
+ if (data !== null && typeof data === "object") {
18
+ const out = {};
19
+ for (const [k, v] of Object.entries(data)) {
20
+ out[k] = truncateDeep(v);
21
+ }
22
+ return out;
23
+ }
24
+ return data;
25
+ }
26
+ /** Format a successful tool response, truncating if too large */
27
+ export function ok(data) {
28
+ let text = jsonStringify(truncateDeep(data));
29
+ if (text.length > MAX_RESPONSE_CHARS) {
30
+ text = text.slice(0, MAX_RESPONSE_CHARS) + "\n… (response truncated)";
31
+ }
32
+ return { content: [{ type: "text", text }] };
33
+ }
34
+ /** Format an error tool response */
35
+ export function err(message) {
36
+ return {
37
+ content: [{ type: "text", text: message.slice(0, 4_000) }],
38
+ isError: true,
39
+ };
40
+ }
41
+ /** Wrap a tool handler with try/catch error handling */
42
+ export function safe(fn) {
43
+ return async (args) => {
44
+ try {
45
+ return await fn(args);
46
+ }
47
+ catch (error) {
48
+ const msg = error instanceof Error ? error.message : String(error);
49
+ return err(msg);
50
+ }
51
+ };
52
+ }
53
+ /** Build pagination hint for list-returning tools */
54
+ export function paginationHint(toolName, currentOffset, limit, totalOrItems) {
55
+ const count = typeof totalOrItems === "number" ? totalOrItems : totalOrItems.length;
56
+ if (count < limit)
57
+ return null;
58
+ return {
59
+ next_call: {
60
+ tool: toolName,
61
+ params: { offset: currentOffset + limit, limit },
62
+ },
63
+ };
64
+ }
65
+ /** Read-only tool annotations (all our tools are read-only) */
66
+ export const READ_ONLY_ANNOTATIONS = {
67
+ readOnlyHint: true,
68
+ destructiveHint: false,
69
+ idempotentHint: true,
70
+ openWorldHint: true,
71
+ };
72
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,UAAU,aAAa,CAA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AAE;SACjD;KACF,CAAC;AACJ,CAAC;AAYD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,IAAa;IAC3B,eAAe,EAAE,KAAc;IAC/B,cAAc,EAAE,IAAa;IAC7B,aAAa,EAAE,IAAa;CAC7B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "bostrom-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for read-only access to the Bostrom blockchain ecosystem",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "bostrom-mcp": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/cyberia-to/bostrom-mcp"
23
+ },
24
+ "license": "MIT",
25
+ "keywords": [
26
+ "mcp",
27
+ "bostrom",
28
+ "cyber",
29
+ "blockchain",
30
+ "cosmwasm",
31
+ "lithium"
32
+ ],
33
+ "mcpName": "io.github.cyberia-to/bostrom-mcp",
34
+ "dependencies": {
35
+ "@modelcontextprotocol/sdk": "^1.12.1",
36
+ "zod": "^3.24.4"
37
+ },
38
+ "devDependencies": {
39
+ "typescript": "^5.7.3",
40
+ "@types/node": "^22.15.3"
41
+ }
42
+ }