@marsnme/mcp-gateway 0.1.2 → 0.1.4
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/package.json +2 -1
- package/server.mjs +24 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marsnme/mcp-gateway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"mcpName": "io.github.Marsmanleo/marsnme",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Agent-agnostic, LLM-agnostic memory backend for MCP-compatible tools",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/Marsmanleo/MarsNMe.git"
|
|
11
11
|
},
|
|
12
12
|
"author": "Mars Group",
|
|
13
|
+
"homepage": "https://marsnme.com",
|
|
13
14
|
"keywords": [
|
|
14
15
|
"mcp",
|
|
15
16
|
"memory",
|
package/server.mjs
CHANGED
|
@@ -45,15 +45,31 @@ const PROFILE_CONFIGS = {
|
|
|
45
45
|
memoryIngestFixedTags: ['toto', 'insight']
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
const PROFILE_ID_PATTERN = /^[a-z][a-z0-9_-]*$/;
|
|
49
|
+
function buildProfileConfig(profileId) {
|
|
50
|
+
const legacyProfile = PROFILE_CONFIGS[profileId];
|
|
51
|
+
if (legacyProfile) return legacyProfile;
|
|
52
|
+
return {
|
|
53
|
+
...PROFILE_CONFIGS.coco,
|
|
54
|
+
schema: profileId,
|
|
55
|
+
displayName: profileId,
|
|
56
|
+
defaultPort: 18790,
|
|
57
|
+
gatewayDir: `${profileId}-mcp-gateway`,
|
|
58
|
+
publicHostSuffix: `${profileId}-mcp.marsgroup.asia`,
|
|
59
|
+
recallBodyEnum: [profileId, 'system'],
|
|
60
|
+
memoryIngestLegacyToolNames: [],
|
|
61
|
+
memoryIngestDefaultOrigin: `warp-${profileId}`,
|
|
62
|
+
memoryIngestOriginEnum: null,
|
|
63
|
+
memoryIngestFixedTags: [profileId, 'insight']
|
|
64
|
+
};
|
|
65
|
+
}
|
|
48
66
|
const MCP_PROFILE = String(process.env.MCP_PROFILE || 'coco')
|
|
49
67
|
.trim()
|
|
50
68
|
.toLowerCase();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Invalid MCP_PROFILE: ${MCP_PROFILE}. Supported values: ${Object.keys(PROFILE_CONFIGS).join('/')}`
|
|
55
|
-
);
|
|
69
|
+
if (!MCP_PROFILE || !PROFILE_ID_PATTERN.test(MCP_PROFILE)) {
|
|
70
|
+
throw new Error(`Invalid MCP_PROFILE: ${MCP_PROFILE}. Must match ^[a-z][a-z0-9_-]*$`);
|
|
56
71
|
}
|
|
72
|
+
const PROFILE = buildProfileConfig(MCP_PROFILE);
|
|
57
73
|
|
|
58
74
|
const DB_PROFILE = PROFILE.schema;
|
|
59
75
|
const SERVER_NAME = `${PROFILE.schema}-memory-mcp`;
|
|
@@ -135,7 +151,7 @@ function setMemorySourceWhitelist(nextSources) {
|
|
|
135
151
|
}
|
|
136
152
|
setMemorySourceWhitelist(buildMemorySourceListForMode());
|
|
137
153
|
|
|
138
|
-
const PORT = Number.parseInt(process.env.PORT ||
|
|
154
|
+
const PORT = Number.parseInt(process.env.PORT || '18790', 10);
|
|
139
155
|
const SUPABASE_BASE_URL = process.env.SUPABASE_BASE_URL || 'http://127.0.0.1:8100';
|
|
140
156
|
const OAUTH_ENABLED = process.env.MCP_OAUTH_ENABLED !== 'false';
|
|
141
157
|
const REQUIRE_BEARER = process.env.MCP_REQUIRE_BEARER === 'true';
|
|
@@ -174,7 +190,7 @@ const JINA_EMBEDDING_DIMENSIONS_SAFE =
|
|
|
174
190
|
? JINA_EMBEDDING_DIMENSIONS
|
|
175
191
|
: 1024;
|
|
176
192
|
const CHUNK_VISIBILITY_WHITELIST = new Set(['private', 'shared', 'global']);
|
|
177
|
-
const CHUNK_BODY_WHITELIST = new Set(
|
|
193
|
+
const CHUNK_BODY_WHITELIST = new Set(PROFILE.recallBodyEnum);
|
|
178
194
|
const COCO_MEMORY_INGEST_ORIGIN_WHITELIST = new Set([
|
|
179
195
|
'perplexity-coco',
|
|
180
196
|
'cursor-coco',
|
|
@@ -4191,6 +4207,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
4191
4207
|
if (req.method === 'GET' && (url.pathname === '/' || url.pathname === '/health')) {
|
|
4192
4208
|
json(res, 200, {
|
|
4193
4209
|
ok: true,
|
|
4210
|
+
profile: MCP_PROFILE,
|
|
4194
4211
|
name: SERVER_NAME,
|
|
4195
4212
|
transport: 'streamable-http',
|
|
4196
4213
|
endpoint: '/mcp',
|