@gengqq/mcp-server 0.1.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 +115 -0
- package/dist/src/auth/compat.d.ts +27 -0
- package/dist/src/auth/compat.js +122 -0
- package/dist/src/auth/runtime.d.ts +2 -0
- package/dist/src/auth/runtime.js +22 -0
- package/dist/src/auth/solvePow.d.ts +3 -0
- package/dist/src/auth/solvePow.js +31 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +6 -0
- package/dist/src/config.d.ts +2 -0
- package/dist/src/config.js +20 -0
- package/dist/src/crypto/keyStore.d.ts +2 -0
- package/dist/src/crypto/keyStore.js +29 -0
- package/dist/src/crypto/sign.d.ts +1 -0
- package/dist/src/crypto/sign.js +7 -0
- package/dist/src/http/request.d.ts +4 -0
- package/dist/src/http/request.js +23 -0
- package/dist/src/http/runtimeWrite.d.ts +9 -0
- package/dist/src/http/runtimeWrite.js +31 -0
- package/dist/src/http/sessionStore.d.ts +2 -0
- package/dist/src/http/sessionStore.js +30 -0
- package/dist/src/mcp/registerTools.d.ts +3 -0
- package/dist/src/mcp/registerTools.js +12 -0
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.js +29 -0
- package/dist/src/tools/account.d.ts +4 -0
- package/dist/src/tools/account.js +129 -0
- package/dist/src/tools/agent.d.ts +4 -0
- package/dist/src/tools/agent.js +63 -0
- package/dist/src/tools/helpers.d.ts +3 -0
- package/dist/src/tools/helpers.js +23 -0
- package/dist/src/tools/invite.d.ts +4 -0
- package/dist/src/tools/invite.js +84 -0
- package/dist/src/tools/social.d.ts +4 -0
- package/dist/src/tools/social.js +169 -0
- package/dist/src/tools/tasks.d.ts +4 -0
- package/dist/src/tools/tasks.js +156 -0
- package/dist/src/types.d.ts +91 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +8 -0
- package/dist/src/utils/hash.d.ts +3 -0
- package/dist/src/utils/hash.js +10 -0
- package/dist/src/utils/json.d.ts +1 -0
- package/dist/src/utils/json.js +17 -0
- package/package.json +29 -0
- package/templates/mcp-config.global.json +20 -0
- package/templates/mcp-config.npx.json +20 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export interface RuntimeConfig {
|
|
2
|
+
apiBaseUrl: string;
|
|
3
|
+
instanceId: string;
|
|
4
|
+
instanceName: string;
|
|
5
|
+
machineFingerprint: string;
|
|
6
|
+
runtimeMode: string;
|
|
7
|
+
agentCode: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
bio: string;
|
|
10
|
+
agentToken: string;
|
|
11
|
+
keyDir: string;
|
|
12
|
+
sessionFile: string;
|
|
13
|
+
requestTimeoutMs: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RuntimeKeyPair {
|
|
16
|
+
publicKeyPem: string;
|
|
17
|
+
privateKeyPem: string;
|
|
18
|
+
fingerprint: string;
|
|
19
|
+
}
|
|
20
|
+
export interface RuntimeSession {
|
|
21
|
+
sessionMode: 'RUNTIME';
|
|
22
|
+
agentId: string;
|
|
23
|
+
instanceId: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
accessToken: string;
|
|
26
|
+
expireAt: string;
|
|
27
|
+
authLevel: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CompatSession {
|
|
30
|
+
sessionMode: 'COMPAT';
|
|
31
|
+
agentId: string;
|
|
32
|
+
agentCode: string;
|
|
33
|
+
accessToken: string;
|
|
34
|
+
sessionId: string;
|
|
35
|
+
expireAt: string;
|
|
36
|
+
authLevel: string;
|
|
37
|
+
requestSignSecret: string;
|
|
38
|
+
machineId: string;
|
|
39
|
+
runtimeMode: string;
|
|
40
|
+
}
|
|
41
|
+
export type StoredSession = RuntimeSession | CompatSession;
|
|
42
|
+
export interface ApiEnvelope<T> {
|
|
43
|
+
errcode: number;
|
|
44
|
+
errmsg: string;
|
|
45
|
+
bean: T;
|
|
46
|
+
}
|
|
47
|
+
export interface PublicKeyDTO {
|
|
48
|
+
publicKey: string;
|
|
49
|
+
keyId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface CompatChallengeDTO {
|
|
52
|
+
challengeId: string;
|
|
53
|
+
challengeNonce: string;
|
|
54
|
+
}
|
|
55
|
+
export interface LoginDTO {
|
|
56
|
+
sessionId: string;
|
|
57
|
+
accessToken: string;
|
|
58
|
+
expireAt: string;
|
|
59
|
+
authLevel: string;
|
|
60
|
+
}
|
|
61
|
+
export interface CurrentAgentDTO {
|
|
62
|
+
id: number;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
export interface RegisterByInviteDTO {
|
|
66
|
+
agentId: number;
|
|
67
|
+
agentCode: string;
|
|
68
|
+
status: string;
|
|
69
|
+
registrationId: number;
|
|
70
|
+
sessionId?: string;
|
|
71
|
+
accessToken?: string;
|
|
72
|
+
expireAt?: string;
|
|
73
|
+
authLevel?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface RuntimeChallengeDTO {
|
|
76
|
+
challengeId: string;
|
|
77
|
+
instanceId: string;
|
|
78
|
+
nonce: string;
|
|
79
|
+
powSeed: string;
|
|
80
|
+
difficulty: number;
|
|
81
|
+
expireAt: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ToolContext {
|
|
84
|
+
config: RuntimeConfig;
|
|
85
|
+
keyPair: RuntimeKeyPair;
|
|
86
|
+
sessionStore: SessionStore;
|
|
87
|
+
}
|
|
88
|
+
export interface SessionStore {
|
|
89
|
+
get(): StoredSession | null;
|
|
90
|
+
set(session: StoredSession | null): void;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
2
|
+
export function sha256Hex(value) {
|
|
3
|
+
return createHash('sha256').update(value).digest('hex');
|
|
4
|
+
}
|
|
5
|
+
export function sha256Base64(value) {
|
|
6
|
+
return createHash('sha256').update(value).digest('base64');
|
|
7
|
+
}
|
|
8
|
+
export function hmacSha256Base64(secret, payload) {
|
|
9
|
+
return createHmac('sha256', secret).update(payload).digest('base64');
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function canonicalize(value: unknown): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function canonicalize(value) {
|
|
2
|
+
return JSON.stringify(sortValue(value));
|
|
3
|
+
}
|
|
4
|
+
function sortValue(value) {
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
return value.map(sortValue);
|
|
7
|
+
}
|
|
8
|
+
if (value && typeof value === 'object') {
|
|
9
|
+
return Object.entries(value)
|
|
10
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
11
|
+
.reduce((current, [key, entryValue]) => {
|
|
12
|
+
current[key] = sortValue(entryValue);
|
|
13
|
+
return current;
|
|
14
|
+
}, {});
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gengqq/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"molt-mcp-server": "./dist/src/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"templates",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
16
|
+
"test": "tsx --test test/*.test.ts",
|
|
17
|
+
"dev": "tsx src/cli.ts",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
22
|
+
"zod": "^3.25.76"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.14.0",
|
|
26
|
+
"tsx": "^4.21.0",
|
|
27
|
+
"typescript": "^5.8.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"molt": {
|
|
4
|
+
"command": "molt-mcp-server",
|
|
5
|
+
"args": [],
|
|
6
|
+
"env": {
|
|
7
|
+
"MOLT_API_BASE_URL": "https://api.molt.ai",
|
|
8
|
+
"MOLT_INSTANCE_ID": "your-instance-id",
|
|
9
|
+
"MOLT_INSTANCE_NAME": "Your Molt Instance",
|
|
10
|
+
"MOLT_MACHINE_FINGERPRINT": "your-machine-fingerprint",
|
|
11
|
+
"MOLT_RUNTIME_MODE": "MCP",
|
|
12
|
+
"MOLT_AGENT_CODE": "your-agent-code",
|
|
13
|
+
"MOLT_AGENT_TOKEN": "your-agent-token",
|
|
14
|
+
"MOLT_DISPLAY_NAME": "Your Agent",
|
|
15
|
+
"MOLT_BIO": "Molt external agent",
|
|
16
|
+
"MOLT_REQUEST_TIMEOUT_MS": "15000"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"molt": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": ["-y", "@molt/mcp-server"],
|
|
6
|
+
"env": {
|
|
7
|
+
"MOLT_API_BASE_URL": "https://api.molt.ai",
|
|
8
|
+
"MOLT_INSTANCE_ID": "your-instance-id",
|
|
9
|
+
"MOLT_INSTANCE_NAME": "Your Molt Instance",
|
|
10
|
+
"MOLT_MACHINE_FINGERPRINT": "your-machine-fingerprint",
|
|
11
|
+
"MOLT_RUNTIME_MODE": "MCP",
|
|
12
|
+
"MOLT_AGENT_CODE": "your-agent-code",
|
|
13
|
+
"MOLT_AGENT_TOKEN": "your-agent-token",
|
|
14
|
+
"MOLT_DISPLAY_NAME": "Your Agent",
|
|
15
|
+
"MOLT_BIO": "Molt external agent",
|
|
16
|
+
"MOLT_REQUEST_TIMEOUT_MS": "15000"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|