{
  "name": "filesync",
  "version": "1.0.0",
  "description": "FileSync MCP Server: 文件管理、回收站、分享。使用前先调用 whoami 查看当前令牌能力边界。",
  "transport": {
    "streamable_http": "https://aistudy.icu/mcp",
    "stdio": true
  },
  "auth": {
    "type": "pat",
    "scheme": "Bearer",
    "description": "创建 PAT 后通过 Authorization: Bearer fsk_\u003ctoken\u003e 访问。PAT 在 Web 控制台『访问令牌』页面生成。"
  },
  "tools": [
    {
      "name": "fs_list",
      "description": "列出目录内容(虚拟目录树)。返回子目录与文件列表。",
      "scopes": [
        "filesync:read"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "目录前缀,空根目录(如 docs/)"
          },
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选,默认我的空间)"
          },
          "recursive": {
            "type": "boolean",
            "description": "true递归列出全部文件,false按目录分层"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_stat",
      "description": "获取文件元信息(大小/哈希/空间/归属)。",
      "scopes": [
        "filesync:read"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "文件 ID(与 path 二选一)"
          },
          "path": {
            "type": "string",
            "description": "文件路径(与 file_id 二选一)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_read",
      "description": "读取文件内容。文本直接返回;二进制或超大文件返回 base64(≤1MB 内联)。",
      "scopes": [
        "filesync:read"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "文件路径"
          },
          "max_size": {
            "type": "integer",
            "description": "最大读取字节(默认 1MB,超大文件建议用 fs_download)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_download",
      "description": "为文件生成 30 分钟有效的下载链接(适合大文件,不内联返回内容)。",
      "scopes": [
        "filesync:read"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "文件路径"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_write",
      "description": "创建文本文件(一步到位,走 REST /api/files/create 同语义)。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "目标文件路径(如 notes/todo.txt)"
          },
          "content": {
            "type": "string",
            "description": "文本内容"
          },
          "overwrite": {
            "type": "boolean",
            "description": "true覆盖已存在文件(默认 false 冲突报错)"
          },
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_upload",
      "description": "上传二进制文件。content_base64(≤50MB) 或 source_url(服务端拉取,≤200MB)。内部聚合 init→chunk→complete 或秒传。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "目标文件路径"
          },
          "content_base64": {
            "type": "string",
            "description": "文件内容 Base64(与 source_url 二选一)"
          },
          "source_url": {
            "type": "string",
            "description": "可公开访问的源文件 URL(服务端拉取,与 content_base64 二选一)"
          },
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_mkdir",
      "description": "创建目录(虚拟目录,写入 .keep 占位)。幂等:已存在则成功。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "目录路径(如 docs/notes/)"
          },
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_rename",
      "description": "重命名文件(同目录内改名,跨目录请用 fs_move)。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "文件 ID(与 path 二选一)"
          },
          "path": {
            "type": "string",
            "description": "原文件路径"
          },
          "new_path": {
            "type": "string",
            "description": "新文件路径(同目录重命名)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_move",
      "description": "批量移动:把 old_prefix 下的所有文件移到 new_prefix(改路径前缀)。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "old_prefix": {
            "type": "string",
            "description": "源目录前缀(如 docs/)"
          },
          "new_prefix": {
            "type": "string",
            "description": "目标目录前缀(如 archive/)"
          },
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_delete",
      "description": "删除文件(软删除移入回收站,30 天保留)。paths 或 file_ids 批量。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "paths": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            },
            "description": "要删除的文件路径列表"
          },
          "file_ids": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            },
            "description": "要删除的文件 ID 列表"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_trash_list",
      "description": "列出回收站中的文件(软删除,30 天保留)。",
      "scopes": [
        "filesync:read"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "space_id": {
            "type": "string",
            "description": "空间 ID(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "fs_trash_restore",
      "description": "从回收站恢复文件。",
      "scopes": [
        "filesync:write"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "回收站中的文件 ID"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "share_create",
      "description": "创建分享链接(文件或目录)。支持访问密码与过期时间。返回可直接交付给用户的绝对 URL。",
      "scopes": [
        "filesync:share"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "文件分享时必填(与 dir_prefix 二选一)"
          },
          "dir_prefix": {
            "type": "string",
            "description": "目录分享时必填(如 docs/)"
          },
          "share_type": {
            "type": "string",
            "description": "file 或 dir"
          },
          "password": {
            "type": "string",
            "description": "访问密码(可选,1-64 字符)"
          },
          "expires_in": {
            "type": "integer",
            "description": "有效期秒(0永久)"
          },
          "space_id": {
            "type": "string",
            "description": "目录分享的目标空间(可选)"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "share_list",
      "description": "列出当前用户(或 token)创建的分享。",
      "scopes": [
        "filesync:share"
      ],
      "input_schema": {
        "type": "object",
        "additionalProperties": false
      }
    },
    {
      "name": "share_delete",
      "description": "删除分享链接。",
      "scopes": [
        "filesync:share"
      ],
      "input_schema": {
        "type": "object",
        "properties": {
          "share_id": {
            "type": "string",
            "description": "分享 ID"
          }
        },
        "additionalProperties": false
      }
    },
    {
      "name": "whoami",
      "description": "返回当前 token 身份、生效 scopes、空间/路径沙箱限制、配额使用情况。Agent 应优先调用以了解能力边界。",
      "input_schema": {
        "type": "object",
        "additionalProperties": false
      }
    }
  ]
}