Skip to content

Commit adfa1e0

Browse files
committed
add json mcp-server
1 parent ba6dffe commit adfa1e0

15 files changed

Lines changed: 537 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ MCP 协议中有 STDIO 与 SSE 两种传输机制,大致如下:
4141
- firecrawl: [start-mcp-firecrawl](./start-mcp-firecrawl/src)
4242
- agentql: [start-mcp-agentql](./start-mcp-agentql/src)
4343
- Perplexity Ask: [start-mcp-perplexity-ask](./start-mcp-perplexity-ask/src)
44+
- Json: [start-mcp-json](./start-mcp-json/src)
4445

4546
其中有 hello-world 示例:
4647

start-mcp-agentql/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Edition: 3.0.0
22
Type: Project
33
Name: start-mcp-agentql
4-
Version: 0.0.1
4+
Version: 0.0.2
55
Provider:
66
- 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
77
Description: agentql MCP Server
88
HomePage: https://github.com/tinyfish-io/agentql-mcp
99
Tags: #标签详情
1010
- MCP
1111
- Serverless Devs
12-
Category: Others # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
12+
Category: AI工具 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1313
Service: # 使用的服务
1414
函数计算: # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1515
Authorities: #权限描述

start-mcp-amap-maps/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Edition: 3.0.0
22
Type: Project
33
Name: start-mcp-amap-maps
4-
Version: 0.0.7
4+
Version: 0.0.8
55
Provider:
66
- 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
77
Description: MCP Server for the AMap Map API
@@ -10,7 +10,7 @@ Tags: #标签详情
1010
- MCP
1111
- Serverless Devs
1212
- Develop-Fold
13-
Category: Others # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
13+
Category: AI工具 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1414
Service: # 使用的服务
1515
函数计算: # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1616
Authorities: #权限描述

start-mcp-firecrawl/publish.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Edition: 3.0.0
22
Type: Project
33
Name: start-mcp-firecrawl
4-
Version: 0.0.1
4+
Version: 0.0.2
55
Provider:
66
- 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
77
Description: firecrawl-mcp-server MCP Server
88
HomePage: https://github.com/mendableai/firecrawl-mcp-server
99
Tags: #标签详情
1010
- MCP
1111
- Serverless Devs
12-
Category: Others # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
12+
Category: AI工具 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1313
Service: # 使用的服务
1414
函数计算: # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
1515
Authorities: #权限描述

