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,108 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { buildAuthHeaders } from './auth.js';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_BASE_URL = 'https://api.notion.com';
|
|
5
|
+
|
|
6
|
+
function handleError(err) {
|
|
7
|
+
const status = err.response?.status;
|
|
8
|
+
const data = err.response?.data;
|
|
9
|
+
const msg =
|
|
10
|
+
(typeof data?.message === 'string' && data.message) ||
|
|
11
|
+
(typeof data?.code === 'string' && data.code) ||
|
|
12
|
+
err.message;
|
|
13
|
+
|
|
14
|
+
if (status === 401) {
|
|
15
|
+
throw new Error('Token invalid.\nRun: npx adoptai-notion-mcp --client cursor');
|
|
16
|
+
}
|
|
17
|
+
if (status === 403) {
|
|
18
|
+
throw new Error('Insufficient permissions. Check your integration capabilities in Notion.');
|
|
19
|
+
}
|
|
20
|
+
if (status === 404) {
|
|
21
|
+
throw new Error('Resource not found. Check IDs and paths.');
|
|
22
|
+
}
|
|
23
|
+
if (status === 429) {
|
|
24
|
+
throw new Error('Rate limit exceeded. Please wait and try again.');
|
|
25
|
+
}
|
|
26
|
+
throw new Error(msg || 'Notion API request failed');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {object} endpoint - entry from endpoints.json
|
|
31
|
+
* @param {string} baseUrl - root manifest baseUrl
|
|
32
|
+
* @param {Record<string, unknown>} params
|
|
33
|
+
*/
|
|
34
|
+
export async function notionRequest(endpoint, baseUrl, params = {}) {
|
|
35
|
+
const method = String(endpoint.method || 'GET').toUpperCase();
|
|
36
|
+
const root = String(baseUrl || DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
37
|
+
let path = endpoint.path;
|
|
38
|
+
|
|
39
|
+
const p = { ...params };
|
|
40
|
+
const rawBody = p._rawBody;
|
|
41
|
+
delete p._rawBody;
|
|
42
|
+
|
|
43
|
+
const pathKeys = [...path.matchAll(/\{([^}]+)\}/g)].map((m) => m[1]);
|
|
44
|
+
for (const key of pathKeys) {
|
|
45
|
+
const v = p[key];
|
|
46
|
+
if (v === undefined || v === null || v === '') {
|
|
47
|
+
throw new Error(`Missing required path parameter: ${key}`);
|
|
48
|
+
}
|
|
49
|
+
path = path.replace(`{${key}}`, encodeURIComponent(String(v)));
|
|
50
|
+
delete p[key];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const url = root + path;
|
|
54
|
+
const headers = { 'Content-Type': 'application/json', ...buildAuthHeaders() };
|
|
55
|
+
|
|
56
|
+
const isBodyless = method === 'GET' || method === 'DELETE';
|
|
57
|
+
|
|
58
|
+
let data;
|
|
59
|
+
let query = {};
|
|
60
|
+
|
|
61
|
+
if (isBodyless) {
|
|
62
|
+
for (const [k, v] of Object.entries(p)) {
|
|
63
|
+
if (v !== undefined && v !== null && v !== '') {
|
|
64
|
+
query[k] = v;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else if (rawBody !== undefined) {
|
|
68
|
+
data = rawBody;
|
|
69
|
+
} else {
|
|
70
|
+
const body = {};
|
|
71
|
+
for (const [k, v] of Object.entries(p)) {
|
|
72
|
+
if (v !== undefined && v !== null) {
|
|
73
|
+
body[k] = v;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (Object.keys(body).length > 0) {
|
|
77
|
+
data = body;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const res = await axios({
|
|
83
|
+
method,
|
|
84
|
+
url,
|
|
85
|
+
headers,
|
|
86
|
+
params: isBodyless && Object.keys(query).length ? query : undefined,
|
|
87
|
+
data,
|
|
88
|
+
timeout: 60000,
|
|
89
|
+
validateStatus: () => true,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (res.status >= 400) {
|
|
93
|
+
const fake = new Error();
|
|
94
|
+
fake.response = res;
|
|
95
|
+
handleError(fake);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (res.status === 204 || res.data === '' || res.data === undefined) {
|
|
99
|
+
return { ok: true, status: res.status };
|
|
100
|
+
}
|
|
101
|
+
return res.data;
|
|
102
|
+
} catch (err) {
|
|
103
|
+
if (err.response) {
|
|
104
|
+
handleError(err);
|
|
105
|
+
}
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { saveCredentials, getCredentials } from '../../core/auth-manager.js';
|
|
2
|
+
import readline from 'readline';
|
|
3
|
+
|
|
4
|
+
const APP_ID = 'notion';
|
|
5
|
+
|
|
6
|
+
/** API version required by Notion (matches Postman collection `Notion-Version` header). */
|
|
7
|
+
export const NOTION_API_VERSION = '2025-09-03';
|
|
8
|
+
|
|
9
|
+
export async function runAuth() {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
console.log(`
|
|
16
|
+
┌─────────────────────────────────────────────┐
|
|
17
|
+
│ Notion Authentication │
|
|
18
|
+
│ │
|
|
19
|
+
│ Create an integration at │
|
|
20
|
+
│ https://www.notion.so/my-integrations │
|
|
21
|
+
│ and paste the Internal Integration Secret. │
|
|
22
|
+
└─────────────────────────────────────────────┘
|
|
23
|
+
`);
|
|
24
|
+
|
|
25
|
+
const token = await new Promise((resolve) => {
|
|
26
|
+
rl.question('Paste your Notion API token: ', (answer) => {
|
|
27
|
+
rl.close();
|
|
28
|
+
resolve(answer.trim());
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (!token || token.length < 10) {
|
|
33
|
+
throw new Error('Invalid API token');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
saveCredentials(APP_ID, {
|
|
37
|
+
token,
|
|
38
|
+
tokenType: 'bearer',
|
|
39
|
+
expiresAt: null,
|
|
40
|
+
savedAt: new Date().toISOString(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log('✅ API token saved for Notion');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getToken() {
|
|
47
|
+
return getCredentials(APP_ID)?.token || null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function buildAuthHeaders() {
|
|
51
|
+
const token = getToken();
|
|
52
|
+
if (!token) {
|
|
53
|
+
throw new Error('Not authenticated. Run: npx adoptai-notion-mcp --client cursor');
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
Authorization: `Bearer ${token}`,
|
|
57
|
+
'Notion-Version': NOTION_API_VERSION,
|
|
58
|
+
};
|
|
59
|
+
}
|