cos-mcp 1.0.14 → 1.0.15

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.
Files changed (3) hide show
  1. package/README.en.md +34 -0
  2. package/README.md +34 -0
  3. package/package.json +2 -1
package/README.en.md CHANGED
@@ -250,6 +250,40 @@ After completing the above steps, you can run COS MCP Server from the source cod
250
250
 
251
251
  ---
252
252
 
253
+ ## 🔒 Security Guidelines
254
+
255
+ ### Connection Mode Security
256
+
257
+ #### STDIO Mode
258
+ - STDIO mode uses local process communication, limited to local machine calls only. It offers **high security** and is suitable for personal development use.
259
+
260
+ #### SSE Mode
261
+ - SSE mode (`/sse`) serves over HTTP and is **intended for internal network (intranet) deployment**, providing access to team members within a trusted network.
262
+ - ⚠️ **Never expose the `/sse` endpoint directly to the public internet.** Doing so would allow anyone to operate your COS bucket through the interface, leading to potential data leaks or resource abuse.
263
+ - For production or public-facing environments, **developers must implement their own authentication logic on top of this service**, for example:
264
+ - Add authentication middleware at the reverse proxy layer (Nginx / API Gateway)
265
+ - Validate requests using Token, OAuth, API Key, or similar mechanisms
266
+ - Configure IP whitelisting or VPN for network-level access control
267
+
268
+ ### Tool Access Control
269
+
270
+ In SSE mode, the MCP Server exposes all registered tools to connected clients. In team-sharing scenarios, developers are strongly advised to implement **tool-level access control and restrictions** at the application layer:
271
+
272
+ - **Tool Whitelisting**: At the business gateway layer, only allow tools permitted for each user role/permission level. Prevent low-privilege users from executing high-risk operations (e.g., file deletion, batch operations).
273
+ - **Operation Audit & Logging**: Log every tool invocation including the requester identity, call parameters, and execution results for post-incident traceability and security auditing.
274
+ - **Rate Limiting**: Apply rate limiting on tool invocations at the gateway or middleware layer to prevent malicious or accidental resource abuse.
275
+ - **Secondary Confirmation for Sensitive Operations**: For high-risk operations such as file deletion or overwrite, implement a secondary confirmation or approval workflow at the business layer.
276
+ - **Input Parameter Validation**: Validate user-supplied parameters (e.g., file paths, bucket names) at the gateway layer to prevent path traversal or unauthorized access.
277
+
278
+ ### Key Security
279
+
280
+ - **SecretId / SecretKey** are Tencent Cloud API credentials with permissions to operate your cloud resources. Keep them safe at all times.
281
+ - It is recommended to use [sub-account keys](https://cloud.tencent.com/document/product/598/13674) following the **principle of least privilege**, granting only the necessary COS operation permissions.
282
+ - Never hardcode credentials in source code or commit them to public repositories.
283
+ - Manage keys through environment variables (`.env` file) and ensure `.env` is added to `.gitignore`.
284
+
285
+ ---
286
+
253
287
  ## ⚠️ Notes
254
288
 
255
289
  1. If an older version of the package is installed, replace `cos-mcp` with `cos-mcp@latest` in the commands to install the latest version.
package/README.md CHANGED
@@ -250,6 +250,40 @@ npm run build
250
250
 
251
251
  ---
252
252
 
253
+ ## 🔒 安全性说明
254
+
255
+ ### 连接模式安全建议
256
+
257
+ #### STDIO 模式
258
+ - STDIO 模式为本地进程通信,仅限本机调用,**安全性较高**,适合个人开发使用。
259
+
260
+ #### SSE 模式
261
+ - SSE 模式(`/sse`)通过 HTTP 提供服务,**适合内网部署**,开放给团队内部使用。
262
+ - ⚠️ **切勿将 `/sse` 端口直接暴露到公网**,否则任何人都可以通过该接口操作您的 COS 存储桶,造成数据泄露或资源滥用。
263
+ - 如需在生产环境或公网使用,**开发者必须在上层封装自己的业务鉴权逻辑**,例如:
264
+ - 在反向代理(Nginx / API Gateway)层添加鉴权中间件
265
+ - 使用 Token、OAuth、API Key 等机制校验请求合法性
266
+ - 配置 IP 白名单或 VPN 等网络层访问控制
267
+
268
+ ### 工具调用管控
269
+
270
+ SSE 模式下,MCP Server 会将所有已注册的工具(Tool)暴露给连接的客户端。在团队共享场景下,建议开发者根据实际业务需求在上层进行 **工具调用的管控与限制**:
271
+
272
+ - **工具白名单**:在业务网关层按用户角色/权限只放行允许调用的工具,避免低权限用户执行高危操作(如删除文件、批量操作等)。
273
+ - **操作审计与日志**:记录每次工具调用的请求者、调用参数和执行结果,便于事后追溯和安全审计。
274
+ - **调用频率限制**:在网关或中间件层对工具调用设置速率限制(Rate Limiting),防止资源被恶意或意外滥用。
275
+ - **敏感操作二次确认**:对文件删除、覆盖写入等高风险操作,建议在业务层增加二次确认或审批流程。
276
+ - **输入参数校验**:在网关层对用户传入的参数(如文件路径、Bucket 名称等)进行合法性校验,防止路径穿越或越权访问。
277
+
278
+ ### 密钥安全
279
+
280
+ - **SecretId / SecretKey** 是腾讯云 API 密钥,拥有操作您云资源的权限,请务必妥善保管。
281
+ - 建议使用 [子账号密钥](https://cloud.tencent.com/document/product/598/13674) 并遵循 **最小权限原则**,仅授予必要的 COS 操作权限。
282
+ - 禁止将密钥硬编码在代码中或提交到公开仓库。
283
+ - 推荐通过环境变量(`.env` 文件)管理密钥,并将 `.env` 加入 `.gitignore`。
284
+
285
+ ---
286
+
253
287
  ## ⚠️ 注意事项
254
288
 
255
289
  1. 如果安装了旧版本的包,可以将上述内容内 `cos-mcp` 改为 `cos-mcp@latest` 安装最新版包。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cos-mcp",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -15,6 +15,7 @@
15
15
  "start:sse": "npm run build && node ./dist/index.js --connectType=sse",
16
16
  "inspect": "npx @modelcontextprotocol/inspector",
17
17
  "publish:release": "npm run build && npm publish --access public",
18
+ "publish:strict": "npm run build && npm publish --access public --tag strict",
18
19
  "publish:local": "npm run build && npm pack",
19
20
  "format": "prettier --write \"src/**/*.ts\"",
20
21
  "test": "npx jest"