@memoraone/mcp 0.1.0 → 0.1.1
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/dist/cli.js +0 -0
- package/dist/config.js +9 -8
- package/dist/configUtils.js +13 -0
- package/package.json +7 -11
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as process from 'node:process';
|
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
5
|
import { z } from 'zod/v4';
|
|
6
|
+
import { resolveApiUrl } from './configUtils.js';
|
|
6
7
|
const dotenvPath = path.resolve(process.cwd(), '.env');
|
|
7
8
|
if (fs.existsSync(dotenvPath)) {
|
|
8
9
|
try {
|
|
@@ -14,9 +15,10 @@ if (fs.existsSync(dotenvPath)) {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
const EnvSchema = z.object({
|
|
17
|
-
MEMORAONE_API_URL: z.string().url(),
|
|
18
|
+
MEMORAONE_API_URL: z.string().url().optional(),
|
|
18
19
|
MEMORAONE_PROJECT_ID: z.string().min(1),
|
|
19
20
|
MEMORAONE_API_KEY: z.string().min(1),
|
|
21
|
+
MEMORAONE_DEV_MODE: z.string().min(1).optional(),
|
|
20
22
|
MEMORAONE_AGENT_NAME: z.string().min(1).optional(),
|
|
21
23
|
MEMORAONE_AGENT_TYPE: z.string().min(1).optional(),
|
|
22
24
|
MEMORAONE_SOURCE: z.string().min(1).optional(),
|
|
@@ -24,20 +26,19 @@ const EnvSchema = z.object({
|
|
|
24
26
|
MEMORAONE_HEARTBEAT: z.string().min(1).optional(),
|
|
25
27
|
MEMORAONE_HEARTBEAT_INTERVAL_MS: z.string().min(1).optional(),
|
|
26
28
|
});
|
|
27
|
-
const requiredEnvVars = [
|
|
28
|
-
'MEMORAONE_API_URL',
|
|
29
|
-
'MEMORAONE_PROJECT_ID',
|
|
30
|
-
'MEMORAONE_API_KEY',
|
|
31
|
-
];
|
|
29
|
+
const requiredEnvVars = ['MEMORAONE_API_KEY', 'MEMORAONE_PROJECT_ID'];
|
|
32
30
|
const missingEnvVars = requiredEnvVars.filter((key) => {
|
|
33
31
|
const value = process.env[key];
|
|
34
32
|
return value === undefined || value.trim() === '';
|
|
35
33
|
});
|
|
36
34
|
if (missingEnvVars.length > 0) {
|
|
37
|
-
|
|
35
|
+
for (const key of missingEnvVars) {
|
|
36
|
+
process.stderr.write(`Missing ${key}\n`);
|
|
37
|
+
}
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
const parsed = EnvSchema.safeParse(process.env);
|
|
41
|
+
const resolvedApiUrl = resolveApiUrl(process.env);
|
|
41
42
|
if (!parsed.success) {
|
|
42
43
|
const formatted = parsed.error.format();
|
|
43
44
|
process.stderr.write('[memoraone-mcp] Invalid environment variables ' + JSON.stringify(formatted) + '\n');
|
|
@@ -57,7 +58,7 @@ const parseBooleanFlag = (value, defaultValue) => {
|
|
|
57
58
|
return defaultValue;
|
|
58
59
|
};
|
|
59
60
|
export const config = {
|
|
60
|
-
apiUrl:
|
|
61
|
+
apiUrl: resolvedApiUrl.replace(/\/+$/, ''),
|
|
61
62
|
projectId: parsed.data.MEMORAONE_PROJECT_ID,
|
|
62
63
|
apiKey: parsed.data.MEMORAONE_API_KEY,
|
|
63
64
|
agentName: parsed.data.MEMORAONE_AGENT_NAME ?? 'cursor',
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//packages/mcp/src/configUtils.ts
|
|
2
|
+
export const DEFAULT_API_URL = 'https://api.memoraone.com';
|
|
3
|
+
export const DEV_API_URL = 'http://localhost:3001';
|
|
4
|
+
export function resolveApiUrl(env) {
|
|
5
|
+
const explicitUrl = env.MEMORAONE_API_URL?.trim();
|
|
6
|
+
if (explicitUrl) {
|
|
7
|
+
return explicitUrl;
|
|
8
|
+
}
|
|
9
|
+
if (env.MEMORAONE_DEV_MODE === '1') {
|
|
10
|
+
return DEV_API_URL;
|
|
11
|
+
}
|
|
12
|
+
return DEFAULT_API_URL;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memoraone/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
|
|
6
5
|
"bin": {
|
|
7
|
-
"memoraone-mcp": "
|
|
6
|
+
"memoraone-mcp": "dist/cli.js"
|
|
8
7
|
},
|
|
9
|
-
|
|
10
8
|
"files": [
|
|
11
9
|
"dist",
|
|
12
10
|
"package.json",
|
|
@@ -16,13 +14,6 @@
|
|
|
16
14
|
"publishConfig": {
|
|
17
15
|
"access": "public"
|
|
18
16
|
},
|
|
19
|
-
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc -p tsconfig.json",
|
|
22
|
-
"dev": "tsx src/index.ts",
|
|
23
|
-
"lint": "eslint ."
|
|
24
|
-
},
|
|
25
|
-
|
|
26
17
|
"dependencies": {
|
|
27
18
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
28
19
|
"dotenv": "^16.4.5",
|
|
@@ -31,5 +22,10 @@
|
|
|
31
22
|
},
|
|
32
23
|
"devDependencies": {
|
|
33
24
|
"typescript": "^5.9.2"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"dev": "tsx src/index.ts",
|
|
29
|
+
"lint": "eslint ."
|
|
34
30
|
}
|
|
35
31
|
}
|