@microlink/mcp 2.1.11 → 2.2.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/package.json +3 -3
- package/src/tools/function.js +3 -2
- package/src/tools/register.js +29 -15
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@microlink/mcp",
|
|
3
3
|
"description": "MCP server for Microlink API",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/microlink",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.2.0",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@microlink/mql": "0.19.0",
|
|
47
47
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
48
|
-
"microlink.io": "0.10.
|
|
48
|
+
"microlink.io": "0.10.3",
|
|
49
49
|
"zod": "~4.4.3"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"type": "module",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "6a9b3891741143671b096d53c0d9e69f6b62cb94"
|
|
70
70
|
}
|
package/src/tools/function.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { functionInputSchema } from '../schemas.js'
|
|
2
|
-
import { register } from './register.js'
|
|
2
|
+
import { INTERACTIVE_ANNOTATIONS, register } from './register.js'
|
|
3
3
|
|
|
4
4
|
export function fn (server) {
|
|
5
5
|
register(
|
|
@@ -12,6 +12,7 @@ export function fn (server) {
|
|
|
12
12
|
'Also returns `isFulfilled`, `profiling`, and `logging`. Mirrors the `microlink.function(url, code)` library method.'
|
|
13
13
|
].join(' '),
|
|
14
14
|
functionInputSchema,
|
|
15
|
-
(client, { url, code, ...options }) => client.function(url, code, options)
|
|
15
|
+
(client, { url, code, ...options }) => client.function(url, code, options),
|
|
16
|
+
INTERACTIVE_ANNOTATIONS
|
|
16
17
|
)
|
|
17
18
|
}
|
package/src/tools/register.js
CHANGED
|
@@ -39,6 +39,20 @@ function getApiKeyFromRequestHeaders (headers) {
|
|
|
39
39
|
return undefined
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// Every tool is a remote read against the Microlink API: it never modifies
|
|
43
|
+
// the caller's environment. `microlink_function` is the exception: it runs
|
|
44
|
+
// caller-supplied code against the live page, so it is not declared read-only.
|
|
45
|
+
const READ_ONLY_ANNOTATIONS = {
|
|
46
|
+
readOnlyHint: true,
|
|
47
|
+
destructiveHint: false,
|
|
48
|
+
openWorldHint: true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const INTERACTIVE_ANNOTATIONS = {
|
|
52
|
+
readOnlyHint: false,
|
|
53
|
+
openWorldHint: true
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
// Common shape: a tool that maps to `client.<method>(url, options)`.
|
|
43
57
|
export function urlMethod (method) {
|
|
44
58
|
return (client, { url, ...options }) => client[method](url, options)
|
|
@@ -57,29 +71,29 @@ export function capabilityMethod (method, key) {
|
|
|
57
71
|
}
|
|
58
72
|
}
|
|
59
73
|
|
|
60
|
-
export function register (
|
|
74
|
+
export function register (
|
|
75
|
+
server,
|
|
76
|
+
name,
|
|
77
|
+
description,
|
|
78
|
+
inputSchema,
|
|
79
|
+
invoke,
|
|
80
|
+
annotations = READ_ONLY_ANNOTATIONS
|
|
81
|
+
) {
|
|
61
82
|
server.registerTool(
|
|
62
83
|
name,
|
|
63
|
-
{ description, inputSchema },
|
|
84
|
+
{ description, inputSchema, annotations },
|
|
64
85
|
async (args, extra) => {
|
|
65
86
|
const parsed = inputSchema.safeParse(args)
|
|
66
87
|
|
|
67
88
|
if (!parsed.success) {
|
|
89
|
+
const payload = {
|
|
90
|
+
message: 'Input validation failed.',
|
|
91
|
+
issues: parsed.error.issues
|
|
92
|
+
}
|
|
68
93
|
return {
|
|
69
94
|
isError: true,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type: 'text',
|
|
73
|
-
text: JSON.stringify(
|
|
74
|
-
{
|
|
75
|
-
message: 'Input validation failed.',
|
|
76
|
-
issues: parsed.error.issues
|
|
77
|
-
},
|
|
78
|
-
null,
|
|
79
|
-
2
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
]
|
|
95
|
+
structuredContent: { error: payload },
|
|
96
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }]
|
|
83
97
|
}
|
|
84
98
|
}
|
|
85
99
|
|