start-mcp-json/README.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
2+
> 注:当前项目为 Serverless Devs 应用,由于应用中会存在需要初始化才可运行的变量(例如应用部署地区、函数名等等),所以**不推荐**直接 Clone 本仓库到本地进行部署或直接复制 s.yaml 使用,**强烈推荐**通过 `s init ${模版名称}` 的方法或应用中心进行初始化,详情可参考[部署 & 体验](#部署--体验)
3+
4+
# start-mcp-json 帮助文档
5+
6+
<description>
7+
8+
JSON MCP Server
9+
10+
</description>
11+
12+
13+
## 资源准备
14+
15+
使用该项目,您需要有开通以下服务并拥有对应权限:
16+
17+
<service>
18+
19+
20+
21+
| 服务/业务 | 权限 | 相关文档 |
22+
| --- | --- | --- |
23+
| 函数计算 | AliyunFCFullAccess | [帮助文档](https://help.aliyun.com/product/2508973.html) [计费文档](https://help.aliyun.com/document_detail/2512928.html) |
24+
25+
</service>
26+
27+
<remark>
28+
29+
30+
31+
</remark>
32+
33+
<disclaimers>
34+
35+
36+
37+
</disclaimers>
38+
39+
## 部署 & 体验
40+
41+
<appcenter>
42+
43+
- :fire: 通过 [云原生应用开发平台 CAP](https://cap.console.aliyun.com/template-detail?template=start-mcp-json)[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://cap.console.aliyun.com/template-detail?template=start-mcp-json) 该应用。
44+
45+
</appcenter>
46+
<deploy>
47+
48+
49+
</deploy>
50+
51+
## 案例介绍
52+
53+
<appdetail id="flushContent">
54+
55+
# JSON MCP Server (@gongrzhe/server-json-mcp@1.0.3)
56+
57+
A JSON Model Context Protocol (MCP) server implementation for querying and manipulating JSON data. This server enables LLMs to interact with JSON data through a set of standardized tools.
58+
59+
60+
## Installation & Usage
61+
62+
```bash
63+
# Using npx with specific version (recommended)
64+
npx @gongrzhe/server-json-mcp@1.0.3
65+
66+
# Install specific version globally
67+
npm install -g @gongrzhe/server-json-mcp@1.0.3
68+
69+
# Run after global installation
70+
server-json-mcp
71+
```
72+
73+
## Components
74+
75+
### Tools
76+
77+
- **query**
78+
- Query JSON data using JSONPath syntax with extended operations
79+
- Input:
80+
- `url` (string): URL of the JSON data source
81+
- `jsonPath` (string): JSONPath expression with optional operations
82+
83+
- **filter**
84+
- Filter JSON data using conditions
85+
- Input:
86+
- `url` (string): URL of the JSON data source
87+
- `jsonPath` (string): Base JSONPath expression
88+
- `condition` (string): Filter condition
89+
90+
### Supported Operations
91+
92+
#### Array Operations
93+
- **Slicing**: `$[0:5]`, `$[-3:]`, `$[1:4]`
94+
- **Sorting**: `$.sort(price)`, `$.sort(-price)`
95+
- **Distinct**: `$.distinct()`
96+
- **Transformations**:
97+
- Map: `$.map(fieldName)`
98+
- Flatten: `$.flatten()`
99+
- Union: `$.union([1,2,3])`
100+
- Intersection: `$.intersection([1,2,3])`
101+
102+
#### String Operations
103+
- **Case**: `$.toLowerCase()`, `$.toUpperCase()`
104+
- **Tests**: `$.startsWith('test')`, `$.endsWith('test')`
105+
- **Search**: `$.contains('test')`, `$.matches('pattern')`
106+
107+
#### Numeric Operations
108+
- **Math**: `$.math(+10)`, `$.pow2()`
109+
- **Rounding**: `$.round()`, `$.floor()`, `$.ceil()`
110+
- **Functions**: `$.abs()`, `$.sqrt()`
111+
112+
#### Date Operations
113+
- **Format**: `$.format('YYYY-MM-DD')`
114+
- **Check**: `$.isToday()`
115+
- **Modify**: `$.add(1, 'days')`
116+
117+
#### Aggregation Operations
118+
- **Group**: `$.groupBy(category)`
119+
- **Stats**: `$.sum(price)`, `$.avg(price)`, `$.min(price)`, `$.max(price)`
120+
121+
## Configuration
122+
123+
### Usage with Claude Desktop
124+
125+
To use this server with the Claude Desktop app, add the following configuration to your `claude_desktop_config.json`:
126+
127+
```json
128+
{
129+
"json": {
130+
"command": "npx",
131+
"args": [
132+
"@gongrzhe/server-json-mcp@1.0.3"
133+
]
134+
}
135+
}
136+
```
137+
138+
Alternatively, you can use the node command directly if you have the package installed:
139+
140+
```json
141+
{
142+
"json": {
143+
"command": "node",
144+
"args": [
145+
"path/to/build/index.js"
146+
]
147+
}
148+
}
149+
```
150+
151+
## Development
152+
153+
### Building from Source
154+
155+
1. Clone the repository
156+
2. Install dependencies:
157+
```bash
158+
npm install
159+
```
160+
3. Build the project:
161+
```bash
162+
npm run build
163+
```
164+
165+
## Notes
166+
167+
1. All JSONPath expressions start with `$` representing the root object
168+
2. Array indices are zero-based
169+
3. String values in operations should be wrapped in quotes
170+
4. Date operations support 'days', 'months', and 'years' units
171+
5. Numeric operations support basic arithmetic operators (+, -, *, /)
172+
173+
## License
174+
175+
MIT
176+
177+
</appdetail>
178+
179+
180+
181+
182+
183+
184+
185+
## 使用流程
186+
187+
<usedetail id="flushContent">
188+
189+
部署完成拿到 URL 后,准备好支持 SSE 的 MCP Client,通过 SSETransport 进行连接。
190+
191+
</usedetail>
192+
193+
194+
195+
196+
197+
198+
199+
200+

start-mcp-json/hook/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
async function preInit(inputObj) {
2+
3+
}
4+
5+
async function postInit(inputObj) {
6+
7+
}
8+
9+
module.exports = {
10+
postInit,
11+
preInit
12+
}

start-mcp-json/publish.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Edition: 3.0.0
2+
Type: Project
3+
Name: start-mcp-json
4+
Version: 0.0.1
5+
Provider:
6+
- 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
7+
Description: JSON MCP Server
8+
HomePage: https://github.com/GongRzhe/JSON-MCP-Server
9+
Tags: #标签详情
10+
- MCP
11+
- Serverless Devs
12+
Category: AI工具 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
13+
Service: # 使用的服务
14+
函数计算: # 取值内容参考:https://api.devsapp.cn/v3/common/args.html
15+
Authorities: #权限描述
16+
- AliyunFCFullAccess # 所需要的权限,例如AliyunFCFullAccess
17+
Organization: 阿里云函数计算(FC) # 所属组织
18+
Effective: Public # 是否公开,取值:Public,Private,Organization
19+
Parameters:
20+
type: object
21+
additionalProperties: false # 不允许增加其他属性
22+
required: # 必填项
23+
- region
24+
- functionName
25+
properties:
26+
region:
27+
title: 地域
28+
type: string
29+
default: cn-hangzhou
30+
description: 创建应用所在的地区
31+
enum:
32+
- cn-beijing
33+
- cn-hangzhou
34+
- cn-shanghai
35+
- cn-shenzhen
36+
- ap-southeast-1
37+
functionName:
38+
title: 函数名
39+
type: string
40+
default: mcp-server-${default-suffix}
41+
pattern: "^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"
42+
description: 应用的函数名称, 只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间

start-mcp-json/src/build.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
start-mcp-server:
2+
default:
3+
languages:
4+
- nodejs20
5+
cache:
6+
paths:
7+
- "~/.npm"
8+
steps:
9+
- run: npm install
10+
path: ./code
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"@gongrzhe/server-json-mcp": "^1.0.3"
4+
}
5+
}

0 commit comments

Comments
 (0)