@proceedgate/mcp-server 1.0.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 +131 -0
- package/dist/client.d.ts +127 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +73 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +173 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +294 -0
- package/dist/tools.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @proceedgate/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for ProceedGate cost governance.
|
|
4
|
+
|
|
5
|
+
Control agent spending, enforce budgets, and prevent runaway costs through the Model Context Protocol.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @proceedgate/mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Claude Desktop Configuration
|
|
16
|
+
|
|
17
|
+
Add to your Claude Desktop config (`~/.claude/claude_desktop_config.json`):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"proceedgate": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": [
|
|
25
|
+
"-y",
|
|
26
|
+
"@proceedgate/mcp-server",
|
|
27
|
+
"--api-key",
|
|
28
|
+
"YOUR_API_KEY"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Environment Variables
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Required
|
|
39
|
+
PROCEEDGATE_API_KEY=your_api_key_here
|
|
40
|
+
|
|
41
|
+
# Optional
|
|
42
|
+
PROCEEDGATE_BASE_URL=https://governor.proceedgate.dev
|
|
43
|
+
PROCEEDGATE_WORKSPACE_ID=your_workspace_id
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Available Tools
|
|
47
|
+
|
|
48
|
+
### `gate_check`
|
|
49
|
+
Check if an action is allowed under current budget/policy.
|
|
50
|
+
|
|
51
|
+
**Parameters:**
|
|
52
|
+
- `action` (required): Type of action (tool_call, llm_call, browser_action, api_call)
|
|
53
|
+
- `policy_id` (optional): Policy to evaluate (retry_friction_v1, low_confidence_v1)
|
|
54
|
+
- `tool` (optional): Name of the tool being called
|
|
55
|
+
- `cost_estimate` (optional): Estimated cost in USD
|
|
56
|
+
- `context` (optional): Additional context for decision
|
|
57
|
+
|
|
58
|
+
**Returns:** Decision with proceed_token if allowed, or friction details if blocked.
|
|
59
|
+
|
|
60
|
+
### `gate_redeem`
|
|
61
|
+
Resolve friction and get a proceed token after payment/approval.
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `decision_id` (required): Decision ID from gate_check response
|
|
65
|
+
- `tx_hash` (required): Transaction hash proving payment
|
|
66
|
+
|
|
67
|
+
**Returns:** Proceed token for the action.
|
|
68
|
+
|
|
69
|
+
### `get_balance`
|
|
70
|
+
Get current credit balance and usage statistics.
|
|
71
|
+
|
|
72
|
+
**Returns:** Current balance, usage this period, budget limits.
|
|
73
|
+
|
|
74
|
+
### `set_budget`
|
|
75
|
+
Set spending budget limits for the workspace.
|
|
76
|
+
|
|
77
|
+
**Parameters:**
|
|
78
|
+
- `daily_limit` (optional): Daily spending cap in USDC
|
|
79
|
+
- `weekly_limit` (optional): Weekly spending cap in USDC
|
|
80
|
+
- `monthly_limit` (optional): Monthly spending cap in USDC
|
|
81
|
+
- `alert_threshold` (optional): Percentage at which to alert (0-100)
|
|
82
|
+
|
|
83
|
+
**Returns:** Updated budget configuration.
|
|
84
|
+
|
|
85
|
+
### `get_usage_report`
|
|
86
|
+
Get detailed usage report for cost analysis.
|
|
87
|
+
|
|
88
|
+
**Parameters:**
|
|
89
|
+
- `period` (optional): Time period (today, week, month, all)
|
|
90
|
+
|
|
91
|
+
**Returns:** Breakdown of costs by action type, tool, and time.
|
|
92
|
+
|
|
93
|
+
## Example Usage
|
|
94
|
+
|
|
95
|
+
Once configured, Claude can use ProceedGate tools:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
User: Check if I can make an API call
|
|
99
|
+
|
|
100
|
+
Claude: Let me check with ProceedGate...
|
|
101
|
+
[Calls gate_check with action="api_call"]
|
|
102
|
+
|
|
103
|
+
The action is allowed. You have a proceed token valid for 45 seconds.
|
|
104
|
+
Current balance: 950 credits remaining.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Policies
|
|
108
|
+
|
|
109
|
+
### `retry_friction_v1`
|
|
110
|
+
Applies friction after multiple retries:
|
|
111
|
+
- Attempts 1-3: Free
|
|
112
|
+
- Attempts 4-6: 0.004 USDC
|
|
113
|
+
- Attempts 7-9: 0.008 USDC
|
|
114
|
+
- Attempts 10+: 0.016 USDC
|
|
115
|
+
|
|
116
|
+
### `low_confidence_v1`
|
|
117
|
+
Applies friction for low-confidence actions:
|
|
118
|
+
- Confidence > 0.7: Free
|
|
119
|
+
- Confidence 0.4-0.7: 0.002 USDC
|
|
120
|
+
- Confidence < 0.4: 0.004 USDC
|
|
121
|
+
|
|
122
|
+
## Security
|
|
123
|
+
|
|
124
|
+
- API keys are never logged or exposed
|
|
125
|
+
- All communication uses HTTPS
|
|
126
|
+
- Proceed tokens are short-lived JWTs (45s TTL)
|
|
127
|
+
- Tokens can be verified via JWKS endpoint
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProceedGate API Client for MCP Server
|
|
3
|
+
*/
|
|
4
|
+
export interface ProceedGateClientOptions {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CheckRequest {
|
|
10
|
+
policy_id: string;
|
|
11
|
+
action: string;
|
|
12
|
+
actor: {
|
|
13
|
+
id: string;
|
|
14
|
+
project: string;
|
|
15
|
+
};
|
|
16
|
+
context: {
|
|
17
|
+
attempt_in_window?: number;
|
|
18
|
+
window_seconds?: number;
|
|
19
|
+
confidence?: number;
|
|
20
|
+
tool?: string;
|
|
21
|
+
cost_estimate?: number;
|
|
22
|
+
task_hash?: string;
|
|
23
|
+
step_hash?: string;
|
|
24
|
+
};
|
|
25
|
+
idempotency_key?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckResponseOk {
|
|
28
|
+
allowed: true;
|
|
29
|
+
decision_id: string;
|
|
30
|
+
proceed_token: string;
|
|
31
|
+
expires_in_seconds: number;
|
|
32
|
+
reason_code: string;
|
|
33
|
+
policy: {
|
|
34
|
+
policy_id: string;
|
|
35
|
+
friction_required: boolean;
|
|
36
|
+
friction_price: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface CheckResponse402 {
|
|
40
|
+
allowed: false;
|
|
41
|
+
decision_id: string;
|
|
42
|
+
reason_code: string;
|
|
43
|
+
policy: {
|
|
44
|
+
policy_id: string;
|
|
45
|
+
friction_required: boolean;
|
|
46
|
+
friction_price: string;
|
|
47
|
+
};
|
|
48
|
+
redeem: {
|
|
49
|
+
url: string;
|
|
50
|
+
method: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface RedeemResponse {
|
|
54
|
+
decision_id: string;
|
|
55
|
+
proceed_token: string;
|
|
56
|
+
expires_in_seconds: number;
|
|
57
|
+
receipt: {
|
|
58
|
+
tx_hash: string;
|
|
59
|
+
verified_at: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface BalanceResponse {
|
|
63
|
+
workspace_id: string;
|
|
64
|
+
credits: number;
|
|
65
|
+
credits_used_today: number;
|
|
66
|
+
credits_used_this_week: number;
|
|
67
|
+
credits_used_this_month: number;
|
|
68
|
+
budget?: {
|
|
69
|
+
daily_limit?: number;
|
|
70
|
+
weekly_limit?: number;
|
|
71
|
+
monthly_limit?: number;
|
|
72
|
+
alert_threshold?: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface BudgetConfig {
|
|
76
|
+
daily_limit?: number;
|
|
77
|
+
weekly_limit?: number;
|
|
78
|
+
monthly_limit?: number;
|
|
79
|
+
alert_threshold?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface UsageReport {
|
|
82
|
+
period: string;
|
|
83
|
+
start_date: string;
|
|
84
|
+
end_date: string;
|
|
85
|
+
total_credits_used: number;
|
|
86
|
+
total_cost_usd: number;
|
|
87
|
+
breakdown: {
|
|
88
|
+
by_action: Record<string, number>;
|
|
89
|
+
by_tool: Record<string, number>;
|
|
90
|
+
by_day: Array<{
|
|
91
|
+
date: string;
|
|
92
|
+
credits: number;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export declare class ProceedGateClient {
|
|
97
|
+
private apiKey;
|
|
98
|
+
private baseUrl;
|
|
99
|
+
private workspaceId;
|
|
100
|
+
constructor(options: ProceedGateClientOptions);
|
|
101
|
+
private request;
|
|
102
|
+
/**
|
|
103
|
+
* Check if an action is allowed under current policy/budget
|
|
104
|
+
*/
|
|
105
|
+
check(request: CheckRequest): Promise<CheckResponseOk | CheckResponse402>;
|
|
106
|
+
/**
|
|
107
|
+
* Redeem a decision after payment/friction resolution
|
|
108
|
+
*/
|
|
109
|
+
redeem(decisionId: string, txHash: string): Promise<RedeemResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Get current balance and usage
|
|
112
|
+
*/
|
|
113
|
+
getBalance(): Promise<BalanceResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Set budget limits
|
|
116
|
+
*/
|
|
117
|
+
setBudget(config: BudgetConfig): Promise<BudgetConfig>;
|
|
118
|
+
/**
|
|
119
|
+
* Get usage report
|
|
120
|
+
*/
|
|
121
|
+
getUsageReport(period?: 'today' | 'week' | 'month' | 'all'): Promise<UsageReport>;
|
|
122
|
+
/**
|
|
123
|
+
* Get workspace ID
|
|
124
|
+
*/
|
|
125
|
+
getWorkspaceId(): string;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,SAAS,EAAE,M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|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.apiKey = options.apiKey;
|
|
10
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
11
|
+
this.workspaceId = options.workspaceId;
|
|
12
|
+
}
|
|
13
|
+
async request(method, path, body) {
|
|
14
|
+
const url = `${this.baseUrl}${path}`;
|
|
15
|
+
const response = await fetch(url, {
|
|
16
|
+
method,
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
20
|
+
'X-Workspace-Id': this.workspaceId,
|
|
21
|
+
},
|
|
22
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
23
|
+
});
|
|
24
|
+
const data = await response.json();
|
|
25
|
+
if (!response.ok && response.status !== 402) {
|
|
26
|
+
throw new Error(data.error || `HTTP ${response.status}`);
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if an action is allowed under current policy/budget
|
|
32
|
+
*/
|
|
33
|
+
async check(request) {
|
|
34
|
+
return this.request('POST', '/v1/governor/check', request);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Redeem a decision after payment/friction resolution
|
|
38
|
+
*/
|
|
39
|
+
async redeem(decisionId, txHash) {
|
|
40
|
+
return this.request('POST', '/v1/governor/redeem', {
|
|
41
|
+
decision_id: decisionId,
|
|
42
|
+
tx_hash: txHash,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get current balance and usage
|
|
47
|
+
*/
|
|
48
|
+
async getBalance() {
|
|
49
|
+
return this.request('GET', `/v1/billing/balance?workspace_id=${encodeURIComponent(this.workspaceId)}`);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Set budget limits
|
|
53
|
+
*/
|
|
54
|
+
async setBudget(config) {
|
|
55
|
+
return this.request('PUT', '/v1/billing/budget', {
|
|
56
|
+
workspace_id: this.workspaceId,
|
|
57
|
+
...config,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get usage report
|
|
62
|
+
*/
|
|
63
|
+
async getUsageReport(period = 'today') {
|
|
64
|
+
return this.request('GET', `/v1/billing/usage?workspace_id=${encodeURIComponent(this.workspaceId)}&period=${period}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get workspace ID
|
|
68
|
+
*/
|
|
69
|
+
getWorkspaceId() {
|
|
70
|
+
return this.workspaceId;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmGH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,WAAW,CAAS;IAE5B,YAAY,OAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,OAAO,CACnB,MAAc,EACd,IAAY,EACZ,IAAc;QAEd,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QAErC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM;YACN,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;gBACxC,gBAAgB,EAAE,IAAI,CAAC,WAAW;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC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cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ProceedGate MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Exposes ProceedGate cost governance as MCP tools for AI agents.
|
|
6
|
+
* Allows Claude and other MCP-compatible agents to:
|
|
7
|
+
* - Check if actions are allowed under budget/policy
|
|
8
|
+
* - Resolve friction (payment) to proceed
|
|
9
|
+
* - Monitor and manage spending budgets
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ProceedGate MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Exposes ProceedGate cost governance as MCP tools for AI agents.
|
|
6
|
+
* Allows Claude and other MCP-compatible agents to:
|
|
7
|
+
* - Check if actions are allowed under budget/policy
|
|
8
|
+
* - Resolve friction (payment) to proceed
|
|
9
|
+
* - Monitor and manage spending budgets
|
|
10
|
+
*/
|
|
11
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
12
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
13
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ErrorCode, McpError, } from '@modelcontextprotocol/sdk/types.js';
|
|
14
|
+
import { ProceedGateClient } from './client.js';
|
|
15
|
+
import { tools, handleToolCall } from './tools.js';
|
|
16
|
+
// Parse CLI arguments
|
|
17
|
+
function parseArgs() {
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const result = {};
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
const arg = args[i];
|
|
22
|
+
const nextArg = args[i + 1];
|
|
23
|
+
if (arg === '--api-key' && nextArg) {
|
|
24
|
+
result.apiKey = nextArg;
|
|
25
|
+
i++;
|
|
26
|
+
}
|
|
27
|
+
else if (arg === '--base-url' && nextArg) {
|
|
28
|
+
result.baseUrl = nextArg;
|
|
29
|
+
i++;
|
|
30
|
+
}
|
|
31
|
+
else if (arg === '--workspace-id' && nextArg) {
|
|
32
|
+
result.workspaceId = nextArg;
|
|
33
|
+
i++;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
async function main() {
|
|
39
|
+
const cliArgs = parseArgs();
|
|
40
|
+
// Get configuration from CLI args or environment
|
|
41
|
+
const apiKey = cliArgs.apiKey || process.env.PROCEEDGATE_API_KEY;
|
|
42
|
+
const baseUrl = cliArgs.baseUrl || process.env.PROCEEDGATE_BASE_URL || 'https://governor.proceedgate.dev';
|
|
43
|
+
const workspaceId = cliArgs.workspaceId || process.env.PROCEEDGATE_WORKSPACE_ID || 'default';
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
console.error('Error: API key required. Use --api-key or set PROCEEDGATE_API_KEY environment variable.');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
// Initialize client
|
|
49
|
+
const client = new ProceedGateClient({
|
|
50
|
+
apiKey,
|
|
51
|
+
baseUrl,
|
|
52
|
+
workspaceId,
|
|
53
|
+
});
|
|
54
|
+
// Create MCP server
|
|
55
|
+
const server = new Server({
|
|
56
|
+
name: 'proceedgate-mcp-server',
|
|
57
|
+
version: '1.0.0',
|
|
58
|
+
}, {
|
|
59
|
+
capabilities: {
|
|
60
|
+
tools: {},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
// Register tool listing handler
|
|
64
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
65
|
+
return { tools };
|
|
66
|
+
});
|
|
67
|
+
// Register tool call handler
|
|
68
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
69
|
+
const { name, arguments: args } = request.params;
|
|
70
|
+
try {
|
|
71
|
+
const result = await handleToolCall(client, name, args || {});
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: JSON.stringify(result, null, 2),
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error instanceof McpError) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
86
|
+
throw new McpError(ErrorCode.InternalError, errorMessage);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// Connect to transport
|
|
90
|
+
const transport = new StdioServerTransport();
|
|
91
|
+
await server.connect(transport);
|
|
92
|
+
console.error('ProceedGate MCP server running on stdio');
|
|
93
|
+
}
|
|
94
|
+
main().catch((error) => {
|
|
95
|
+
console.error('Fatal error:', error);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnD,sBAAsB;AACtB,SAAS,SAAS;IAChB,MA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YAAY,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool definitions and handlers for ProceedGate
|
|
3
|
+
*/
|
|
4
|
+
import { ProceedGateClient } from './client.js';
|
|
5
|
+
export declare const tools: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties: {
|
|
11
|
+
action: {
|
|
12
|
+
type: string;
|
|
13
|
+
enum: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
policy_id: {
|
|
17
|
+
type: string;
|
|
18
|
+
enum: string[];
|
|
19
|
+
description: string;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
tool: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
cost_estimate: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
attempt_number: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
default: number;
|
|
34
|
+
};
|
|
35
|
+
confidence: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
context: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
additionalProperties: boolean;
|
|
43
|
+
};
|
|
44
|
+
decision_id?: undefined;
|
|
45
|
+
tx_hash?: undefined;
|
|
46
|
+
daily_limit?: undefined;
|
|
47
|
+
weekly_limit?: undefined;
|
|
48
|
+
monthly_limit?: undefined;
|
|
49
|
+
alert_threshold?: undefined;
|
|
50
|
+
period?: undefined;
|
|
51
|
+
};
|
|
52
|
+
required: string[];
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
name: string;
|
|
56
|
+
description: string;
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: string;
|
|
59
|
+
properties: {
|
|
60
|
+
decision_id: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
tx_hash: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
action?: undefined;
|
|
69
|
+
policy_id?: undefined;
|
|
70
|
+
tool?: undefined;
|
|
71
|
+
cost_estimate?: undefined;
|
|
72
|
+
attempt_number?: undefined;
|
|
73
|
+
confidence?: undefined;
|
|
74
|
+
context?: undefined;
|
|
75
|
+
daily_limit?: undefined;
|
|
76
|
+
weekly_limit?: undefined;
|
|
77
|
+
monthly_limit?: undefined;
|
|
78
|
+
alert_threshold?: undefined;
|
|
79
|
+
period?: undefined;
|
|
80
|
+
};
|
|
81
|
+
required: string[];
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: string;
|
|
88
|
+
properties: {
|
|
89
|
+
action?: undefined;
|
|
90
|
+
policy_id?: undefined;
|
|
91
|
+
tool?: undefined;
|
|
92
|
+
cost_estimate?: undefined;
|
|
93
|
+
attempt_number?: undefined;
|
|
94
|
+
confidence?: undefined;
|
|
95
|
+
context?: undefined;
|
|
96
|
+
decision_id?: undefined;
|
|
97
|
+
tx_hash?: undefined;
|
|
98
|
+
daily_limit?: undefined;
|
|
99
|
+
weekly_limit?: undefined;
|
|
100
|
+
monthly_limit?: undefined;
|
|
101
|
+
alert_threshold?: undefined;
|
|
102
|
+
period?: undefined;
|
|
103
|
+
};
|
|
104
|
+
required?: undefined;
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: string;
|
|
111
|
+
properties: {
|
|
112
|
+
daily_limit: {
|
|
113
|
+
type: string;
|
|
114
|
+
description: string;
|
|
115
|
+
};
|
|
116
|
+
weekly_limit: {
|
|
117
|
+
type: string;
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
monthly_limit: {
|
|
121
|
+
type: string;
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
124
|
+
alert_threshold: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
minimum: number;
|
|
128
|
+
maximum: number;
|
|
129
|
+
};
|
|
130
|
+
action?: undefined;
|
|
131
|
+
policy_id?: undefined;
|
|
132
|
+
tool?: undefined;
|
|
133
|
+
cost_estimate?: undefined;
|
|
134
|
+
attempt_number?: undefined;
|
|
135
|
+
confidence?: undefined;
|
|
136
|
+
context?: undefined;
|
|
137
|
+
decision_id?: undefined;
|
|
138
|
+
tx_hash?: undefined;
|
|
139
|
+
period?: undefined;
|
|
140
|
+
};
|
|
141
|
+
required?: undefined;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
name: string;
|
|
145
|
+
description: string;
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: string;
|
|
148
|
+
properties: {
|
|
149
|
+
period: {
|
|
150
|
+
type: string;
|
|
151
|
+
enum: string[];
|
|
152
|
+
description: string;
|
|
153
|
+
default: string;
|
|
154
|
+
};
|
|
155
|
+
action?: undefined;
|
|
156
|
+
policy_id?: undefined;
|
|
157
|
+
tool?: undefined;
|
|
158
|
+
cost_estimate?: undefined;
|
|
159
|
+
attempt_number?: undefined;
|
|
160
|
+
confidence?: undefined;
|
|
161
|
+
context?: undefined;
|
|
162
|
+
decision_id?: undefined;
|
|
163
|
+
tx_hash?: undefined;
|
|
164
|
+
daily_limit?: undefined;
|
|
165
|
+
weekly_limit?: undefined;
|
|
166
|
+
monthly_limit?: undefined;
|
|
167
|
+
alert_threshold?: undefined;
|
|
168
|
+
};
|
|
169
|
+
required?: undefined;
|
|
170
|
+
};
|
|
171
|
+
})[];
|
|
172
|
+
export declare function handleToolCall(client: ProceedGateClient, toolName: string, args: Record<string, unknown>): Promise<unknown>;
|
|
173
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAgB,MAAM,aAAa,CAAC;AAG9D,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0HjB,CAAC;AAGF,wBAAsB,cAAc,CAClC,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC,CAelB"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool definitions and handlers for ProceedGate
|
|
3
|
+
*/
|
|
4
|
+
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
// Tool definitions
|
|
6
|
+
export const tools = [
|
|
7
|
+
{
|
|
8
|
+
name: 'gate_check',
|
|
9
|
+
description: `Check if an action is allowed under current budget/policy. Call this BEFORE executing any costly action (LLM calls, API calls, browser automation, tool calls).
|
|
10
|
+
|
|
11
|
+
Returns either:
|
|
12
|
+
- ALLOWED: With a proceed_token valid for 45 seconds
|
|
13
|
+
- FRICTION: Action blocked, requires payment or approval to proceed
|
|
14
|
+
|
|
15
|
+
Use this to prevent runaway costs and enforce spending policies.`,
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
action: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
enum: ['tool_call', 'llm_call', 'browser_action', 'api_call'],
|
|
22
|
+
description: 'Type of action being performed',
|
|
23
|
+
},
|
|
24
|
+
policy_id: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
enum: ['retry_friction_v1', 'low_confidence_v1'],
|
|
27
|
+
description: 'Policy to evaluate. retry_friction_v1 charges after retries, low_confidence_v1 charges for uncertain actions',
|
|
28
|
+
default: 'retry_friction_v1',
|
|
29
|
+
},
|
|
30
|
+
tool: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Name of the tool being called (for tool_call actions)',
|
|
33
|
+
},
|
|
34
|
+
cost_estimate: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
description: 'Estimated cost of this action in USD',
|
|
37
|
+
},
|
|
38
|
+
attempt_number: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
description: 'Which attempt this is (1 = first try, higher = retries)',
|
|
41
|
+
default: 1,
|
|
42
|
+
},
|
|
43
|
+
confidence: {
|
|
44
|
+
type: 'number',
|
|
45
|
+
description: 'Confidence score 0-1 for this action (used by low_confidence_v1 policy)',
|
|
46
|
+
},
|
|
47
|
+
context: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
description: 'Additional context for the decision',
|
|
50
|
+
additionalProperties: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
required: ['action'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'gate_redeem',
|
|
58
|
+
description: `Resolve friction and get a proceed token after payment/approval.
|
|
59
|
+
Call this when gate_check returns FRICTION and you have completed payment.`,
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
decision_id: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Decision ID from the gate_check friction response',
|
|
66
|
+
},
|
|
67
|
+
tx_hash: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Transaction hash proving payment (or approval token)',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
required: ['decision_id', 'tx_hash'],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'get_balance',
|
|
77
|
+
description: `Get current credit balance, usage statistics, and budget status.
|
|
78
|
+
Use this to check remaining budget before starting expensive operations.`,
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'set_budget',
|
|
86
|
+
description: `Set spending budget limits for the workspace.
|
|
87
|
+
When a limit is reached, all actions will require friction resolution.`,
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
daily_limit: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Maximum credits to spend per day',
|
|
94
|
+
},
|
|
95
|
+
weekly_limit: {
|
|
96
|
+
type: 'number',
|
|
97
|
+
description: 'Maximum credits to spend per week',
|
|
98
|
+
},
|
|
99
|
+
monthly_limit: {
|
|
100
|
+
type: 'number',
|
|
101
|
+
description: 'Maximum credits to spend per month',
|
|
102
|
+
},
|
|
103
|
+
alert_threshold: {
|
|
104
|
+
type: 'number',
|
|
105
|
+
description: 'Percentage (0-100) at which to send alerts',
|
|
106
|
+
minimum: 0,
|
|
107
|
+
maximum: 100,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'get_usage_report',
|
|
114
|
+
description: `Get detailed usage report for cost analysis and optimization.
|
|
115
|
+
Shows breakdown by action type, tool, and time period.`,
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
period: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
enum: ['today', 'week', 'month', 'all'],
|
|
122
|
+
description: 'Time period for the report',
|
|
123
|
+
default: 'today',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
// Tool call handlers
|
|
130
|
+
export async function handleToolCall(client, toolName, args) {
|
|
131
|
+
switch (toolName) {
|
|
132
|
+
case 'gate_check':
|
|
133
|
+
return handleGateCheck(client, args);
|
|
134
|
+
case 'gate_redeem':
|
|
135
|
+
return handleGateRedeem(client, args);
|
|
136
|
+
case 'get_balance':
|
|
137
|
+
return handleGetBalance(client);
|
|
138
|
+
case 'set_budget':
|
|
139
|
+
return handleSetBudget(client, args);
|
|
140
|
+
case 'get_usage_report':
|
|
141
|
+
return handleGetUsageReport(client, args);
|
|
142
|
+
default:
|
|
143
|
+
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${toolName}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function handleGateCheck(client, args) {
|
|
147
|
+
const action = args.action;
|
|
148
|
+
if (!action) {
|
|
149
|
+
throw new McpError(ErrorCode.InvalidParams, 'action is required');
|
|
150
|
+
}
|
|
151
|
+
const policyId = args.policy_id || 'retry_friction_v1';
|
|
152
|
+
const attemptNumber = args.attempt_number || 1;
|
|
153
|
+
const confidence = args.confidence;
|
|
154
|
+
const tool = args.tool;
|
|
155
|
+
const costEstimate = args.cost_estimate;
|
|
156
|
+
const extraContext = args.context;
|
|
157
|
+
const request = {
|
|
158
|
+
policy_id: policyId,
|
|
159
|
+
action,
|
|
160
|
+
actor: {
|
|
161
|
+
id: `mcp-agent:${client.getWorkspaceId()}`,
|
|
162
|
+
project: client.getWorkspaceId(),
|
|
163
|
+
},
|
|
164
|
+
context: {
|
|
165
|
+
attempt_in_window: attemptNumber,
|
|
166
|
+
window_seconds: 30,
|
|
167
|
+
confidence: confidence ?? 0.8,
|
|
168
|
+
tool,
|
|
169
|
+
cost_estimate: costEstimate,
|
|
170
|
+
...extraContext,
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
const response = await client.check(request);
|
|
174
|
+
if (response.allowed) {
|
|
175
|
+
return {
|
|
176
|
+
status: 'ALLOWED',
|
|
177
|
+
message: 'Action is allowed. You may proceed.',
|
|
178
|
+
decision_id: response.decision_id,
|
|
179
|
+
proceed_token: response.proceed_token,
|
|
180
|
+
expires_in_seconds: response.expires_in_seconds,
|
|
181
|
+
policy: response.policy,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
return {
|
|
186
|
+
status: 'FRICTION',
|
|
187
|
+
message: 'Action blocked. Payment or approval required to proceed.',
|
|
188
|
+
decision_id: response.decision_id,
|
|
189
|
+
reason_code: response.reason_code,
|
|
190
|
+
friction_price: response.policy.friction_price,
|
|
191
|
+
redeem_url: response.redeem.url,
|
|
192
|
+
instructions: 'Use gate_redeem with the decision_id and a valid tx_hash to proceed.',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function handleGateRedeem(client, args) {
|
|
197
|
+
const decisionId = args.decision_id;
|
|
198
|
+
const txHash = args.tx_hash;
|
|
199
|
+
if (!decisionId) {
|
|
200
|
+
throw new McpError(ErrorCode.InvalidParams, 'decision_id is required');
|
|
201
|
+
}
|
|
202
|
+
if (!txHash) {
|
|
203
|
+
throw new McpError(ErrorCode.InvalidParams, 'tx_hash is required');
|
|
204
|
+
}
|
|
205
|
+
const response = await client.redeem(decisionId, txHash);
|
|
206
|
+
return {
|
|
207
|
+
status: 'REDEEMED',
|
|
208
|
+
message: 'Friction resolved. You may now proceed with the action.',
|
|
209
|
+
decision_id: response.decision_id,
|
|
210
|
+
proceed_token: response.proceed_token,
|
|
211
|
+
expires_in_seconds: response.expires_in_seconds,
|
|
212
|
+
receipt: response.receipt,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
async function handleGetBalance(client) {
|
|
216
|
+
try {
|
|
217
|
+
const balance = await client.getBalance();
|
|
218
|
+
return {
|
|
219
|
+
workspace_id: balance.workspace_id,
|
|
220
|
+
credits_remaining: balance.credits,
|
|
221
|
+
usage: {
|
|
222
|
+
today: balance.credits_used_today,
|
|
223
|
+
this_week: balance.credits_used_this_week,
|
|
224
|
+
this_month: balance.credits_used_this_month,
|
|
225
|
+
},
|
|
226
|
+
budget: balance.budget || { message: 'No budget limits configured' },
|
|
227
|
+
status: balance.credits > 100 ? 'healthy' : balance.credits > 0 ? 'low' : 'depleted',
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
// If billing endpoint not available, return helpful info
|
|
232
|
+
return {
|
|
233
|
+
message: 'Balance information not available. Billing may not be configured for this workspace.',
|
|
234
|
+
workspace_id: client.getWorkspaceId(),
|
|
235
|
+
hint: 'Contact support to enable billing features.',
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async function handleSetBudget(client, args) {
|
|
240
|
+
const config = {
|
|
241
|
+
daily_limit: args.daily_limit,
|
|
242
|
+
weekly_limit: args.weekly_limit,
|
|
243
|
+
monthly_limit: args.monthly_limit,
|
|
244
|
+
alert_threshold: args.alert_threshold,
|
|
245
|
+
};
|
|
246
|
+
// Filter out undefined values
|
|
247
|
+
const cleanConfig = Object.fromEntries(Object.entries(config).filter(([, v]) => v !== undefined));
|
|
248
|
+
if (Object.keys(cleanConfig).length === 0) {
|
|
249
|
+
return {
|
|
250
|
+
status: 'error',
|
|
251
|
+
message: 'At least one budget limit must be specified',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
const result = await client.setBudget(cleanConfig);
|
|
256
|
+
return {
|
|
257
|
+
status: 'updated',
|
|
258
|
+
message: 'Budget limits updated successfully',
|
|
259
|
+
budget: result,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
status: 'error',
|
|
265
|
+
message: 'Budget management not available. This feature requires a Pro plan.',
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async function handleGetUsageReport(client, args) {
|
|
270
|
+
const period = args.period || 'today';
|
|
271
|
+
try {
|
|
272
|
+
const report = await client.getUsageReport(period);
|
|
273
|
+
return {
|
|
274
|
+
period: report.period,
|
|
275
|
+
date_range: {
|
|
276
|
+
start: report.start_date,
|
|
277
|
+
end: report.end_date,
|
|
278
|
+
},
|
|
279
|
+
summary: {
|
|
280
|
+
total_credits: report.total_credits_used,
|
|
281
|
+
total_cost_usd: report.total_cost_usd,
|
|
282
|
+
},
|
|
283
|
+
breakdown: report.breakdown,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
return {
|
|
288
|
+
message: 'Usage reports not available. This feature requires billing to be enabled.',
|
|
289
|
+
period,
|
|
290
|
+
hint: 'Enable billing to access detailed usage reports.',
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAGzE,mBAAmB;AACnB,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;;;;iEAMgD;QAC7D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAA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1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proceedgate/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP Server for ProceedGate cost governance - control agent spending via Model Context Protocol",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"proceedgate-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"check": "tsc --noEmit",
|
|
17
|
+
"start": "node dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"model-context-protocol",
|
|
22
|
+
"proceedgate",
|
|
23
|
+
"cost-governance",
|
|
24
|
+
"agent",
|
|
25
|
+
"ai",
|
|
26
|
+
"budget",
|
|
27
|
+
"spending-control"
|
|
28
|
+
],
|
|
29
|
+
"author": "ProceedGate",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.10.0",
|
|
36
|
+
"typescript": "^5.3.2"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|