@potswap_io/mcp 0.3.0 → 0.5.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.
- package/README.md +11 -1
- package/dist/agentTools.d.ts +3 -3
- package/dist/agentTools.js +27 -7
- package/dist/api.d.ts +2 -0
- package/dist/api.js +2 -0
- package/dist/index.js +3 -3
- package/dist/server.d.ts +8 -8
- package/dist/server.js +8 -8
- package/dist/strategies/tools.d.ts +3 -3
- package/dist/strategies/tools.js +4 -4
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ Use a dedicated agent wallet with only the funds you want the agent to control.
|
|
|
78
78
|
| `get_positions {wallet?}` | Holdings with USD value, average cost, unrealised and realised PnL (from swap history) |
|
|
79
79
|
| `get_points {wallet?}` | Season 1 points, POT allocated / claimable, next unlock |
|
|
80
80
|
| `get_leaderboard` | Top wallets by fee paid |
|
|
81
|
+
| `get_launch_status` | Launch-pool meter (SOL / 500 target, from chain), season and day, fee split, unclaimed reward balances and the public claim ladder |
|
|
81
82
|
| `get_price_history {mint, timeframe, limit}` | OHLCV candles from the token's top pool (`1m`…`1d`) |
|
|
82
83
|
|
|
83
84
|
### Wallet and operations (0.3.0)
|
|
@@ -119,7 +120,16 @@ State lives in `~/.potswap/strategies.json` (override with `POTSWAP_STATE_DIR`);
|
|
|
119
120
|
|
|
120
121
|
## Fees and rewards
|
|
121
122
|
|
|
122
|
-
Each swap carries Potswap's 2.5% integrator fee via Jupiter's referral program
|
|
123
|
+
Each swap carries Potswap's 2.5% integrator fee via Jupiter's referral program (1% above $1,000; stakers get −1%); Jupiter keeps 20%.
|
|
124
|
+
|
|
125
|
+
**Season 0 (now, before the token):** 60% of the net fee fills the **launch pool**; when it reaches 500 SOL the POT token launches on its own liquidity pool. 20% of your net fee is set aside as your **reward balance** (in SOL): after launch it buys POT for you, when you say so (`claim now` at market, or a limit claim at your price). 20% runs the project. Every day you trade in Season 0 earns a slice of the **250M POT airdrop** (25% of supply), replayed day by day after launch: fee basis `fee^1.1`, capped at 10% of the day per wallet, round trips within 10 minutes count 25%.
|
|
126
|
+
|
|
127
|
+
**Seasons 1+ (30 days each):** `20M × 0.85^(n−1)` POT per season shared daily by fee basis; 30% of the net fee buys and burns POT, 20% keeps feeding reward balances, 50% team and operations. Levels (Larva → Bee → Queen, up to ×1.25) persist across seasons. `get_points` shows your balance, level and season; `get_launch_status` shows the meter. Only protocol fees enter the pool: nothing can be deposited. Full documentation: https://potswap-docs.pages.dev (every tool, configuration, limits, economy; also as /llms.txt for agents).
|
|
128
|
+
|
|
129
|
+
## Also available
|
|
130
|
+
|
|
131
|
+
- **`@potswap_io/sdk`** — the same engine as a typed library for bots, scripts and other agent frameworks. The MCP server is built on it.
|
|
132
|
+
- **`@potswap_io/cli`** — the `potswap` command: `npx -y @potswap_io/cli quote SOL USDC 0.1`; swaps, transfers, wallet, points, launch meter, strategy management and `potswap daemon`.
|
|
123
133
|
|
|
124
134
|
## Development
|
|
125
135
|
|
package/dist/agentTools.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { Connection } from '@solana/web3.js';
|
|
3
|
-
import { type Config } from '
|
|
4
|
-
import { type TradeContext } from '
|
|
5
|
-
import { type Rpc } from '
|
|
3
|
+
import { type Config } from '@potswap_io/sdk';
|
|
4
|
+
import { type TradeContext } from '@potswap_io/sdk';
|
|
5
|
+
import { type Rpc } from '@potswap_io/sdk';
|
|
6
6
|
/** Transaction-level RPC reads; injectable for tests. */
|
|
7
7
|
export interface TxRpc {
|
|
8
8
|
getSignatureStatus(sig: string): Promise<{
|
package/dist/agentTools.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Connection } from '@solana/web3.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { JITOSOL_MINT, MSOL_MINT, NO_WALLET, SOL_MINT } from '
|
|
4
|
-
import { redact, redactValue } from '
|
|
5
|
-
import { createWallet } from '
|
|
6
|
-
import { executeSwap } from '
|
|
7
|
-
import { executeTransfer, rpcFromConnection } from '
|
|
8
|
-
import { mapSignatureStatus, normalizeHistory } from '
|
|
9
|
-
import { computePositions } from '
|
|
3
|
+
import { JITOSOL_MINT, MSOL_MINT, NO_WALLET, SOL_MINT } from '@potswap_io/sdk';
|
|
4
|
+
import { redact, redactValue } from '@potswap_io/sdk';
|
|
5
|
+
import { createWallet } from '@potswap_io/sdk';
|
|
6
|
+
import { executeSwap } from '@potswap_io/sdk';
|
|
7
|
+
import { executeTransfer, rpcFromConnection } from '@potswap_io/sdk';
|
|
8
|
+
import { mapSignatureStatus, normalizeHistory } from '@potswap_io/sdk';
|
|
9
|
+
import { computePositions } from '@potswap_io/sdk';
|
|
10
10
|
const ok = (data, summary) => ({ content: [{ type: 'text', text: redact(summary ?? JSON.stringify(data, null, 2)) }], structuredContent: redactValue(data) });
|
|
11
11
|
const fail = (message, extra = {}) => ({ content: [{ type: 'text', text: redact(message) }], structuredContent: redactValue({ error: message, ...extra }), isError: true });
|
|
12
12
|
const MINT = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/);
|
|
@@ -154,6 +154,26 @@ export function registerAgentTools(server, deps) {
|
|
|
154
154
|
const lst = (p) => (p === 'jito' ? JITOSOL_MINT : MSOL_MINT);
|
|
155
155
|
stakeTool('stake_sol', 'Liquid-stake SOL', 'Swaps SOL into jitoSOL (Jito) or mSOL (Marinade) at the best route. Normal fee and points apply. Requires confirm=true.', () => SOL_MINT, lst);
|
|
156
156
|
stakeTool('unstake_sol', 'Unstake liquid SOL', 'Swaps jitoSOL or mSOL back into SOL at the best route. Normal fee and points apply. Requires confirm=true.', lst, () => SOL_MINT);
|
|
157
|
+
// PRD P12.1 / P12.6a — launch meter, season, splits and the public claim pressure.
|
|
158
|
+
server.registerTool('get_launch_status', {
|
|
159
|
+
title: 'POT launch status',
|
|
160
|
+
description: 'Launch-pool meter (SOL collected / target, read from chain), current season and day, fee split in force, total unclaimed reward balances and the pending claim ladder. Only protocol fees fill the pool; nothing can be deposited.',
|
|
161
|
+
inputSchema: {},
|
|
162
|
+
}, async () => {
|
|
163
|
+
try {
|
|
164
|
+
const pool = await api.launchPool();
|
|
165
|
+
const stats = await api.stats().catch(() => ({}));
|
|
166
|
+
const season = pool.season;
|
|
167
|
+
const data = { ...pool, unclaimedSol: stats.unclaimedSol ?? null, claimLadder: stats.claimLadder ?? [], potDistributedMicro: stats.potDistributedMicro ?? null };
|
|
168
|
+
const line = pool.launch && Date.parse(String(pool.launch)) <= Date.now()
|
|
169
|
+
? `POT launched ${pool.launch}. Season ${season?.n}${season?.dayIndex ? ` day ${season.dayIndex}/30` : ''}${season?.end ? `, ends ${season.end}` : ''}.`
|
|
170
|
+
: `Launch pool: ${pool.balanceSol} / ${pool.targetSol} SOL (${Math.round(Number(pool.pct))}%)${pool.enabled ? '' : ' — pool address not published yet'}. Season 0: 60% of every net fee fills the pool; 20% builds your reward balance.`;
|
|
171
|
+
return ok(data, `${line}${data.unclaimedSol !== null && data.unclaimedSol !== undefined ? ` Unclaimed reward balances: ${data.unclaimedSol} SOL.` : ''}`);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
return fail(e instanceof Error ? e.message : String(e));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
157
177
|
// Upgraded positions with PnL (P13.7): replaces the basic tool registered by the core server.
|
|
158
178
|
server.registerTool('get_positions', {
|
|
159
179
|
title: 'Positions with PnL',
|
package/dist/api.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export declare class PotswapApi {
|
|
|
37
37
|
list(kind: string): Promise<TerminalToken[]>;
|
|
38
38
|
terminalToken(mint: string): Promise<TerminalToken>;
|
|
39
39
|
points(wallet: string): Promise<Record<string, unknown>>;
|
|
40
|
+
launchPool(): Promise<Record<string, unknown>>;
|
|
41
|
+
stats(): Promise<Record<string, unknown>>;
|
|
40
42
|
history(wallet: string, limit?: number): Promise<import("./history.js").HeliusTx[]>;
|
|
41
43
|
ohlcv(mint: string, tf: string, limit?: number): Promise<{
|
|
42
44
|
mint: string;
|
package/dist/api.js
CHANGED
|
@@ -87,6 +87,8 @@ export class PotswapApi {
|
|
|
87
87
|
list(kind) { return this.req(`/api/terminal/list/${kind}`); }
|
|
88
88
|
terminalToken(mint) { return this.req(`/api/terminal/token/${mint}`); }
|
|
89
89
|
points(wallet) { return this.req(`/api/points/${wallet}`); }
|
|
90
|
+
launchPool() { return this.req('/api/launch-pool'); }
|
|
91
|
+
stats() { return this.req('/api/stats'); }
|
|
90
92
|
history(wallet, limit = 25) { return this.req(`/api/history/${wallet}?limit=${limit}`); }
|
|
91
93
|
ohlcv(mint, tf, limit = 100) { return this.req(`/api/terminal/ohlcv/${mint}?tf=${tf}&limit=${limit}`); }
|
|
92
94
|
leaderboard() { return this.req('/api/leaderboard'); }
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Potswap MCP server over stdio, or `--daemon` to run strategies headlessly (PRD P11.11).
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { createServer, VERSION } from './server.js';
|
|
5
|
-
import { loadConfig } from '
|
|
6
|
-
import { log } from '
|
|
7
|
-
import { createRuntime } from '
|
|
5
|
+
import { loadConfig } from '@potswap_io/sdk';
|
|
6
|
+
import { log } from '@potswap_io/sdk';
|
|
7
|
+
import { createRuntime } from '@potswap_io/sdk';
|
|
8
8
|
const config = loadConfig();
|
|
9
9
|
const daemon = process.argv.includes('--daemon');
|
|
10
10
|
const rt = createRuntime(config);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { type FetchFn } from '
|
|
3
|
-
import { SOL_MINT, USDC_MINT, type Config } from '
|
|
4
|
-
import { type BalancesFn } from '
|
|
5
|
-
import { type Signer } from '
|
|
2
|
+
import { type FetchFn } from '@potswap_io/sdk';
|
|
3
|
+
import { SOL_MINT, USDC_MINT, type Config } from '@potswap_io/sdk';
|
|
4
|
+
import { type BalancesFn } from '@potswap_io/sdk';
|
|
5
|
+
import { type Signer } from '@potswap_io/sdk';
|
|
6
6
|
import { type TxRpc } from './agentTools.js';
|
|
7
|
-
import type { Rpc } from '
|
|
8
|
-
import type { StrategyStore } from '
|
|
9
|
-
import type { Scheduler } from '
|
|
10
|
-
export declare const VERSION = "0.
|
|
7
|
+
import type { Rpc } from '@potswap_io/sdk';
|
|
8
|
+
import type { StrategyStore } from '@potswap_io/sdk';
|
|
9
|
+
import type { Scheduler } from '@potswap_io/sdk';
|
|
10
|
+
export declare const VERSION = "0.5.0";
|
|
11
11
|
export interface ServerDeps {
|
|
12
12
|
config?: Config;
|
|
13
13
|
signer?: Signer | null;
|
package/dist/server.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { Connection, PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { PotswapApi, ApiError } from '
|
|
6
|
-
import { loadConfig, NO_WALLET, SOL_MINT, USDC_MINT } from '
|
|
7
|
-
import { buildQuote, executeSwap } from '
|
|
8
|
-
import { redact, redactValue } from '
|
|
9
|
-
import { loadSigner } from '
|
|
10
|
-
import { riskBadges, riskLevel } from '
|
|
5
|
+
import { PotswapApi, ApiError } from '@potswap_io/sdk';
|
|
6
|
+
import { loadConfig, NO_WALLET, SOL_MINT, USDC_MINT } from '@potswap_io/sdk';
|
|
7
|
+
import { buildQuote, executeSwap } from '@potswap_io/sdk';
|
|
8
|
+
import { redact, redactValue } from '@potswap_io/sdk';
|
|
9
|
+
import { loadSigner } from '@potswap_io/sdk';
|
|
10
|
+
import { riskBadges, riskLevel } from '@potswap_io/sdk';
|
|
11
11
|
import { registerStrategyTools } from './strategies/tools.js';
|
|
12
12
|
import { registerAgentTools } from './agentTools.js';
|
|
13
|
-
export const VERSION = '0.
|
|
13
|
+
export const VERSION = '0.5.0';
|
|
14
14
|
const ok = (data, summary) => ({
|
|
15
15
|
content: [{ type: 'text', text: redact(summary ?? JSON.stringify(data, null, 2)) }], structuredContent: redactValue(data),
|
|
16
16
|
});
|
|
@@ -117,7 +117,7 @@ export function createServer(deps = {}) {
|
|
|
117
117
|
});
|
|
118
118
|
server.registerTool('get_points', {
|
|
119
119
|
title: 'POT points',
|
|
120
|
-
description: "
|
|
120
|
+
description: "Points and rewards for a wallet: this epoch, all-time, POT allocated and claimable, next unlock, reward balance (SOL, buys POT after launch), level and season. Defaults to the agent wallet.",
|
|
121
121
|
inputSchema: { wallet: z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/).optional() },
|
|
122
122
|
}, async ({ wallet }) => {
|
|
123
123
|
const w = walletOr(wallet);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import type { TradeContext } from '
|
|
3
|
-
import { type StrategyStore } from '
|
|
4
|
-
import type { Scheduler } from '
|
|
2
|
+
import type { TradeContext } from '@potswap_io/sdk';
|
|
3
|
+
import { type StrategyStore } from '@potswap_io/sdk';
|
|
4
|
+
import type { Scheduler } from '@potswap_io/sdk';
|
|
5
5
|
export interface StrategyDeps {
|
|
6
6
|
trade: TradeContext;
|
|
7
7
|
store?: StrategyStore;
|
package/dist/strategies/tools.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { NO_WALLET } from '
|
|
3
|
-
import { redact, redactValue } from '
|
|
4
|
-
import { newId, SOL_MINT, nextRunAfter } from '
|
|
5
|
-
import { findStrategy, runsOf } from '
|
|
2
|
+
import { NO_WALLET } from '@potswap_io/sdk';
|
|
3
|
+
import { redact, redactValue } from '@potswap_io/sdk';
|
|
4
|
+
import { newId, SOL_MINT, nextRunAfter } from '@potswap_io/sdk';
|
|
5
|
+
import { findStrategy, runsOf } from '@potswap_io/sdk';
|
|
6
6
|
const MINT = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/);
|
|
7
7
|
const MAX_STRATEGIES = Number(process.env.POTSWAP_MAX_STRATEGIES) || 10;
|
|
8
8
|
const ok = (data, summary) => ({ content: [{ type: 'text', text: redact(summary ?? JSON.stringify(data, null, 2)) }], structuredContent: redactValue(data) });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@potswap_io/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Potswap MCP server: best-route Solana swaps, DCA / rebalance / take-profit strategies for AI agents
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Potswap MCP server: best-route Solana swaps, wallet, transfers, staking, DCA / rebalance / take-profit / limit strategies and POT rewards for AI agents. Non-custodial; built on @potswap_io/sdk.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"dev": "tsx src/index.ts",
|
|
23
23
|
"test": "vitest run",
|
|
24
24
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
-
"
|
|
26
|
-
"prepublishOnly": "npm run sync-shared && npm run build"
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
27
26
|
},
|
|
28
27
|
"repository": {
|
|
29
28
|
"type": "git",
|
|
@@ -41,9 +40,8 @@
|
|
|
41
40
|
],
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
44
|
-
"@
|
|
43
|
+
"@potswap_io/sdk": "^0.1.0",
|
|
45
44
|
"@solana/web3.js": "^1.99.0",
|
|
46
|
-
"bs58": "^6.0.0",
|
|
47
45
|
"zod": "^4.6.7"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|