@kasarlabs/troves-mcp 0.1.1
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 +21 -0
- package/README.md +26 -0
- package/bin/troves-mcp.js +5 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +38 -0
- package/build/index.js.map +1 -0
- package/build/schemas/index.d.ts +3 -0
- package/build/schemas/index.js +3 -0
- package/build/schemas/index.js.map +1 -0
- package/build/tools/getStrategies.d.ts +1 -0
- package/build/tools/getStrategies.js +14 -0
- package/build/tools/getStrategies.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kasar Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Snak - Troves Plugin
|
|
2
|
+
|
|
3
|
+
The Troves Plugin provides tools for fetching strategies from Troves API on Starknet.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
This plugin adds the following tools:
|
|
8
|
+
|
|
9
|
+
- **troves_get_strategies**: Get all strategies from Troves API (https://app.troves.fi/api/strategies).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The Troves Plugin is used internally by the Starknet Agent and doesn't need to be called directly. When the agent is initialized, it automatically registers these tools, making them available for use.
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
When asking the agent to perform Troves-related tasks, it will use the appropriate tool from this plugin:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
"Get Troves strategies" // Uses troves_get_strategies
|
|
21
|
+
"Show me available strategies on Troves" // Uses troves_get_strategies
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
To extend this plugin, add new tools in the `src/tools` directory and register them in the `registerTools` function in `src/index.ts`.
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { registerToolsWithServer } from '@kasarlabs/ask-starknet-core';
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
import { getStrategiesSchema } from './schemas/index.js';
|
|
7
|
+
import { getStrategies } from './tools/getStrategies.js';
|
|
8
|
+
dotenv.config();
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: 'starknet-troves-mcp',
|
|
11
|
+
version: '0.0.1',
|
|
12
|
+
});
|
|
13
|
+
const registerTools = (TrovesToolRegistry) => {
|
|
14
|
+
TrovesToolRegistry.push({
|
|
15
|
+
name: 'troves_get_strategies',
|
|
16
|
+
description: 'Get all strategies from Troves API',
|
|
17
|
+
schema: getStrategiesSchema,
|
|
18
|
+
execute: async () => {
|
|
19
|
+
return await getStrategies();
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export const RegisterToolInServer = async () => {
|
|
24
|
+
const tools = [];
|
|
25
|
+
registerTools(tools);
|
|
26
|
+
await registerToolsWithServer(server, tools);
|
|
27
|
+
};
|
|
28
|
+
async function main() {
|
|
29
|
+
const transport = new StdioServerTransport();
|
|
30
|
+
await RegisterToolInServer();
|
|
31
|
+
await server.connect(transport);
|
|
32
|
+
console.error('Starknet Troves MCP Server running on stdio');
|
|
33
|
+
}
|
|
34
|
+
main().catch((error) => {
|
|
35
|
+
console.error('Fatal error in main():', error);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAW,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,kBAA6B,EAAE,EAAE;IACtD,kBAAkB,CAAC,IAAI,CAAC;QACtB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,oCAAoC;QACjD,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,MAAM,aAAa,EAAE,CAAC;QAC/B,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAAI,EAAE;IAC7C,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,aAAa,CAAC,KAAK,CAAC,CAAC;IACrB,MAAM,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,oBAAoB,EAAE,CAAC;IAC7B,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAC/D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getStrategies(): Promise<any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export async function getStrategies() {
|
|
2
|
+
try {
|
|
3
|
+
const response = await fetch('https://app.troves.fi/api/strategies');
|
|
4
|
+
if (!response.ok) {
|
|
5
|
+
throw new Error(`Failed to fetch strategies: ${response.statusText}`);
|
|
6
|
+
}
|
|
7
|
+
const data = await response.json();
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
throw new Error(`Error fetching strategies: ${error instanceof Error ? error.message : String(error)}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=getStrategies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getStrategies.js","sourceRoot":"","sources":["../../src/tools/getStrategies.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAErE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACvF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kasarlabs/troves-mcp",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"troves-mcp": "./bin/troves-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
|
+
"@langchain/core": "^0.3.75",
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.11.2",
|
|
22
|
+
"dotenv": "^16.4.7",
|
|
23
|
+
"winston": "^3.17.0",
|
|
24
|
+
"zod": "^3.24.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.13.10",
|
|
28
|
+
"typescript": "^5.8.2"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mcp",
|
|
32
|
+
"starknet",
|
|
33
|
+
"troves"
|
|
34
|
+
],
|
|
35
|
+
"author": "kasarlabs",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"description": "MCP server for Troves strategies API on Starknet",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "3cbaf7bddcb451e4e414c9063b947891c2d0c377"
|
|
42
|
+
}
|