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,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-git-adoptai' });
|
|
23
|
+
console.log(`✅ GitHub Git MCP removed from ${clientFlag}`);
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isStatus) {
|
|
28
|
+
const creds = getCredentials('github-git');
|
|
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-git');
|
|
47
|
+
|
|
48
|
+
if (existing && !isTokenExpired('github-git')) {
|
|
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-git-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-git-adoptai',
|
|
82
|
+
command: 'node',
|
|
83
|
+
args: [indexPath],
|
|
84
|
+
env: {},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
console.log(`
|
|
88
|
+
✅ GitHub Git MCP is ready!
|
|
89
|
+
────────────────────────────────────────
|
|
90
|
+
Your AI (${clientFlag}) can now use 13 tools.
|
|
91
|
+
|
|
92
|
+
Try asking:
|
|
93
|
+
"Create a git blob in owner/repo"
|
|
94
|
+
"Get a git commit by SHA in owner/repo"
|
|
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,513 @@
|
|
|
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-git';
|
|
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": "git_create_blob",
|
|
55
|
+
"description": "Create a blob",
|
|
56
|
+
"method": "POST",
|
|
57
|
+
"path": "/repos/{owner}/{repo}/git/blobs",
|
|
58
|
+
"deleteSendsJsonBody": false,
|
|
59
|
+
"inputSchema": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"owner": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
65
|
+
},
|
|
66
|
+
"repo": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
69
|
+
},
|
|
70
|
+
"content": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "The new blob's content."
|
|
73
|
+
},
|
|
74
|
+
"encoding": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The encoding used for `content`. Currently, `\"utf-8\"` and `\"base64\"` are supported."
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": [
|
|
80
|
+
"owner",
|
|
81
|
+
"repo",
|
|
82
|
+
"content"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "git_get_blob",
|
|
88
|
+
"description": "Get a blob",
|
|
89
|
+
"method": "GET",
|
|
90
|
+
"path": "/repos/{owner}/{repo}/git/blobs/{file_sha}",
|
|
91
|
+
"deleteSendsJsonBody": false,
|
|
92
|
+
"inputSchema": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"owner": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
98
|
+
},
|
|
99
|
+
"repo": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
102
|
+
},
|
|
103
|
+
"file_sha": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "The file_sha parameter"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"required": [
|
|
109
|
+
"owner",
|
|
110
|
+
"repo",
|
|
111
|
+
"file_sha"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "git_create_commit",
|
|
117
|
+
"description": "Create a commit",
|
|
118
|
+
"method": "POST",
|
|
119
|
+
"path": "/repos/{owner}/{repo}/git/commits",
|
|
120
|
+
"deleteSendsJsonBody": false,
|
|
121
|
+
"inputSchema": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"owner": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
127
|
+
},
|
|
128
|
+
"repo": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
131
|
+
},
|
|
132
|
+
"message": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"description": "The commit message"
|
|
135
|
+
},
|
|
136
|
+
"tree": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"description": "The SHA of the tree object this commit points to"
|
|
139
|
+
},
|
|
140
|
+
"parents": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"description": "The full SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided."
|
|
143
|
+
},
|
|
144
|
+
"author": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"description": "Information about the author of the commit. By default, the `author` will be the authenticated user and the current date. See the `author` and `committer` object below for details."
|
|
147
|
+
},
|
|
148
|
+
"committer": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"description": "Information about the person who is making the commit. By default, `committer` will use the information set in `author`. See the `author` and `committer` object below for details."
|
|
151
|
+
},
|
|
152
|
+
"signature": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"description": "The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the `gpgsig` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a `signature` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits."
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"required": [
|
|
158
|
+
"owner",
|
|
159
|
+
"repo",
|
|
160
|
+
"message",
|
|
161
|
+
"tree"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "git_get_commit",
|
|
167
|
+
"description": "Get a commit object",
|
|
168
|
+
"method": "GET",
|
|
169
|
+
"path": "/repos/{owner}/{repo}/git/commits/{commit_sha}",
|
|
170
|
+
"deleteSendsJsonBody": false,
|
|
171
|
+
"inputSchema": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"properties": {
|
|
174
|
+
"owner": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
177
|
+
},
|
|
178
|
+
"repo": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
181
|
+
},
|
|
182
|
+
"commit_sha": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "The SHA of the commit."
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"required": [
|
|
188
|
+
"owner",
|
|
189
|
+
"repo",
|
|
190
|
+
"commit_sha"
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "git_list_matching_refs",
|
|
196
|
+
"description": "List matching references",
|
|
197
|
+
"method": "GET",
|
|
198
|
+
"path": "/repos/{owner}/{repo}/git/matching-refs/{ref}",
|
|
199
|
+
"deleteSendsJsonBody": false,
|
|
200
|
+
"inputSchema": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"properties": {
|
|
203
|
+
"owner": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
206
|
+
},
|
|
207
|
+
"repo": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
210
|
+
},
|
|
211
|
+
"ref": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation."
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"required": [
|
|
217
|
+
"owner",
|
|
218
|
+
"repo",
|
|
219
|
+
"ref"
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "git_get_ref",
|
|
225
|
+
"description": "Get a reference",
|
|
226
|
+
"method": "GET",
|
|
227
|
+
"path": "/repos/{owner}/{repo}/git/ref/{ref}",
|
|
228
|
+
"deleteSendsJsonBody": false,
|
|
229
|
+
"inputSchema": {
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"owner": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
235
|
+
},
|
|
236
|
+
"repo": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
239
|
+
},
|
|
240
|
+
"ref": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"description": "The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation."
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"required": [
|
|
246
|
+
"owner",
|
|
247
|
+
"repo",
|
|
248
|
+
"ref"
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "git_create_ref",
|
|
254
|
+
"description": "Create a reference",
|
|
255
|
+
"method": "POST",
|
|
256
|
+
"path": "/repos/{owner}/{repo}/git/refs",
|
|
257
|
+
"deleteSendsJsonBody": false,
|
|
258
|
+
"inputSchema": {
|
|
259
|
+
"type": "object",
|
|
260
|
+
"properties": {
|
|
261
|
+
"owner": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
264
|
+
},
|
|
265
|
+
"repo": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
268
|
+
},
|
|
269
|
+
"ref": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"description": "The name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected."
|
|
272
|
+
},
|
|
273
|
+
"sha": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "The SHA1 value for this reference."
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"required": [
|
|
279
|
+
"owner",
|
|
280
|
+
"repo",
|
|
281
|
+
"ref",
|
|
282
|
+
"sha"
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "git_update_ref",
|
|
288
|
+
"description": "Update a reference",
|
|
289
|
+
"method": "PATCH",
|
|
290
|
+
"path": "/repos/{owner}/{repo}/git/refs/{ref}",
|
|
291
|
+
"deleteSendsJsonBody": false,
|
|
292
|
+
"inputSchema": {
|
|
293
|
+
"type": "object",
|
|
294
|
+
"properties": {
|
|
295
|
+
"owner": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
298
|
+
},
|
|
299
|
+
"repo": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
302
|
+
},
|
|
303
|
+
"ref": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"description": "The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation."
|
|
306
|
+
},
|
|
307
|
+
"sha": {
|
|
308
|
+
"type": "string",
|
|
309
|
+
"description": "The SHA1 value to set this reference to"
|
|
310
|
+
},
|
|
311
|
+
"force": {
|
|
312
|
+
"type": "boolean",
|
|
313
|
+
"description": "Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work."
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"required": [
|
|
317
|
+
"owner",
|
|
318
|
+
"repo",
|
|
319
|
+
"ref",
|
|
320
|
+
"sha"
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "git_delete_ref",
|
|
326
|
+
"description": "Delete a reference",
|
|
327
|
+
"method": "DELETE",
|
|
328
|
+
"path": "/repos/{owner}/{repo}/git/refs/{ref}",
|
|
329
|
+
"deleteSendsJsonBody": false,
|
|
330
|
+
"inputSchema": {
|
|
331
|
+
"type": "object",
|
|
332
|
+
"properties": {
|
|
333
|
+
"owner": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
336
|
+
},
|
|
337
|
+
"repo": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
340
|
+
},
|
|
341
|
+
"ref": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"description": "The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation."
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"required": [
|
|
347
|
+
"owner",
|
|
348
|
+
"repo",
|
|
349
|
+
"ref"
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"name": "git_create_tag",
|
|
355
|
+
"description": "Create a tag object",
|
|
356
|
+
"method": "POST",
|
|
357
|
+
"path": "/repos/{owner}/{repo}/git/tags",
|
|
358
|
+
"deleteSendsJsonBody": false,
|
|
359
|
+
"inputSchema": {
|
|
360
|
+
"type": "object",
|
|
361
|
+
"properties": {
|
|
362
|
+
"owner": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
365
|
+
},
|
|
366
|
+
"repo": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
369
|
+
},
|
|
370
|
+
"tag": {
|
|
371
|
+
"type": "string",
|
|
372
|
+
"description": "The tag's name. This is typically a version (e.g., \"v0.0.1\")."
|
|
373
|
+
},
|
|
374
|
+
"message": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"description": "The tag message."
|
|
377
|
+
},
|
|
378
|
+
"object": {
|
|
379
|
+
"type": "string",
|
|
380
|
+
"description": "The SHA of the git object this is tagging."
|
|
381
|
+
},
|
|
382
|
+
"type": {
|
|
383
|
+
"type": "string",
|
|
384
|
+
"description": "The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`.",
|
|
385
|
+
"enum": [
|
|
386
|
+
"commit",
|
|
387
|
+
"tree",
|
|
388
|
+
"blob"
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"tagger": {
|
|
392
|
+
"type": "object",
|
|
393
|
+
"description": "An object with information about the individual creating the tag."
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
"required": [
|
|
397
|
+
"owner",
|
|
398
|
+
"repo",
|
|
399
|
+
"tag",
|
|
400
|
+
"message",
|
|
401
|
+
"object",
|
|
402
|
+
"type"
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "git_get_tag",
|
|
408
|
+
"description": "Get a tag",
|
|
409
|
+
"method": "GET",
|
|
410
|
+
"path": "/repos/{owner}/{repo}/git/tags/{tag_sha}",
|
|
411
|
+
"deleteSendsJsonBody": false,
|
|
412
|
+
"inputSchema": {
|
|
413
|
+
"type": "object",
|
|
414
|
+
"properties": {
|
|
415
|
+
"owner": {
|
|
416
|
+
"type": "string",
|
|
417
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
418
|
+
},
|
|
419
|
+
"repo": {
|
|
420
|
+
"type": "string",
|
|
421
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
422
|
+
},
|
|
423
|
+
"tag_sha": {
|
|
424
|
+
"type": "string",
|
|
425
|
+
"description": "The tag_sha parameter"
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"required": [
|
|
429
|
+
"owner",
|
|
430
|
+
"repo",
|
|
431
|
+
"tag_sha"
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "git_create_tree",
|
|
437
|
+
"description": "Create a tree",
|
|
438
|
+
"method": "POST",
|
|
439
|
+
"path": "/repos/{owner}/{repo}/git/trees",
|
|
440
|
+
"deleteSendsJsonBody": false,
|
|
441
|
+
"inputSchema": {
|
|
442
|
+
"type": "object",
|
|
443
|
+
"properties": {
|
|
444
|
+
"owner": {
|
|
445
|
+
"type": "string",
|
|
446
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
447
|
+
},
|
|
448
|
+
"repo": {
|
|
449
|
+
"type": "string",
|
|
450
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
451
|
+
},
|
|
452
|
+
"tree": {
|
|
453
|
+
"type": "array",
|
|
454
|
+
"description": "Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure."
|
|
455
|
+
},
|
|
456
|
+
"base_tree": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"description": "The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by `base_tree` and entries defined in the `tree` parameter. Entries defined in the `tree` parameter will overwrite items from `base_tree` with the same `path`. If you're creating new changes on a branch, then normally you'd set `base_tree` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on.\nIf not provided, GitHub will create a new Git tree object from only the entries defined in the `tree` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the `tree` parameter will be listed as deleted by the new commit."
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"required": [
|
|
462
|
+
"owner",
|
|
463
|
+
"repo",
|
|
464
|
+
"tree"
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "git_get_tree",
|
|
470
|
+
"description": "Get a tree",
|
|
471
|
+
"method": "GET",
|
|
472
|
+
"path": "/repos/{owner}/{repo}/git/trees/{tree_sha}",
|
|
473
|
+
"deleteSendsJsonBody": false,
|
|
474
|
+
"inputSchema": {
|
|
475
|
+
"type": "object",
|
|
476
|
+
"properties": {
|
|
477
|
+
"owner": {
|
|
478
|
+
"type": "string",
|
|
479
|
+
"description": "The account owner of the repository. The name is not case sensitive."
|
|
480
|
+
},
|
|
481
|
+
"repo": {
|
|
482
|
+
"type": "string",
|
|
483
|
+
"description": "The name of the repository without the `.git` extension. The name is not case sensitive."
|
|
484
|
+
},
|
|
485
|
+
"tree_sha": {
|
|
486
|
+
"type": "string",
|
|
487
|
+
"description": "The SHA1 value or ref (branch or tag) name of the tree."
|
|
488
|
+
},
|
|
489
|
+
"recursive": {
|
|
490
|
+
"type": "string",
|
|
491
|
+
"description": "Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in `:tree_sha`. For example, setting `recursive` to any of the following will enable returning objects or subtrees: `0`, `1`, `\"true\"`, and `\"false\"`. Omit this parameter to prevent recursively returning objects or subtrees."
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
"required": [
|
|
495
|
+
"owner",
|
|
496
|
+
"repo",
|
|
497
|
+
"tree_sha"
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
];
|
|
502
|
+
|
|
503
|
+
export const tools = ENDPOINTS.map((e) => ({
|
|
504
|
+
name: e.name,
|
|
505
|
+
description: e.description,
|
|
506
|
+
method: e.method,
|
|
507
|
+
path: e.path,
|
|
508
|
+
deleteSendsJsonBody: Boolean(e.deleteSendsJsonBody),
|
|
509
|
+
inputSchema: e.inputSchema,
|
|
510
|
+
handler: async (params) => ({
|
|
511
|
+
content: [{ type: 'text', text: JSON.stringify(await apiRequest(e.method, e.path, params, { deleteSendsJsonBody: e.deleteSendsJsonBody }), null, 2) }],
|
|
512
|
+
}),
|
|
513
|
+
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { saveCredentials, getCredentials } from '../../core/auth-manager.js';
|
|
2
|
+
import readline from 'readline';
|
|
3
|
+
|
|
4
|
+
const APP_ID = 'github-issues';
|
|
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 Issues 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 Issues');
|
|
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-issues-mcp --client cursor');
|
|
51
|
+
}
|
|
52
|
+
return { Authorization: 'Bearer ' + token };
|
|
53
|
+
}
|