@adminforth/mcp 1.0.4 → 1.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/apiTools.d.ts +10 -3
- package/dist/apiTools.js +206 -22
- package/dist/authSecretStore.d.ts +34 -1
- package/dist/authSecretStore.js +84 -12
- package/dist/custom/McpAuthorize.vue +147 -0
- package/dist/custom/McpSettings.vue +153 -54
- package/dist/custom/instructions.md +6 -0
- package/dist/custom/skills/analyze_data/SKILL.md +19 -0
- package/dist/custom/skills/fetch_data/SKILL.md +31 -0
- package/dist/custom/skills/mutate_data/SKILL.md +48 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +163 -25
- package/dist/inputSchema.d.ts +3 -0
- package/dist/inputSchema.js +63 -0
- package/dist/keyedLock.d.ts +8 -0
- package/dist/keyedLock.js +20 -0
- package/dist/mcpProtocol.d.ts +1 -1
- package/dist/mcpProtocol.js +8 -6
- package/dist/oauth.d.ts +96 -0
- package/dist/oauth.js +263 -0
- package/dist/oauthClientMetadata.d.ts +13 -0
- package/dist/oauthClientMetadata.js +140 -0
- package/dist/oauthEndpoints.d.ts +3 -0
- package/dist/oauthEndpoints.js +126 -0
- package/dist/oauthError.d.ts +9 -0
- package/dist/oauthError.js +11 -0
- package/dist/skills.d.ts +19 -0
- package/dist/skills.js +79 -0
- package/dist/types.d.ts +45 -1
- package/dist/urls.d.ts +13 -0
- package/dist/urls.js +13 -0
- package/package.json +6 -3
package/dist/types.d.ts
CHANGED
|
@@ -8,11 +8,55 @@ export interface McpAuthSecretResourceOptions {
|
|
|
8
8
|
createdAtField: string;
|
|
9
9
|
lastUsedAtField: string;
|
|
10
10
|
lastUsedByAgentField: string;
|
|
11
|
+
readOnlyField: string;
|
|
12
|
+
/**
|
|
13
|
+
* Client ID Metadata Document URL of the MCP client connected through OAuth; empty for personal auth secrets.
|
|
14
|
+
* Setting it enables OAuth sign-in, which also needs adminPanelOrigin. Without it only auth secrets work.
|
|
15
|
+
*/
|
|
16
|
+
oauthClientIdField?: string;
|
|
17
|
+
}
|
|
18
|
+
/** An MCP client allowed to connect through OAuth, as its Client ID Metadata Document describes it. */
|
|
19
|
+
export interface McpOAuthClient {
|
|
20
|
+
clientId: string;
|
|
21
|
+
clientName: string;
|
|
22
|
+
redirectUris: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface McpPageSize {
|
|
25
|
+
/** Rows get_resource_data returns when the client does not pass limit. */
|
|
26
|
+
default: number;
|
|
27
|
+
/** Most rows get_resource_data returns per call; larger limits are capped. */
|
|
28
|
+
max: number;
|
|
11
29
|
}
|
|
12
30
|
export interface PluginOptions extends PluginsCommonOptions {
|
|
13
31
|
authSecretResource: McpAuthSecretResourceOptions;
|
|
14
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Public origin of this AdminForth installation, without the AdminForth baseUrl path, e.g. https://example.com.
|
|
34
|
+
* The MCP server URL shown on the settings page, the OAuth issuer and resource URLs are built from it, so it must
|
|
35
|
+
* be the origin MCP clients connect to. Required with OAuth sign-in; without it the settings page shows the MCP URL
|
|
36
|
+
* of the address it was opened at.
|
|
37
|
+
*/
|
|
15
38
|
adminPanelOrigin?: string;
|
|
39
|
+
/**
|
|
40
|
+
* MCP clients resolved from this list instead of fetching their Client ID Metadata Document, so OAuth can be
|
|
41
|
+
* tried locally without a public https URL. Ignored when NODE_ENV is "production": there every client_id is
|
|
42
|
+
* fetched as a document with SSRF checks. Unlisted client_ids are fetched in development too.
|
|
43
|
+
*/
|
|
44
|
+
devOAuthClients?: McpOAuthClient[];
|
|
45
|
+
/** Page size limits for get_resource_data, also quoted in the MCP instructions and skills. Defaults to 10 and 100. */
|
|
46
|
+
pageSize?: Partial<McpPageSize>;
|
|
47
|
+
/** How long a tool handler may run before the call fails with a timeout error. Defaults to 15000 ms. */
|
|
48
|
+
toolTimeoutMs?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Tool calls an agent may make for one user request before it must ask the user to continue. Defaults to 10.
|
|
51
|
+
* MCP clients do not tell the server where a user request starts, so this is a rule in the MCP instructions,
|
|
52
|
+
* not a server-side limit.
|
|
53
|
+
*/
|
|
54
|
+
toolCallsPerRequest?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Expose only endpoints marked with `agent: { onlyReadsData: true }` to every auth secret.
|
|
57
|
+
* Without it, read-only mode is chosen per auth secret.
|
|
58
|
+
*/
|
|
59
|
+
readOnly?: boolean;
|
|
16
60
|
}
|
|
17
61
|
export interface McpClientInfo {
|
|
18
62
|
client: string;
|
package/dist/urls.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MCP_PATH = "/mcp";
|
|
2
|
+
/** Path prefix of AdminForth API endpoints, e.g. `/admin/adminapi/v1`. */
|
|
3
|
+
export declare function adminApiPrefix(baseUrl: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Public URLs of the plugin, built once from adminPanelOrigin: the settings page, OAuth metadata and the MCP server
|
|
6
|
+
* info must all name the same URL, because OAuth accepts tokens only for the exact MCP resource URL.
|
|
7
|
+
*/
|
|
8
|
+
export interface McpUrls {
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
mcpUrl: string;
|
|
11
|
+
adminPanelUrl: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createMcpUrls(adminPanelOrigin: string, baseUrl: string): McpUrls;
|
package/dist/urls.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const MCP_PATH = '/mcp';
|
|
2
|
+
/** Path prefix of AdminForth API endpoints, e.g. `/admin/adminapi/v1`. */
|
|
3
|
+
export function adminApiPrefix(baseUrl) {
|
|
4
|
+
return `${baseUrl}/adminapi/v1`;
|
|
5
|
+
}
|
|
6
|
+
export function createMcpUrls(adminPanelOrigin, baseUrl) {
|
|
7
|
+
const apiUrl = new URL(adminApiPrefix(baseUrl), adminPanelOrigin).href;
|
|
8
|
+
return {
|
|
9
|
+
apiUrl,
|
|
10
|
+
mcpUrl: `${apiUrl}${MCP_PATH}`,
|
|
11
|
+
adminPanelUrl: new URL(baseUrl || '/', adminPanelOrigin).href,
|
|
12
|
+
};
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Expose AdminForth APIs as an authenticated MCP server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "latest",
|
|
44
|
-
"adminforth": "^3.
|
|
44
|
+
"adminforth": "^3.32.0",
|
|
45
45
|
"semantic-release": "^24.2.1",
|
|
46
46
|
"semantic-release-slack-bot": "^4.0.2",
|
|
47
47
|
"typescript": "^5.7.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"adminforth": "^3.
|
|
50
|
+
"adminforth": "^3.32.0"
|
|
51
51
|
},
|
|
52
52
|
"release": {
|
|
53
53
|
"plugins": [
|
|
@@ -73,5 +73,8 @@
|
|
|
73
73
|
"prerelease": true
|
|
74
74
|
}
|
|
75
75
|
]
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"yaml": "^2.9.1"
|
|
76
79
|
}
|
|
77
80
|
}
|