metro-mcp 0.6.0 → 0.6.2
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/bin/metro-mcp.js +23 -27
- package/dist/index.js +23 -27
- package/dist/plugins/navigation.d.ts.map +1 -1
- package/package.json +8 -4
package/dist/bin/metro-mcp.js
CHANGED
|
@@ -3740,9 +3740,9 @@ function extractCDPExceptionMessage(details, fallback = "Evaluation failed") {
|
|
|
3740
3740
|
// package.json
|
|
3741
3741
|
var package_default = {
|
|
3742
3742
|
name: "metro-mcp",
|
|
3743
|
-
version: "0.6.
|
|
3743
|
+
version: "0.6.2",
|
|
3744
3744
|
description: "Plugin-based MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP",
|
|
3745
|
-
homepage: "https://
|
|
3745
|
+
homepage: "https://metromcp.dev",
|
|
3746
3746
|
repository: {
|
|
3747
3747
|
type: "git",
|
|
3748
3748
|
url: "git+https://github.com/steve228uk/metro-mcp.git"
|
|
@@ -3783,7 +3783,10 @@ var package_default = {
|
|
|
3783
3783
|
"build:js": "bun build src/index.ts src/plugin.ts --outdir dist --target node --external @modelcontextprotocol/sdk --external zod --external ws && bun build src/client/index.ts --outfile dist/client/index.js --target browser --external @modelcontextprotocol/sdk --external zod && bun build src/client/index.ts --outfile dist/client/index.cjs --target browser --format cjs --external @modelcontextprotocol/sdk --external zod && bun build src/plugin.ts --outfile dist/plugin.cjs --target node --format cjs --external @modelcontextprotocol/sdk --external zod",
|
|
3784
3784
|
"build:bin": "bun build bin/metro-mcp.ts --outfile dist/bin/metro-mcp.js --target node --external @modelcontextprotocol/sdk --external zod --external ws && chmod +x dist/bin/metro-mcp.js",
|
|
3785
3785
|
"build:types": "bunx tsc -p tsconfig.build.json",
|
|
3786
|
-
typecheck: "tsc --noEmit"
|
|
3786
|
+
typecheck: "tsc --noEmit",
|
|
3787
|
+
"docs:dev": "vitepress dev docs",
|
|
3788
|
+
"docs:build": "vitepress build docs",
|
|
3789
|
+
"docs:preview": "vitepress preview docs"
|
|
3787
3790
|
},
|
|
3788
3791
|
keywords: [
|
|
3789
3792
|
"mcp",
|
|
@@ -3809,7 +3812,8 @@ var package_default = {
|
|
|
3809
3812
|
devDependencies: {
|
|
3810
3813
|
"@types/bun": "^1.2.10",
|
|
3811
3814
|
"@types/ws": "^8.18.1",
|
|
3812
|
-
typescript: "^5.8.3"
|
|
3815
|
+
typescript: "^5.8.3",
|
|
3816
|
+
vitepress: "^1.6.4"
|
|
3813
3817
|
},
|
|
3814
3818
|
engines: {
|
|
3815
3819
|
node: ">=18.0.0"
|
|
@@ -6170,33 +6174,25 @@ var navigationPlugin = definePlugin({
|
|
|
6170
6174
|
return state;
|
|
6171
6175
|
}
|
|
6172
6176
|
});
|
|
6177
|
+
function getFocusedRoute(s) {
|
|
6178
|
+
const routes = s.routes;
|
|
6179
|
+
if (!routes)
|
|
6180
|
+
return null;
|
|
6181
|
+
const idx = s.index !== undefined ? s.index : routes.length - 1;
|
|
6182
|
+
const route = routes[idx];
|
|
6183
|
+
if (route.state && typeof route.state === "object") {
|
|
6184
|
+
return getFocusedRoute(route.state);
|
|
6185
|
+
}
|
|
6186
|
+
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6187
|
+
}
|
|
6173
6188
|
ctx.registerTool("get_current_route", {
|
|
6174
6189
|
description: "Get the currently focused route name and params.",
|
|
6175
6190
|
parameters: z13.object({}),
|
|
6176
6191
|
handler: async () => {
|
|
6177
|
-
const
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
return getState()`)};
|
|
6182
|
-
|
|
6183
|
-
if (!state) return null;
|
|
6184
|
-
|
|
6185
|
-
// Walk to the deepest focused route
|
|
6186
|
-
function getFocusedRoute(s) {
|
|
6187
|
-
if (!s || !s.routes) return null;
|
|
6188
|
-
var idx = s.index !== undefined ? s.index : s.routes.length - 1;
|
|
6189
|
-
var route = s.routes[idx];
|
|
6190
|
-
if (route.state && route.state.routes) {
|
|
6191
|
-
return getFocusedRoute(route.state);
|
|
6192
|
-
}
|
|
6193
|
-
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6194
|
-
}
|
|
6195
|
-
|
|
6196
|
-
return getFocusedRoute(state);
|
|
6197
|
-
})()
|
|
6198
|
-
`;
|
|
6199
|
-
const result = await ctx.evalInApp(expr, { awaitPromise: true });
|
|
6192
|
+
const state = await ctx.evalInApp(GET_NAV_STATE_EXPR, { awaitPromise: true });
|
|
6193
|
+
if (!state || typeof state !== "object")
|
|
6194
|
+
return "No focused route found.";
|
|
6195
|
+
const result = getFocusedRoute(state);
|
|
6200
6196
|
if (!result)
|
|
6201
6197
|
return "No focused route found.";
|
|
6202
6198
|
return result;
|
package/dist/index.js
CHANGED
|
@@ -3748,9 +3748,9 @@ function extractCDPExceptionMessage(details, fallback = "Evaluation failed") {
|
|
|
3748
3748
|
// package.json
|
|
3749
3749
|
var package_default = {
|
|
3750
3750
|
name: "metro-mcp",
|
|
3751
|
-
version: "0.6.
|
|
3751
|
+
version: "0.6.2",
|
|
3752
3752
|
description: "Plugin-based MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP",
|
|
3753
|
-
homepage: "https://
|
|
3753
|
+
homepage: "https://metromcp.dev",
|
|
3754
3754
|
repository: {
|
|
3755
3755
|
type: "git",
|
|
3756
3756
|
url: "git+https://github.com/steve228uk/metro-mcp.git"
|
|
@@ -3791,7 +3791,10 @@ var package_default = {
|
|
|
3791
3791
|
"build:js": "bun build src/index.ts src/plugin.ts --outdir dist --target node --external @modelcontextprotocol/sdk --external zod --external ws && bun build src/client/index.ts --outfile dist/client/index.js --target browser --external @modelcontextprotocol/sdk --external zod && bun build src/client/index.ts --outfile dist/client/index.cjs --target browser --format cjs --external @modelcontextprotocol/sdk --external zod && bun build src/plugin.ts --outfile dist/plugin.cjs --target node --format cjs --external @modelcontextprotocol/sdk --external zod",
|
|
3792
3792
|
"build:bin": "bun build bin/metro-mcp.ts --outfile dist/bin/metro-mcp.js --target node --external @modelcontextprotocol/sdk --external zod --external ws && chmod +x dist/bin/metro-mcp.js",
|
|
3793
3793
|
"build:types": "bunx tsc -p tsconfig.build.json",
|
|
3794
|
-
typecheck: "tsc --noEmit"
|
|
3794
|
+
typecheck: "tsc --noEmit",
|
|
3795
|
+
"docs:dev": "vitepress dev docs",
|
|
3796
|
+
"docs:build": "vitepress build docs",
|
|
3797
|
+
"docs:preview": "vitepress preview docs"
|
|
3795
3798
|
},
|
|
3796
3799
|
keywords: [
|
|
3797
3800
|
"mcp",
|
|
@@ -3817,7 +3820,8 @@ var package_default = {
|
|
|
3817
3820
|
devDependencies: {
|
|
3818
3821
|
"@types/bun": "^1.2.10",
|
|
3819
3822
|
"@types/ws": "^8.18.1",
|
|
3820
|
-
typescript: "^5.8.3"
|
|
3823
|
+
typescript: "^5.8.3",
|
|
3824
|
+
vitepress: "^1.6.4"
|
|
3821
3825
|
},
|
|
3822
3826
|
engines: {
|
|
3823
3827
|
node: ">=18.0.0"
|
|
@@ -6173,33 +6177,25 @@ var navigationPlugin = definePlugin({
|
|
|
6173
6177
|
return state;
|
|
6174
6178
|
}
|
|
6175
6179
|
});
|
|
6180
|
+
function getFocusedRoute(s) {
|
|
6181
|
+
const routes = s.routes;
|
|
6182
|
+
if (!routes)
|
|
6183
|
+
return null;
|
|
6184
|
+
const idx = s.index !== undefined ? s.index : routes.length - 1;
|
|
6185
|
+
const route = routes[idx];
|
|
6186
|
+
if (route.state && typeof route.state === "object") {
|
|
6187
|
+
return getFocusedRoute(route.state);
|
|
6188
|
+
}
|
|
6189
|
+
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6190
|
+
}
|
|
6176
6191
|
ctx.registerTool("get_current_route", {
|
|
6177
6192
|
description: "Get the currently focused route name and params.",
|
|
6178
6193
|
parameters: z13.object({}),
|
|
6179
6194
|
handler: async () => {
|
|
6180
|
-
const
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
return getState()`)};
|
|
6185
|
-
|
|
6186
|
-
if (!state) return null;
|
|
6187
|
-
|
|
6188
|
-
// Walk to the deepest focused route
|
|
6189
|
-
function getFocusedRoute(s) {
|
|
6190
|
-
if (!s || !s.routes) return null;
|
|
6191
|
-
var idx = s.index !== undefined ? s.index : s.routes.length - 1;
|
|
6192
|
-
var route = s.routes[idx];
|
|
6193
|
-
if (route.state && route.state.routes) {
|
|
6194
|
-
return getFocusedRoute(route.state);
|
|
6195
|
-
}
|
|
6196
|
-
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6197
|
-
}
|
|
6198
|
-
|
|
6199
|
-
return getFocusedRoute(state);
|
|
6200
|
-
})()
|
|
6201
|
-
`;
|
|
6202
|
-
const result = await ctx.evalInApp(expr, { awaitPromise: true });
|
|
6195
|
+
const state = await ctx.evalInApp(GET_NAV_STATE_EXPR, { awaitPromise: true });
|
|
6196
|
+
if (!state || typeof state !== "object")
|
|
6197
|
+
return "No focused route found.";
|
|
6198
|
+
const result = getFocusedRoute(state);
|
|
6203
6199
|
if (!result)
|
|
6204
6200
|
return "No focused route found.";
|
|
6205
6201
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,yCA+J3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro-mcp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Plugin-based MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP",
|
|
5
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://metromcp.dev",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/steve228uk/metro-mcp.git"
|
|
@@ -43,7 +43,10 @@
|
|
|
43
43
|
"build:js": "bun build src/index.ts src/plugin.ts --outdir dist --target node --external @modelcontextprotocol/sdk --external zod --external ws && bun build src/client/index.ts --outfile dist/client/index.js --target browser --external @modelcontextprotocol/sdk --external zod && bun build src/client/index.ts --outfile dist/client/index.cjs --target browser --format cjs --external @modelcontextprotocol/sdk --external zod && bun build src/plugin.ts --outfile dist/plugin.cjs --target node --format cjs --external @modelcontextprotocol/sdk --external zod",
|
|
44
44
|
"build:bin": "bun build bin/metro-mcp.ts --outfile dist/bin/metro-mcp.js --target node --external @modelcontextprotocol/sdk --external zod --external ws && chmod +x dist/bin/metro-mcp.js",
|
|
45
45
|
"build:types": "bunx tsc -p tsconfig.build.json",
|
|
46
|
-
"typecheck": "tsc --noEmit"
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"docs:dev": "vitepress dev docs",
|
|
48
|
+
"docs:build": "vitepress build docs",
|
|
49
|
+
"docs:preview": "vitepress preview docs"
|
|
47
50
|
},
|
|
48
51
|
"keywords": [
|
|
49
52
|
"mcp",
|
|
@@ -69,7 +72,8 @@
|
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@types/bun": "^1.2.10",
|
|
71
74
|
"@types/ws": "^8.18.1",
|
|
72
|
-
"typescript": "^5.8.3"
|
|
75
|
+
"typescript": "^5.8.3",
|
|
76
|
+
"vitepress": "^1.6.4"
|
|
73
77
|
},
|
|
74
78
|
"engines": {
|
|
75
79
|
"node": ">=18.0.0"
|