@ainote/mcp 1.3.2 → 1.3.3
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/LICENSE +20 -20
- package/README-ko.md +374 -374
- package/README.md +800 -800
- package/index.js +61 -61
- package/lib/auth/device-flow.js +285 -274
- package/lib/auth/mcp-key.js +40 -40
- package/lib/auth/oauth.js +18 -18
- package/lib/auth/refresh.js +78 -78
- package/lib/auth/strategy-factory.js +31 -31
- package/lib/auth/token-store.js +302 -286
- package/lib/cli/call.js +211 -211
- package/lib/cli/login.js +238 -238
- package/lib/cli/logout.js +39 -39
- package/lib/cli/signup.js +118 -118
- package/lib/cli/whoami.js +77 -77
- package/lib/core/api-client.js +1 -1
- package/lib/core/config-manager.js +106 -106
- package/lib/core/config.js +1 -1
- package/lib/core/mcp-server.js +2 -2
- package/lib/core/server-factory.js +82 -82
- package/lib/core/tool-registry.js +31 -31
- package/lib/tools/chatgpt-tools.js +93 -93
- package/lib/tools/dev-doc-tools.js +643 -643
- package/lib/tools/index.js +5 -5
- package/lib/tools/internal/claude-scanner.js +150 -150
- package/lib/tools/internal/encryption.js +88 -88
- package/lib/tools/internal/formatters.js +80 -80
- package/lib/tools/internal/keychain.js +98 -98
- package/lib/tools/internal/path-mapper.js +221 -221
- package/lib/tools/onboarding-tools.js +124 -124
- package/lib/tools/shared-tools.js +280 -280
- package/lib/utils/api-client.js +152 -152
- package/package.json +101 -101
- package/server.js +99 -99
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { getConfig } from '../core/config-manager.js';
|
|
3
|
-
import { toErrorContent } from './internal/formatters.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Onboarding tools for signup/login without API key.
|
|
7
|
-
* These tools call the Rails API directly (no auth headers).
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
function signupDefinition() {
|
|
11
|
-
return {
|
|
12
|
-
name: 'signup_and_get_key',
|
|
13
|
-
description: `Create a new AI Note account and get an MCP API key. No authentication required.
|
|
14
|
-
Use this if you don't have an account yet. After getting the key, add it to your MCP config and restart.`,
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
email: { type: 'string', description: 'Email address for the new account' },
|
|
19
|
-
password: { type: 'string', description: 'Password (minimum 6 characters)' },
|
|
20
|
-
name: { type: 'string', description: 'Display name (optional)' }
|
|
21
|
-
},
|
|
22
|
-
required: ['email', 'password']
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function loginDefinition() {
|
|
28
|
-
return {
|
|
29
|
-
name: 'login_and_get_key',
|
|
30
|
-
description: `Log in to an existing AI Note account and get an MCP API key. No authentication required.
|
|
31
|
-
Use this if you already have an account but need your MCP key.`,
|
|
32
|
-
inputSchema: {
|
|
33
|
-
type: 'object',
|
|
34
|
-
properties: {
|
|
35
|
-
email: { type: 'string', description: 'Your account email address' },
|
|
36
|
-
password: { type: 'string', description: 'Your account password' }
|
|
37
|
-
},
|
|
38
|
-
required: ['email', 'password']
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function setupGuideDefinition() {
|
|
44
|
-
return {
|
|
45
|
-
name: 'get_setup_guide',
|
|
46
|
-
description: 'Get instructions for setting up AI Note MCP in Claude Desktop, Cursor, or other MCP clients. Includes CLI signup method (npx @ainote/mcp signup). No authentication required.',
|
|
47
|
-
inputSchema: {
|
|
48
|
-
type: 'object',
|
|
49
|
-
properties: {}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Call Rails MCP API directly without auth headers (for onboarding tools).
|
|
56
|
-
*/
|
|
57
|
-
async function callOnboardingTool(toolName, args = {}) {
|
|
58
|
-
const config = getConfig();
|
|
59
|
-
const rpcRequest = {
|
|
60
|
-
jsonrpc: '2.0',
|
|
61
|
-
id: Date.now(),
|
|
62
|
-
method: 'tools/call',
|
|
63
|
-
params: { name: toolName, arguments: args }
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const response = await axios.post(`${config.api.url}/api/mcp`, rpcRequest, {
|
|
67
|
-
headers: { 'Content-Type': 'application/json' },
|
|
68
|
-
timeout: 30000
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (response.data?.data?.error) {
|
|
72
|
-
const err = response.data.data.error;
|
|
73
|
-
throw new Error(err.message || 'Onboarding tool call failed');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Rails wraps in { success: true, data: { jsonrpc, id, result } }
|
|
77
|
-
const rpcResult = response.data?.data?.result;
|
|
78
|
-
if (rpcResult) {
|
|
79
|
-
return rpcResult;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Fallback: return the raw response content
|
|
83
|
-
return {
|
|
84
|
-
content: [{
|
|
85
|
-
type: 'text',
|
|
86
|
-
text: JSON.stringify(response.data, null, 2)
|
|
87
|
-
}]
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function getOnboardingTools() {
|
|
92
|
-
return [
|
|
93
|
-
{
|
|
94
|
-
definition: signupDefinition(),
|
|
95
|
-
handler: async (args) => {
|
|
96
|
-
try {
|
|
97
|
-
return await callOnboardingTool('signup_and_get_key', args);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
return toErrorContent(error);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
definition: loginDefinition(),
|
|
105
|
-
handler: async (args) => {
|
|
106
|
-
try {
|
|
107
|
-
return await callOnboardingTool('login_and_get_key', args);
|
|
108
|
-
} catch (error) {
|
|
109
|
-
return toErrorContent(error);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
definition: setupGuideDefinition(),
|
|
115
|
-
handler: async () => {
|
|
116
|
-
try {
|
|
117
|
-
return await callOnboardingTool('get_setup_guide');
|
|
118
|
-
} catch (error) {
|
|
119
|
-
return toErrorContent(error);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
];
|
|
124
|
-
}
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getConfig } from '../core/config-manager.js';
|
|
3
|
+
import { toErrorContent } from './internal/formatters.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Onboarding tools for signup/login without API key.
|
|
7
|
+
* These tools call the Rails API directly (no auth headers).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
function signupDefinition() {
|
|
11
|
+
return {
|
|
12
|
+
name: 'signup_and_get_key',
|
|
13
|
+
description: `Create a new AI Note account and get an MCP API key. No authentication required.
|
|
14
|
+
Use this if you don't have an account yet. After getting the key, add it to your MCP config and restart.`,
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
email: { type: 'string', description: 'Email address for the new account' },
|
|
19
|
+
password: { type: 'string', description: 'Password (minimum 6 characters)' },
|
|
20
|
+
name: { type: 'string', description: 'Display name (optional)' }
|
|
21
|
+
},
|
|
22
|
+
required: ['email', 'password']
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function loginDefinition() {
|
|
28
|
+
return {
|
|
29
|
+
name: 'login_and_get_key',
|
|
30
|
+
description: `Log in to an existing AI Note account and get an MCP API key. No authentication required.
|
|
31
|
+
Use this if you already have an account but need your MCP key.`,
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
email: { type: 'string', description: 'Your account email address' },
|
|
36
|
+
password: { type: 'string', description: 'Your account password' }
|
|
37
|
+
},
|
|
38
|
+
required: ['email', 'password']
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function setupGuideDefinition() {
|
|
44
|
+
return {
|
|
45
|
+
name: 'get_setup_guide',
|
|
46
|
+
description: 'Get instructions for setting up AI Note MCP in Claude Desktop, Cursor, or other MCP clients. Includes CLI signup method (npx @ainote/mcp signup). No authentication required.',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Call Rails MCP API directly without auth headers (for onboarding tools).
|
|
56
|
+
*/
|
|
57
|
+
async function callOnboardingTool(toolName, args = {}) {
|
|
58
|
+
const config = getConfig();
|
|
59
|
+
const rpcRequest = {
|
|
60
|
+
jsonrpc: '2.0',
|
|
61
|
+
id: Date.now(),
|
|
62
|
+
method: 'tools/call',
|
|
63
|
+
params: { name: toolName, arguments: args }
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const response = await axios.post(`${config.api.url}/api/mcp`, rpcRequest, {
|
|
67
|
+
headers: { 'Content-Type': 'application/json' },
|
|
68
|
+
timeout: 30000
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (response.data?.data?.error) {
|
|
72
|
+
const err = response.data.data.error;
|
|
73
|
+
throw new Error(err.message || 'Onboarding tool call failed');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Rails wraps in { success: true, data: { jsonrpc, id, result } }
|
|
77
|
+
const rpcResult = response.data?.data?.result;
|
|
78
|
+
if (rpcResult) {
|
|
79
|
+
return rpcResult;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Fallback: return the raw response content
|
|
83
|
+
return {
|
|
84
|
+
content: [{
|
|
85
|
+
type: 'text',
|
|
86
|
+
text: JSON.stringify(response.data, null, 2)
|
|
87
|
+
}]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function getOnboardingTools() {
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
definition: signupDefinition(),
|
|
95
|
+
handler: async (args) => {
|
|
96
|
+
try {
|
|
97
|
+
return await callOnboardingTool('signup_and_get_key', args);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
return toErrorContent(error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
definition: loginDefinition(),
|
|
105
|
+
handler: async (args) => {
|
|
106
|
+
try {
|
|
107
|
+
return await callOnboardingTool('login_and_get_key', args);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
return toErrorContent(error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
definition: setupGuideDefinition(),
|
|
115
|
+
handler: async () => {
|
|
116
|
+
try {
|
|
117
|
+
return await callOnboardingTool('get_setup_guide');
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return toErrorContent(error);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
}
|