json-explorer-mcp 1.0.0 → 1.0.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/README.md +64 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,13 +8,19 @@ An MCP (Model Context Protocol) server for efficiently exploring large JSON file
|
|
|
8
8
|
- **Smart truncation** - Large values are automatically summarized
|
|
9
9
|
- **Caching** - Parsed JSON is cached with file modification checks
|
|
10
10
|
- **Schema inference** - Understand structure without reading all data
|
|
11
|
+
- **Schema validation** - Validate data against JSON Schema
|
|
11
12
|
- **Aggregate statistics** - Get counts, distributions, and numeric stats
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
|
-
npm install
|
|
17
|
-
|
|
17
|
+
npm install -g json-explorer-mcp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or use directly with npx:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx json-explorer-mcp
|
|
18
24
|
```
|
|
19
25
|
|
|
20
26
|
## Usage
|
|
@@ -27,8 +33,8 @@ Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/
|
|
|
27
33
|
{
|
|
28
34
|
"mcpServers": {
|
|
29
35
|
"json-explorer": {
|
|
30
|
-
"command": "
|
|
31
|
-
"args": ["
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "json-explorer-mcp"]
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
@@ -42,8 +48,8 @@ Add to `.mcp.json` in your project:
|
|
|
42
48
|
{
|
|
43
49
|
"mcpServers": {
|
|
44
50
|
"json-explorer": {
|
|
45
|
-
"command": "
|
|
46
|
-
"args": ["
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "json-explorer-mcp"]
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
}
|
|
@@ -55,11 +61,12 @@ Add to `.mcp.json` in your project:
|
|
|
55
61
|
|
|
56
62
|
Get an overview of a JSON file including size, structure type, and a depth-limited preview.
|
|
57
63
|
|
|
58
|
-
```
|
|
64
|
+
```typescript
|
|
59
65
|
json_inspect(file: "/path/to/data.json")
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
Returns:
|
|
69
|
+
|
|
63
70
|
```json
|
|
64
71
|
{
|
|
65
72
|
"file": "/path/to/data.json",
|
|
@@ -77,18 +84,19 @@ Returns:
|
|
|
77
84
|
|
|
78
85
|
List all keys (for objects) or indices (for arrays) at a given path with type info and previews.
|
|
79
86
|
|
|
80
|
-
```
|
|
87
|
+
```typescript
|
|
81
88
|
json_keys(file: "/path/to/data.json", path: "$.users")
|
|
82
89
|
```
|
|
83
90
|
|
|
84
91
|
Returns:
|
|
92
|
+
|
|
85
93
|
```json
|
|
86
94
|
{
|
|
87
95
|
"path": "$.users",
|
|
88
96
|
"type": "array",
|
|
89
97
|
"keys": [
|
|
90
|
-
{ "key": "[0]", "type": "object", "preview": "{\"id\": 1,
|
|
91
|
-
{ "key": "[1]", "type": "object", "preview": "{\"id\": 2,
|
|
98
|
+
{ "key": "[0]", "type": "object", "preview": "{\"id\": 1, ...}", "path": "$.users[0]" },
|
|
99
|
+
{ "key": "[1]", "type": "object", "preview": "{\"id\": 2, ...}", "path": "$.users[1]" }
|
|
92
100
|
],
|
|
93
101
|
"totalCount": 1000
|
|
94
102
|
}
|
|
@@ -98,7 +106,7 @@ Returns:
|
|
|
98
106
|
|
|
99
107
|
Retrieve the value at a specific path. Large values are automatically truncated.
|
|
100
108
|
|
|
101
|
-
```
|
|
109
|
+
```typescript
|
|
102
110
|
json_get(file: "/path/to/data.json", path: "$.users[0]")
|
|
103
111
|
```
|
|
104
112
|
|
|
@@ -106,11 +114,12 @@ json_get(file: "/path/to/data.json", path: "$.users[0]")
|
|
|
106
114
|
|
|
107
115
|
Infer the JSON schema/structure at a path. For arrays, samples items to determine the item schema.
|
|
108
116
|
|
|
109
|
-
```
|
|
117
|
+
```typescript
|
|
110
118
|
json_schema(file: "/path/to/data.json", path: "$.users")
|
|
111
119
|
```
|
|
112
120
|
|
|
113
121
|
Returns:
|
|
122
|
+
|
|
114
123
|
```json
|
|
115
124
|
{
|
|
116
125
|
"path": "$.users",
|
|
@@ -128,11 +137,45 @@ Returns:
|
|
|
128
137
|
}
|
|
129
138
|
```
|
|
130
139
|
|
|
140
|
+
### json_validate
|
|
141
|
+
|
|
142
|
+
Validate JSON data against a JSON Schema. Schema can be provided inline or as a path to a schema file.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
json_validate(
|
|
146
|
+
file: "/path/to/data.json",
|
|
147
|
+
schema: { "type": "object", "properties": { "id": { "type": "integer" } }, "required": ["id"] },
|
|
148
|
+
path: "$.users[0]"
|
|
149
|
+
)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Or with a schema file:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
json_validate(
|
|
156
|
+
file: "/path/to/data.json",
|
|
157
|
+
schema: "/path/to/schema.json"
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"valid": false,
|
|
166
|
+
"errorCount": 2,
|
|
167
|
+
"errors": [
|
|
168
|
+
{ "path": "/id", "message": "must be integer", "keyword": "type", "params": {} },
|
|
169
|
+
{ "path": "", "message": "must have required property 'name'", "keyword": "required", "params": {} }
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
131
174
|
### json_search
|
|
132
175
|
|
|
133
176
|
Search for keys or values matching a pattern (regex supported).
|
|
134
177
|
|
|
135
|
-
```
|
|
178
|
+
```typescript
|
|
136
179
|
json_search(file: "/path/to/data.json", query: "email", searchType: "key")
|
|
137
180
|
json_search(file: "/path/to/data.json", query: "@example.com", searchType: "value")
|
|
138
181
|
```
|
|
@@ -141,7 +184,7 @@ json_search(file: "/path/to/data.json", query: "@example.com", searchType: "valu
|
|
|
141
184
|
|
|
142
185
|
Get sample items from an array. Supports first, last, random, or range-based sampling.
|
|
143
186
|
|
|
144
|
-
```
|
|
187
|
+
```typescript
|
|
145
188
|
json_sample(file: "/path/to/data.json", path: "$.users", count: 5, mode: "random")
|
|
146
189
|
```
|
|
147
190
|
|
|
@@ -149,16 +192,14 @@ json_sample(file: "/path/to/data.json", path: "$.users", count: 5, mode: "random
|
|
|
149
192
|
|
|
150
193
|
Get aggregate statistics for array fields. If no path provided, discovers and analyzes all arrays of objects in the file.
|
|
151
194
|
|
|
152
|
-
```
|
|
195
|
+
```typescript
|
|
153
196
|
json_stats(file: "/path/to/data.json")
|
|
154
197
|
```
|
|
155
198
|
|
|
156
199
|
Returns:
|
|
200
|
+
|
|
157
201
|
```json
|
|
158
202
|
{
|
|
159
|
-
"arrays": [
|
|
160
|
-
{ "path": "$.users", "length": 1000, "itemType": "object", "fields": ["id", "name", "status"], "fieldCount": 10 }
|
|
161
|
-
],
|
|
162
203
|
"stats": [
|
|
163
204
|
{
|
|
164
205
|
"path": "$.users",
|
|
@@ -173,7 +214,8 @@ Returns:
|
|
|
173
214
|
```
|
|
174
215
|
|
|
175
216
|
With a specific path:
|
|
176
|
-
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
177
219
|
json_stats(file: "/path/to/data.json", path: "$.users", fields: ["status", "created_at"])
|
|
178
220
|
```
|
|
179
221
|
|
|
@@ -197,6 +239,9 @@ npm install
|
|
|
197
239
|
# Build
|
|
198
240
|
npm run build
|
|
199
241
|
|
|
242
|
+
# Run tests
|
|
243
|
+
npm test
|
|
244
|
+
|
|
200
245
|
# Run in development mode
|
|
201
246
|
npm run dev
|
|
202
247
|
```
|