adoptai-mcp 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 +70 -0
- package/bin/adoptai-mcp.js +2 -0
- package/dist/apps/canva.js +1 -0
- package/dist/apps/figma.js +1 -0
- package/dist/apps/github.js +2 -0
- package/dist/apps/notion.js +1 -0
- package/dist/apps/registry.js +20 -0
- package/dist/apps/salesforce.js +1 -0
- package/dist/cli/add.js +532 -0
- package/dist/cli/index.js +39 -0
- package/dist/cli/list.js +19 -0
- package/dist/cli/remove.js +37 -0
- package/dist/cli/serve.js +27 -0
- package/dist/cli/status.js +24 -0
- package/dist/config/clients.js +118 -0
- package/dist/config/credentials.js +34 -0
- package/dist/core/auth-manager.js +237 -0
- package/dist/core/config-writer.js +161 -0
- package/dist/core/doctor.js +199 -0
- package/dist/core/package.json +3 -0
- package/dist/core/server-base.js +81 -0
- package/dist/integrations/canva/.env +3 -0
- package/dist/integrations/canva/auth.js +287 -0
- package/dist/integrations/canva/env.js +9 -0
- package/dist/integrations/canva/index.js +12 -0
- package/dist/integrations/canva/package.json +31 -0
- package/dist/integrations/canva/publish-to-adoptai.js +365 -0
- package/dist/integrations/canva/setup.js +90 -0
- package/dist/integrations/canva/tools.js +1315 -0
- package/dist/integrations/canva/tools.original.js +1315 -0
- package/dist/integrations/figma/auth.js +48 -0
- package/dist/integrations/figma/index.js +11 -0
- package/dist/integrations/figma/package.json +27 -0
- package/dist/integrations/figma/publish-to-adoptai.js +384 -0
- package/dist/integrations/figma/setup.js +90 -0
- package/dist/integrations/figma/tools.js +1137 -0
- package/dist/integrations/github/auth.js +53 -0
- package/dist/integrations/github/index.js +11 -0
- package/dist/integrations/github/package.json +28 -0
- package/dist/integrations/github/publish-to-adoptai.js +240 -0
- package/dist/integrations/github/setup.js +103 -0
- package/dist/integrations/github/tools.js +78 -0
- package/dist/integrations/github-actions/auth.js +53 -0
- package/dist/integrations/github-actions/index.js +11 -0
- package/dist/integrations/github-actions/package.json +27 -0
- package/dist/integrations/github-actions/setup.js +103 -0
- package/dist/integrations/github-actions/tools.js +5642 -0
- package/dist/integrations/github-activity/auth.js +53 -0
- package/dist/integrations/github-activity/index.js +11 -0
- package/dist/integrations/github-activity/package.json +27 -0
- package/dist/integrations/github-activity/setup.js +103 -0
- package/dist/integrations/github-activity/tools.js +925 -0
- package/dist/integrations/github-apps/auth.js +53 -0
- package/dist/integrations/github-apps/index.js +11 -0
- package/dist/integrations/github-apps/package.json +27 -0
- package/dist/integrations/github-apps/setup.js +103 -0
- package/dist/integrations/github-apps/tools.js +791 -0
- package/dist/integrations/github-billing/auth.js +53 -0
- package/dist/integrations/github-billing/index.js +11 -0
- package/dist/integrations/github-billing/package.json +27 -0
- package/dist/integrations/github-billing/setup.js +103 -0
- package/dist/integrations/github-billing/tools.js +438 -0
- package/dist/integrations/github-checks/auth.js +53 -0
- package/dist/integrations/github-checks/index.js +11 -0
- package/dist/integrations/github-checks/package.json +27 -0
- package/dist/integrations/github-checks/setup.js +103 -0
- package/dist/integrations/github-checks/tools.js +607 -0
- package/dist/integrations/github-code-scanning/auth.js +53 -0
- package/dist/integrations/github-code-scanning/index.js +11 -0
- package/dist/integrations/github-code-scanning/package.json +27 -0
- package/dist/integrations/github-code-scanning/setup.js +103 -0
- package/dist/integrations/github-code-scanning/tools.js +987 -0
- package/dist/integrations/github-dependabot/auth.js +53 -0
- package/dist/integrations/github-dependabot/index.js +11 -0
- package/dist/integrations/github-dependabot/package.json +27 -0
- package/dist/integrations/github-dependabot/setup.js +103 -0
- package/dist/integrations/github-dependabot/tools.js +915 -0
- package/dist/integrations/github-gists/auth.js +53 -0
- package/dist/integrations/github-gists/index.js +11 -0
- package/dist/integrations/github-gists/package.json +27 -0
- package/dist/integrations/github-gists/setup.js +103 -0
- package/dist/integrations/github-gists/tools.js +545 -0
- package/dist/integrations/github-git/auth.js +53 -0
- package/dist/integrations/github-git/index.js +11 -0
- package/dist/integrations/github-git/package.json +27 -0
- package/dist/integrations/github-git/setup.js +103 -0
- package/dist/integrations/github-git/tools.js +513 -0
- package/dist/integrations/github-issues/auth.js +53 -0
- package/dist/integrations/github-issues/index.js +11 -0
- package/dist/integrations/github-issues/package.json +27 -0
- package/dist/integrations/github-issues/setup.js +103 -0
- package/dist/integrations/github-issues/tools.js +2232 -0
- package/dist/integrations/github-orgs/auth.js +53 -0
- package/dist/integrations/github-orgs/index.js +11 -0
- package/dist/integrations/github-orgs/package.json +27 -0
- package/dist/integrations/github-orgs/setup.js +103 -0
- package/dist/integrations/github-orgs/tools.js +3512 -0
- package/dist/integrations/github-packages/auth.js +53 -0
- package/dist/integrations/github-packages/index.js +11 -0
- package/dist/integrations/github-packages/package.json +27 -0
- package/dist/integrations/github-packages/setup.js +103 -0
- package/dist/integrations/github-packages/tools.js +1088 -0
- package/dist/integrations/github-pulls/auth.js +53 -0
- package/dist/integrations/github-pulls/index.js +11 -0
- package/dist/integrations/github-pulls/package.json +27 -0
- package/dist/integrations/github-pulls/setup.js +103 -0
- package/dist/integrations/github-pulls/tools.js +1252 -0
- package/dist/integrations/github-reactions/auth.js +53 -0
- package/dist/integrations/github-reactions/index.js +11 -0
- package/dist/integrations/github-reactions/package.json +27 -0
- package/dist/integrations/github-reactions/setup.js +103 -0
- package/dist/integrations/github-reactions/tools.js +706 -0
- package/dist/integrations/github-repos/auth.js +53 -0
- package/dist/integrations/github-repos/index.js +11 -0
- package/dist/integrations/github-repos/package.json +27 -0
- package/dist/integrations/github-repos/setup.js +103 -0
- package/dist/integrations/github-repos/tools.js +7286 -0
- package/dist/integrations/github-search/auth.js +53 -0
- package/dist/integrations/github-search/index.js +11 -0
- package/dist/integrations/github-search/package.json +27 -0
- package/dist/integrations/github-search/setup.js +103 -0
- package/dist/integrations/github-search/tools.js +370 -0
- package/dist/integrations/github-teams/auth.js +53 -0
- package/dist/integrations/github-teams/index.js +11 -0
- package/dist/integrations/github-teams/package.json +27 -0
- package/dist/integrations/github-teams/setup.js +103 -0
- package/dist/integrations/github-teams/tools.js +633 -0
- package/dist/integrations/github-users/auth.js +53 -0
- package/dist/integrations/github-users/index.js +11 -0
- package/dist/integrations/github-users/package.json +27 -0
- package/dist/integrations/github-users/setup.js +103 -0
- package/dist/integrations/github-users/tools.js +1118 -0
- package/dist/integrations/notion/api.js +108 -0
- package/dist/integrations/notion/auth.js +59 -0
- package/dist/integrations/notion/endpoints.json +630 -0
- package/dist/integrations/notion/index.js +11 -0
- package/dist/integrations/notion/package.json +33 -0
- package/dist/integrations/notion/publish-to-adoptai.js +271 -0
- package/dist/integrations/notion/scripts/generate-endpoints.mjs +306 -0
- package/dist/integrations/notion/setup.js +89 -0
- package/dist/integrations/notion/tools.js +586 -0
- package/dist/integrations/notion/tools.original.js +568 -0
- package/dist/integrations/salesforce/.env +8 -0
- package/dist/integrations/salesforce/.env.example +15 -0
- package/dist/integrations/salesforce/auth.js +311 -0
- package/dist/integrations/salesforce/endpoints.json +1359 -0
- package/dist/integrations/salesforce/env.js +9 -0
- package/dist/integrations/salesforce/index.js +12 -0
- package/dist/integrations/salesforce/package.json +42 -0
- package/dist/integrations/salesforce/publish-smart-specs.js +890 -0
- package/dist/integrations/salesforce/publish-to-adoptai.js +386 -0
- package/dist/integrations/salesforce/scripts/extract-postman.mjs +222 -0
- package/dist/integrations/salesforce/setup.js +112 -0
- package/dist/integrations/salesforce/tools.js +4544 -0
- package/dist/integrations/salesforce/tools.original.js +4487 -0
- package/dist/server/mcp-server.js +50 -0
- package/dist/server/tool-loader.js +47 -0
- package/dist/specs/figma-api.json +13621 -0
- package/dist/specs/split/salesforce-auth.json +3931 -0
- package/dist/specs/split/salesforce-bulk-v1.json +1489 -0
- package/dist/specs/split/salesforce-bulk-v2.json +1951 -0
- package/dist/specs/split/salesforce-composite.json +1246 -0
- package/dist/specs/split/salesforce-connect.json +11639 -0
- package/dist/specs/split/salesforce-einstein-prediction-service.json +576 -0
- package/dist/specs/split/salesforce-event-platform.json +2682 -0
- package/dist/specs/split/salesforce-graphql.json +1754 -0
- package/dist/specs/split/salesforce-industries.json +4115 -0
- package/dist/specs/split/salesforce-metadata.json +555 -0
- package/dist/specs/split/salesforce-rest.json +4798 -0
- package/dist/specs/split/salesforce-soap.json +210 -0
- package/dist/specs/split/salesforce-subscription-management.json +1299 -0
- package/dist/specs/split/salesforce-tooling.json +2026 -0
- package/dist/specs/split/salesforce-ui.json +7426 -0
- package/package.json +47 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { saveCredentials, getCredentials } from '../../core/auth-manager.js';
|
|
2
|
+
import readline from 'readline';
|
|
3
|
+
|
|
4
|
+
const APP_ID = 'github-billing';
|
|
5
|
+
|
|
6
|
+
export async function runAuth() {
|
|
7
|
+
const rl = readline.createInterface({
|
|
8
|
+
input: process.stdin,
|
|
9
|
+
output: process.stdout,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
console.log(`
|
|
13
|
+
┌─────────────────────────────────────────────┐
|
|
14
|
+
│ GitHub Billing Authentication │
|
|
15
|
+
│ │
|
|
16
|
+
│ Use a GitHub Personal Access Token (PAT). │
|
|
17
|
+
│ Create one in Settings → Developer │
|
|
18
|
+
│ settings → Personal access tokens. │
|
|
19
|
+
└─────────────────────────────────────────────┘
|
|
20
|
+
`);
|
|
21
|
+
|
|
22
|
+
const token = await new Promise((resolve) => {
|
|
23
|
+
rl.question('Paste your GitHub PAT: ', (answer) => {
|
|
24
|
+
rl.close();
|
|
25
|
+
resolve(answer.trim());
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!token || token.length < 10) {
|
|
30
|
+
throw new Error('Invalid token');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
saveCredentials(APP_ID, {
|
|
34
|
+
token,
|
|
35
|
+
tokenType: 'bearer',
|
|
36
|
+
expiresAt: null,
|
|
37
|
+
savedAt: new Date().toISOString(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log('✅ Token saved for GitHub Billing');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getToken() {
|
|
44
|
+
return getCredentials(APP_ID)?.token || null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function buildAuthHeaders() {
|
|
48
|
+
const token = getToken();
|
|
49
|
+
if (!token) {
|
|
50
|
+
throw new Error('Not authenticated. Run: npx adoptai-github-billing-mcp --client cursor');
|
|
51
|
+
}
|
|
52
|
+
return { Authorization: 'Bearer ' + token };
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adoptai-github-billing-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GitHub's v3 REST API — budgets, usage reports, and related billing endpoints (OpenAPI-derived).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"adoptai-github-billing-mcp": "./setup.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node index.js",
|
|
12
|
+
"setup": "node setup.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": ["mcp", "github", "github-billing", "billing", "ai", "cursor", "claude", "adopt.ai"],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
18
|
+
"axios": "^1.6.0"
|
|
19
|
+
},
|
|
20
|
+
"adoptai": {
|
|
21
|
+
"appId": "github-billing",
|
|
22
|
+
"toolCount": 10,
|
|
23
|
+
"sourceFormat": "openapi_3.1",
|
|
24
|
+
"authType": "bearer",
|
|
25
|
+
"generatedAt": "2026-03-26T12:00:00.000Z"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeConfig, removeConfig } from '../../core/config-writer.js';
|
|
3
|
+
import { getCredentials, isTokenExpired } from '../../core/auth-manager.js';
|
|
4
|
+
import { runAuth } from './auth.js';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname, resolve } from 'path';
|
|
7
|
+
import readline from 'readline';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
const clientFlag = args.includes('--client')
|
|
13
|
+
? args[args.indexOf('--client') + 1]
|
|
14
|
+
: 'cursor';
|
|
15
|
+
|
|
16
|
+
const isRemove = args.includes('--remove');
|
|
17
|
+
const isStatus = args.includes('--status');
|
|
18
|
+
|
|
19
|
+
const SUPPORTED_CLIENTS = ['cursor', 'claude', 'windsurf', 'vscode'];
|
|
20
|
+
|
|
21
|
+
if (isRemove) {
|
|
22
|
+
removeConfig({ client: clientFlag, serverName: 'github-billing-adoptai' });
|
|
23
|
+
console.log(`✅ GitHub Billing MCP removed from ${clientFlag}`);
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isStatus) {
|
|
28
|
+
const creds = getCredentials('github-billing');
|
|
29
|
+
if (!creds) {
|
|
30
|
+
console.log('❌ Not authenticated');
|
|
31
|
+
} else {
|
|
32
|
+
console.log('✅ Authenticated');
|
|
33
|
+
console.log(` Token: ${creds.token?.substring(0, 12)}...`);
|
|
34
|
+
console.log(` Saved: ${creds.savedAt}`);
|
|
35
|
+
}
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!SUPPORTED_CLIENTS.includes(clientFlag)) {
|
|
40
|
+
console.error(`Invalid client: ${clientFlag}`);
|
|
41
|
+
console.error(`Supported: ${SUPPORTED_CLIENTS.join(', ')}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function main() {
|
|
46
|
+
const existing = getCredentials('github-billing');
|
|
47
|
+
|
|
48
|
+
if (existing && !isTokenExpired('github-billing')) {
|
|
49
|
+
console.log('✅ Already authenticated');
|
|
50
|
+
|
|
51
|
+
const rl = readline.createInterface({
|
|
52
|
+
input: process.stdin,
|
|
53
|
+
output: process.stdout,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const answer = await new Promise((resolveAns) => {
|
|
57
|
+
rl.question('Re-authenticate? (y/n): ', (a) => {
|
|
58
|
+
rl.close();
|
|
59
|
+
resolveAns(a.trim().toLowerCase());
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (answer !== 'y') {
|
|
64
|
+
writeConfig({
|
|
65
|
+
client: clientFlag,
|
|
66
|
+
serverName: 'github-billing-adoptai',
|
|
67
|
+
command: 'node',
|
|
68
|
+
args: [resolve(__dirname, 'index.js')],
|
|
69
|
+
env: {},
|
|
70
|
+
});
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await runAuth();
|
|
76
|
+
|
|
77
|
+
const indexPath = resolve(__dirname, 'index.js');
|
|
78
|
+
|
|
79
|
+
writeConfig({
|
|
80
|
+
client: clientFlag,
|
|
81
|
+
serverName: 'github-billing-adoptai',
|
|
82
|
+
command: 'node',
|
|
83
|
+
args: [indexPath],
|
|
84
|
+
env: {},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
console.log(`
|
|
88
|
+
✅ GitHub Billing MCP is ready!
|
|
89
|
+
────────────────────────────────────────
|
|
90
|
+
Your AI (${clientFlag}) can now use 10 tools.
|
|
91
|
+
|
|
92
|
+
Try asking:
|
|
93
|
+
"List organization billing budgets"
|
|
94
|
+
"Get billing usage for an organization"
|
|
95
|
+
|
|
96
|
+
Run health check: node core/doctor.js --client ${clientFlag}
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main().catch((err) => {
|
|
101
|
+
console.error('❌ Setup failed:', err.message);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
});
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { buildAuthHeaders } from './auth.js';
|
|
3
|
+
|
|
4
|
+
const BASE_URL = 'https://api.github.com';
|
|
5
|
+
const APP_ID = 'github-billing';
|
|
6
|
+
|
|
7
|
+
function handleError(err) {
|
|
8
|
+
const status = err.response?.status;
|
|
9
|
+
const msg = err.response?.data?.message || err.response?.data?.error || err.message;
|
|
10
|
+
if (status === 401) throw new Error(`Token invalid.\nRun: npx adoptai-${APP_ID}-mcp --client cursor`);
|
|
11
|
+
if (status === 403) throw new Error('Insufficient permissions. Check your API key scopes.');
|
|
12
|
+
if (status === 404) throw new Error('Resource not found. Check your parameters.');
|
|
13
|
+
if (status === 429) throw new Error('Rate limit exceeded. Please wait and try again.');
|
|
14
|
+
throw new Error(msg || 'API request failed');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function apiRequest(method, pathTemplate, params = {}, opts = {}) {
|
|
18
|
+
const { deleteSendsJsonBody = false } = opts;
|
|
19
|
+
const headers = buildAuthHeaders();
|
|
20
|
+
let url = BASE_URL + pathTemplate;
|
|
21
|
+
const pathKeys = [...pathTemplate.matchAll(/\{([^}]+)\}/g)].map((m) => m[1]);
|
|
22
|
+
for (const key of pathKeys) {
|
|
23
|
+
const value = params[key];
|
|
24
|
+
if (value !== undefined && value !== null) url = url.replace(`{${key}}`, encodeURIComponent(String(value)));
|
|
25
|
+
}
|
|
26
|
+
const rest = { ...params };
|
|
27
|
+
for (const key of pathKeys) delete rest[key];
|
|
28
|
+
const m = method.toUpperCase();
|
|
29
|
+
const useQuery = m === 'GET' || (m === 'DELETE' && !deleteSendsJsonBody);
|
|
30
|
+
const queryParams = {};
|
|
31
|
+
const bodyParams = {};
|
|
32
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
33
|
+
if (value === undefined) continue;
|
|
34
|
+
if (useQuery) queryParams[key] = value; else bodyParams[key] = value;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const res = await axios({
|
|
38
|
+
method: m,
|
|
39
|
+
url,
|
|
40
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
41
|
+
params: Object.keys(queryParams).length ? queryParams : undefined,
|
|
42
|
+
data: Object.keys(bodyParams).length ? bodyParams : undefined,
|
|
43
|
+
timeout: 30000,
|
|
44
|
+
});
|
|
45
|
+
if (res.status === 204 || res.data === '' || res.data === undefined) return { ok: true, status: res.status };
|
|
46
|
+
return res.data;
|
|
47
|
+
} catch (err) {
|
|
48
|
+
handleError(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const ENDPOINTS = [
|
|
53
|
+
{
|
|
54
|
+
"name": "billing_get_all_budgets_org",
|
|
55
|
+
"description": "Get all budgets for an organization",
|
|
56
|
+
"method": "GET",
|
|
57
|
+
"path": "/organizations/{org}/settings/billing/budgets",
|
|
58
|
+
"deleteSendsJsonBody": false,
|
|
59
|
+
"inputSchema": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"org": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The organization name. The name is not case sensitive."
|
|
65
|
+
},
|
|
66
|
+
"page": {
|
|
67
|
+
"type": "number",
|
|
68
|
+
"description": "The page number of the results to fetch."
|
|
69
|
+
},
|
|
70
|
+
"per_page": {
|
|
71
|
+
"type": "number",
|
|
72
|
+
"description": "The number of results per page (max 10)."
|
|
73
|
+
},
|
|
74
|
+
"scope": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "Filter budgets by scope type.",
|
|
77
|
+
"enum": [
|
|
78
|
+
"enterprise",
|
|
79
|
+
"organization",
|
|
80
|
+
"repository",
|
|
81
|
+
"cost_center"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"org"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "billing_get_budget_org",
|
|
92
|
+
"description": "Get a budget by ID for an organization",
|
|
93
|
+
"method": "GET",
|
|
94
|
+
"path": "/organizations/{org}/settings/billing/budgets/{budget_id}",
|
|
95
|
+
"deleteSendsJsonBody": false,
|
|
96
|
+
"inputSchema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"org": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "The organization name. The name is not case sensitive."
|
|
102
|
+
},
|
|
103
|
+
"budget_id": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "The ID corresponding to the budget."
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"required": [
|
|
109
|
+
"org",
|
|
110
|
+
"budget_id"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "billing_update_budget_org",
|
|
116
|
+
"description": "Update a budget for an organization",
|
|
117
|
+
"method": "PATCH",
|
|
118
|
+
"path": "/organizations/{org}/settings/billing/budgets/{budget_id}",
|
|
119
|
+
"deleteSendsJsonBody": false,
|
|
120
|
+
"inputSchema": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"org": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "The organization name. The name is not case sensitive."
|
|
126
|
+
},
|
|
127
|
+
"budget_id": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "The ID corresponding to the budget."
|
|
130
|
+
},
|
|
131
|
+
"budget_amount": {
|
|
132
|
+
"type": "number",
|
|
133
|
+
"description": "The budget amount in whole dollars. For license-based products, this represents the number of licenses."
|
|
134
|
+
},
|
|
135
|
+
"prevent_further_usage": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"description": "Whether to prevent additional spending once the budget is exceeded"
|
|
138
|
+
},
|
|
139
|
+
"budget_alerting": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"description": "The budget_alerting field"
|
|
142
|
+
},
|
|
143
|
+
"budget_scope": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"description": "The scope of the budget",
|
|
146
|
+
"enum": [
|
|
147
|
+
"enterprise",
|
|
148
|
+
"organization",
|
|
149
|
+
"repository",
|
|
150
|
+
"cost_center"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"budget_entity_name": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"description": "The name of the entity to apply the budget to"
|
|
156
|
+
},
|
|
157
|
+
"budget_type": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"description": "The type of pricing for the budget"
|
|
160
|
+
},
|
|
161
|
+
"budget_product_sku": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "A single product or SKU that will be covered in the budget"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"required": [
|
|
167
|
+
"org",
|
|
168
|
+
"budget_id"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "billing_delete_budget_org",
|
|
174
|
+
"description": "Delete a budget for an organization",
|
|
175
|
+
"method": "DELETE",
|
|
176
|
+
"path": "/organizations/{org}/settings/billing/budgets/{budget_id}",
|
|
177
|
+
"deleteSendsJsonBody": false,
|
|
178
|
+
"inputSchema": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"org": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"description": "The organization name. The name is not case sensitive."
|
|
184
|
+
},
|
|
185
|
+
"budget_id": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"description": "The ID corresponding to the budget."
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"required": [
|
|
191
|
+
"org",
|
|
192
|
+
"budget_id"
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "billing_get_github_billing_premium_request_usage_report_org",
|
|
198
|
+
"description": "Get billing premium request usage report for an organization",
|
|
199
|
+
"method": "GET",
|
|
200
|
+
"path": "/organizations/{org}/settings/billing/premium_request/usage",
|
|
201
|
+
"deleteSendsJsonBody": false,
|
|
202
|
+
"inputSchema": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"properties": {
|
|
205
|
+
"org": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"description": "The organization name. The name is not case sensitive."
|
|
208
|
+
},
|
|
209
|
+
"year": {
|
|
210
|
+
"type": "number",
|
|
211
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
212
|
+
},
|
|
213
|
+
"month": {
|
|
214
|
+
"type": "number",
|
|
215
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used."
|
|
216
|
+
},
|
|
217
|
+
"day": {
|
|
218
|
+
"type": "number",
|
|
219
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
220
|
+
},
|
|
221
|
+
"user": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "The user name to query usage for. The name is not case sensitive."
|
|
224
|
+
},
|
|
225
|
+
"model": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"description": "The model name to query usage for. The name is not case sensitive."
|
|
228
|
+
},
|
|
229
|
+
"product": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"description": "The product name to query usage for. The name is not case sensitive."
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"required": [
|
|
235
|
+
"org"
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"name": "billing_get_github_billing_usage_report_org",
|
|
241
|
+
"description": "Get billing usage report for an organization",
|
|
242
|
+
"method": "GET",
|
|
243
|
+
"path": "/organizations/{org}/settings/billing/usage",
|
|
244
|
+
"deleteSendsJsonBody": false,
|
|
245
|
+
"inputSchema": {
|
|
246
|
+
"type": "object",
|
|
247
|
+
"properties": {
|
|
248
|
+
"org": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"description": "The organization name. The name is not case sensitive."
|
|
251
|
+
},
|
|
252
|
+
"year": {
|
|
253
|
+
"type": "number",
|
|
254
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
255
|
+
},
|
|
256
|
+
"month": {
|
|
257
|
+
"type": "number",
|
|
258
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. If no year is specified the default `year` is used."
|
|
259
|
+
},
|
|
260
|
+
"day": {
|
|
261
|
+
"type": "number",
|
|
262
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"required": [
|
|
266
|
+
"org"
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "billing_get_github_billing_usage_summary_report_org",
|
|
272
|
+
"description": "Get billing usage summary for an organization",
|
|
273
|
+
"method": "GET",
|
|
274
|
+
"path": "/organizations/{org}/settings/billing/usage/summary",
|
|
275
|
+
"deleteSendsJsonBody": false,
|
|
276
|
+
"inputSchema": {
|
|
277
|
+
"type": "object",
|
|
278
|
+
"properties": {
|
|
279
|
+
"org": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"description": "The organization name. The name is not case sensitive."
|
|
282
|
+
},
|
|
283
|
+
"year": {
|
|
284
|
+
"type": "number",
|
|
285
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
286
|
+
},
|
|
287
|
+
"month": {
|
|
288
|
+
"type": "number",
|
|
289
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used."
|
|
290
|
+
},
|
|
291
|
+
"day": {
|
|
292
|
+
"type": "number",
|
|
293
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
294
|
+
},
|
|
295
|
+
"repository": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"description": "The repository name to query for usage in the format owner/repository."
|
|
298
|
+
},
|
|
299
|
+
"product": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"description": "The product name to query usage for. The name is not case sensitive."
|
|
302
|
+
},
|
|
303
|
+
"sku": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"description": "The SKU to query for usage."
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"required": [
|
|
309
|
+
"org"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "billing_get_github_billing_premium_request_usage_report_user",
|
|
315
|
+
"description": "Get billing premium request usage report for a user",
|
|
316
|
+
"method": "GET",
|
|
317
|
+
"path": "/users/{username}/settings/billing/premium_request/usage",
|
|
318
|
+
"deleteSendsJsonBody": false,
|
|
319
|
+
"inputSchema": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"username": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"description": "The handle for the GitHub user account."
|
|
325
|
+
},
|
|
326
|
+
"year": {
|
|
327
|
+
"type": "number",
|
|
328
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
329
|
+
},
|
|
330
|
+
"month": {
|
|
331
|
+
"type": "number",
|
|
332
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used."
|
|
333
|
+
},
|
|
334
|
+
"day": {
|
|
335
|
+
"type": "number",
|
|
336
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
337
|
+
},
|
|
338
|
+
"model": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"description": "The model name to query usage for. The name is not case sensitive."
|
|
341
|
+
},
|
|
342
|
+
"product": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"description": "The product name to query usage for. The name is not case sensitive."
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"required": [
|
|
348
|
+
"username"
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "billing_get_github_billing_usage_report_user",
|
|
354
|
+
"description": "Get billing usage report for a user",
|
|
355
|
+
"method": "GET",
|
|
356
|
+
"path": "/users/{username}/settings/billing/usage",
|
|
357
|
+
"deleteSendsJsonBody": false,
|
|
358
|
+
"inputSchema": {
|
|
359
|
+
"type": "object",
|
|
360
|
+
"properties": {
|
|
361
|
+
"username": {
|
|
362
|
+
"type": "string",
|
|
363
|
+
"description": "The handle for the GitHub user account."
|
|
364
|
+
},
|
|
365
|
+
"year": {
|
|
366
|
+
"type": "number",
|
|
367
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
368
|
+
},
|
|
369
|
+
"month": {
|
|
370
|
+
"type": "number",
|
|
371
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. If no year is specified the default `year` is used."
|
|
372
|
+
},
|
|
373
|
+
"day": {
|
|
374
|
+
"type": "number",
|
|
375
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"required": [
|
|
379
|
+
"username"
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "billing_get_github_billing_usage_summary_report_user",
|
|
385
|
+
"description": "Get billing usage summary for a user",
|
|
386
|
+
"method": "GET",
|
|
387
|
+
"path": "/users/{username}/settings/billing/usage/summary",
|
|
388
|
+
"deleteSendsJsonBody": false,
|
|
389
|
+
"inputSchema": {
|
|
390
|
+
"type": "object",
|
|
391
|
+
"properties": {
|
|
392
|
+
"username": {
|
|
393
|
+
"type": "string",
|
|
394
|
+
"description": "The handle for the GitHub user account."
|
|
395
|
+
},
|
|
396
|
+
"year": {
|
|
397
|
+
"type": "number",
|
|
398
|
+
"description": "If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year."
|
|
399
|
+
},
|
|
400
|
+
"month": {
|
|
401
|
+
"type": "number",
|
|
402
|
+
"description": "If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used."
|
|
403
|
+
},
|
|
404
|
+
"day": {
|
|
405
|
+
"type": "number",
|
|
406
|
+
"description": "If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used."
|
|
407
|
+
},
|
|
408
|
+
"repository": {
|
|
409
|
+
"type": "string",
|
|
410
|
+
"description": "The repository name to query for usage in the format owner/repository."
|
|
411
|
+
},
|
|
412
|
+
"product": {
|
|
413
|
+
"type": "string",
|
|
414
|
+
"description": "The product name to query usage for. The name is not case sensitive."
|
|
415
|
+
},
|
|
416
|
+
"sku": {
|
|
417
|
+
"type": "string",
|
|
418
|
+
"description": "The SKU to query for usage."
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"required": [
|
|
422
|
+
"username"
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
export const tools = ENDPOINTS.map((e) => ({
|
|
429
|
+
name: e.name,
|
|
430
|
+
description: e.description,
|
|
431
|
+
method: e.method,
|
|
432
|
+
path: e.path,
|
|
433
|
+
deleteSendsJsonBody: Boolean(e.deleteSendsJsonBody),
|
|
434
|
+
inputSchema: e.inputSchema,
|
|
435
|
+
handler: async (params) => ({
|
|
436
|
+
content: [{ type: 'text', text: JSON.stringify(await apiRequest(e.method, e.path, params, { deleteSendsJsonBody: e.deleteSendsJsonBody }), null, 2) }],
|
|
437
|
+
}),
|
|
438
|
+
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { saveCredentials, getCredentials } from '../../core/auth-manager.js';
|
|
2
|
+
import readline from 'readline';
|
|
3
|
+
|
|
4
|
+
const APP_ID = 'github-checks';
|
|
5
|
+
|
|
6
|
+
export async function runAuth() {
|
|
7
|
+
const rl = readline.createInterface({
|
|
8
|
+
input: process.stdin,
|
|
9
|
+
output: process.stdout,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
console.log(`
|
|
13
|
+
┌─────────────────────────────────────────────┐
|
|
14
|
+
│ GitHub Checks Authentication │
|
|
15
|
+
│ │
|
|
16
|
+
│ Use a GitHub Personal Access Token (PAT). │
|
|
17
|
+
│ Create one in Settings → Developer │
|
|
18
|
+
│ settings → Personal access tokens. │
|
|
19
|
+
└─────────────────────────────────────────────┘
|
|
20
|
+
`);
|
|
21
|
+
|
|
22
|
+
const token = await new Promise((resolve) => {
|
|
23
|
+
rl.question('Paste your GitHub PAT: ', (answer) => {
|
|
24
|
+
rl.close();
|
|
25
|
+
resolve(answer.trim());
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!token || token.length < 10) {
|
|
30
|
+
throw new Error('Invalid token');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
saveCredentials(APP_ID, {
|
|
34
|
+
token,
|
|
35
|
+
tokenType: 'bearer',
|
|
36
|
+
expiresAt: null,
|
|
37
|
+
savedAt: new Date().toISOString(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log('✅ Token saved for GitHub Checks');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getToken() {
|
|
44
|
+
return getCredentials(APP_ID)?.token || null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function buildAuthHeaders() {
|
|
48
|
+
const token = getToken();
|
|
49
|
+
if (!token) {
|
|
50
|
+
throw new Error('Not authenticated. Run: npx adoptai-github-checks-mcp --client cursor');
|
|
51
|
+
}
|
|
52
|
+
return { Authorization: 'Bearer ' + token };
|
|
53
|
+
}
|