@bitefoundry/sharepoint 0.1.3 → 0.2.0
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/LICENSE +21 -0
- package/README.md +186 -133
- package/bin/bitefoundry-onedrive.js +4 -0
- package/bin/launch.js +114 -0
- package/bin/sharepoint.js +1 -118
- package/docs/API.md +30 -0
- package/docs/MCP.md +91 -0
- package/docs/NPM.md +50 -15
- package/docs/openapi.yaml +120 -0
- package/package.json +53 -53
- package/scripts/postinstall.mjs +260 -264
- package/bin/od.js +0 -4
- package/bin/onedrive.js +0 -4
- package/bin/sp.js +0 -4
package/docs/MCP.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# `@bitefoundry/sharepoint` MCP Server
|
|
2
|
+
|
|
3
|
+
Start the stdio JSON-RPC 2.0 MCP server:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
sharepoint mcp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Tools (19)
|
|
10
|
+
|
|
11
|
+
1. `whoami`
|
|
12
|
+
2. `list_sites`
|
|
13
|
+
3. `list_drives`
|
|
14
|
+
4. `list_files`
|
|
15
|
+
5. `get_file_info`
|
|
16
|
+
6. `read_text_file`
|
|
17
|
+
7. `download_file` — returns `{ ok, path, file_name, mime_type, size_bytes, is_image }`
|
|
18
|
+
8. `upload_file`
|
|
19
|
+
9. `create_folder`
|
|
20
|
+
10. `move_or_rename_item`
|
|
21
|
+
11. `delete_item` — requires `confirm: true`
|
|
22
|
+
12. `search_files`
|
|
23
|
+
13. `create_share_link`
|
|
24
|
+
14. `list_recent`
|
|
25
|
+
15. `list_shared_with_me`
|
|
26
|
+
16. `list_versions`
|
|
27
|
+
17. `list_items`
|
|
28
|
+
18. `list_columns`
|
|
29
|
+
19. `update_list_item_field`
|
|
30
|
+
|
|
31
|
+
## File reads
|
|
32
|
+
|
|
33
|
+
Pass `compact: true` to `list_files` or `get_file_info` to receive `drive_id`,
|
|
34
|
+
`id`, `name`, `is_folder`, `size`, and `last_modified_at` for each item.
|
|
35
|
+
`list_files` returns the drive as `{ "id": "…" }` and `get_file_info` adds
|
|
36
|
+
`e_tag` to the item. `limit` on `list_files` caps the number of items. The compact
|
|
37
|
+
object appears in both `structuredContent` and the JSON text.
|
|
38
|
+
|
|
39
|
+
`read_text_file` decodes UTF-8 with an optional BOM and UTF-16LE or UTF-16BE
|
|
40
|
+
with a BOM. It preserves line endings. `max_bytes` defaults to 256 KiB, and
|
|
41
|
+
`max_bytes` and `size_bytes` count the original bytes, including any BOM. Binary
|
|
42
|
+
files can be saved with `download_file`. Malformed text and files above the
|
|
43
|
+
byte limit return `isError: true`.
|
|
44
|
+
|
|
45
|
+
`list_versions` reads the complete history by default. Pass a non-negative
|
|
46
|
+
integer `limit` to cap results and stop requesting pages when the cap is reached.
|
|
47
|
+
An empty history returns `versions: []`. Graph failures return `isError: true`.
|
|
48
|
+
|
|
49
|
+
## Conditional replacement
|
|
50
|
+
|
|
51
|
+
Read the current `e_tag` with `get_file_info`. Pass that value as `if_match`
|
|
52
|
+
along with `item_id` and the replacement content to `upload_file`. You can
|
|
53
|
+
provide `local_path`, `content_base64`, or `content_text` (UTF-8) with a
|
|
54
|
+
`file_name` for inline content. Conditional replacement uses an upload session
|
|
55
|
+
at any file size. If the eTag is stale, `upload_file` reports an error.
|
|
56
|
+
|
|
57
|
+
## SharePoint List rows
|
|
58
|
+
|
|
59
|
+
All three tools take a SharePoint `site_id` and `list_id`. Call `list_columns`
|
|
60
|
+
to find each column's internal `name`, its `display_name`, and its `read_only`
|
|
61
|
+
flag. [Graph column discovery](https://learn.microsoft.com/en-us/graph/api/list-list-columns?view=graph-rest-1.0) · [Column properties](https://learn.microsoft.com/en-us/graph/api/resources/columndefinition?view=graph-rest-1.0)
|
|
62
|
+
|
|
63
|
+
`list_items` follows Graph pages and returns rows with `id`, `e_tag` when
|
|
64
|
+
available, and `fields`. Omit `fields` to expand the default Graph field set,
|
|
65
|
+
or pass an array such as `["ReviewStatus", "Quantity"]` to select those
|
|
66
|
+
internal names. Graph's default expansion can represent lookup fields with
|
|
67
|
+
`LookupId` keys. [Graph list items](https://learn.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0) · [Field values and lookup rules](https://learn.microsoft.com/en-us/graph/api/resources/fieldvalueset?view=graph-rest-1.0)
|
|
68
|
+
|
|
69
|
+
Example arguments for `update_list_item_field`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"site_id": "contoso.sharepoint.com,site-collection-id,web-id",
|
|
74
|
+
"list_id": "list-id",
|
|
75
|
+
"item_id": "17",
|
|
76
|
+
"field": "Complete",
|
|
77
|
+
"value": false,
|
|
78
|
+
"if_match": "\"row-etag\""
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Pass a JSON value that the column accepts. The tool sends one field key and
|
|
83
|
+
returns the requested row ID, field name, Graph's returned field values, and
|
|
84
|
+
the new `e_tag` when Graph supplies it. If the response lacks an eTag, read the
|
|
85
|
+
row again to obtain its current tag. Graph rejects a stale `if_match` with
|
|
86
|
+
`412`. [Graph field update](https://learn.microsoft.com/en-us/graph/api/listitem-update?view=graph-rest-1.0)
|
|
87
|
+
|
|
88
|
+
Graph documents delegated work or school access for these endpoints. Reads
|
|
89
|
+
require `Sites.Read.All` or a supported higher scope, and writes require
|
|
90
|
+
`Sites.ReadWrite.All`. The signed-in user also needs access to the target
|
|
91
|
+
list. [Read permissions](https://learn.microsoft.com/en-us/graph/api/listitem-list?view=graph-rest-1.0#permissions) · [Write permissions](https://learn.microsoft.com/en-us/graph/api/listitem-update?view=graph-rest-1.0#permissions)
|
package/docs/NPM.md
CHANGED
|
@@ -1,15 +1,50 @@
|
|
|
1
|
-
# `@bitefoundry/sharepoint` npm Packaging
|
|
2
|
-
|
|
3
|
-
`@bitefoundry/sharepoint` ships
|
|
4
|
-
|
|
5
|
-
- `sharepoint`
|
|
6
|
-
- `onedrive`
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
# `@bitefoundry/sharepoint` npm Packaging
|
|
2
|
+
|
|
3
|
+
`@bitefoundry/sharepoint` ships one native Rust binary per supported platform (`win32-x64`, `win32-arm64`, `darwin-x64`, `darwin-arm64`, `linux-x64`, `linux-arm64`). A single install provides two commands.
|
|
4
|
+
|
|
5
|
+
- `sharepoint` opens SharePoint sites and document libraries.
|
|
6
|
+
- `bitefoundry-onedrive` opens personal OneDrive.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install -g @bitefoundry/sharepoint
|
|
12
|
+
sharepoint --version
|
|
13
|
+
bitefoundry-onedrive --version
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Run `cargo install --locked --path .` from a source checkout to install both native commands. For a standalone install, extract both executables from the platform archive on the [GitHub releases page](https://github.com/BiteFoundry/sharepoint/releases) and add their directory to `PATH`. Windows adds `.exe` to both names.
|
|
17
|
+
|
|
18
|
+
## Upgrade scripts and MCP clients
|
|
19
|
+
|
|
20
|
+
Update SharePoint scripts that used `sp` and OneDrive scripts that used `od` or `onedrive`.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
# Previous invocation
|
|
24
|
+
sp sites --json
|
|
25
|
+
od ls /Documents --json
|
|
26
|
+
onedrive recent --json
|
|
27
|
+
|
|
28
|
+
# Current invocation
|
|
29
|
+
sharepoint sites --json
|
|
30
|
+
bitefoundry-onedrive ls /Documents --json
|
|
31
|
+
bitefoundry-onedrive recent --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
In a OneDrive MCP configuration, change `{"command":"onedrive","args":["mcp"]}` or `{"command":"od","args":["mcp"]}` to `{"command":"bitefoundry-onedrive","args":["mcp"]}`. For SharePoint, change `{"command":"sp","args":["mcp"]}` to `{"command":"sharepoint","args":["mcp"]}`.
|
|
35
|
+
|
|
36
|
+
If you installed the PowerShell profile launchers, rerun `scripts/install-profile.ps1` and restart the shell. npm removes the previous package's global launchers during an upgrade. If you manually replaced one of its launcher files with another program's launcher, move that file to a separate `PATH` directory before upgrading.
|
|
37
|
+
|
|
38
|
+
For a standalone upgrade, `sharepoint update` and the previous `onedrive update` can replace their current executables in place. To adopt the new OneDrive command name, copy `bitefoundry-onedrive` from the release archive into your `PATH`.
|
|
39
|
+
|
|
40
|
+
## Native launchers
|
|
41
|
+
|
|
42
|
+
On Unix, `scripts/postinstall.mjs` links the platform binary behind both npm commands. On Windows it links or copies the executable and updates the package's npm shims. The native executable selects the mode from its launcher name. When native linking is unavailable, the JavaScript launchers resolve the installed platform package and set the mode before starting the executable.
|
|
43
|
+
|
|
44
|
+
For interactive sign-in and delegated Microsoft Graph scopes, see [Company-managed Microsoft Entra sign-in](../README.md#company-managed-microsoft-entra-sign-in).
|
|
45
|
+
|
|
46
|
+
## Release Verification
|
|
47
|
+
```bash
|
|
48
|
+
node scripts/sync-version.mjs --check
|
|
49
|
+
node scripts/verify-glibc.mjs --self-test
|
|
50
|
+
```
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: "@bitefoundry/sharepoint Local HTTP API"
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
description: Local HTTP JSON API for Microsoft SharePoint & OneDrive (`sharepoint serve`, default port 8790).
|
|
6
|
+
servers:
|
|
7
|
+
- url: http://127.0.0.1:8790
|
|
8
|
+
paths:
|
|
9
|
+
/health:
|
|
10
|
+
get:
|
|
11
|
+
summary: Health check
|
|
12
|
+
responses:
|
|
13
|
+
"200":
|
|
14
|
+
description: Service status
|
|
15
|
+
/openapi.yaml:
|
|
16
|
+
get:
|
|
17
|
+
summary: OpenAPI 3.1 specification
|
|
18
|
+
responses:
|
|
19
|
+
"200":
|
|
20
|
+
description: OpenAPI YAML document
|
|
21
|
+
/v1/whoami:
|
|
22
|
+
get:
|
|
23
|
+
summary: Current Microsoft 365 user and OAuth scope diagnostics
|
|
24
|
+
responses:
|
|
25
|
+
"200":
|
|
26
|
+
description: Identity and scope diagnostics
|
|
27
|
+
/v1/sites:
|
|
28
|
+
get:
|
|
29
|
+
summary: List followed and discovered SharePoint sites
|
|
30
|
+
responses:
|
|
31
|
+
"200":
|
|
32
|
+
description: Sites list
|
|
33
|
+
/v1/drives:
|
|
34
|
+
get:
|
|
35
|
+
summary: List Personal OneDrive and SharePoint document libraries
|
|
36
|
+
responses:
|
|
37
|
+
"200":
|
|
38
|
+
description: Drives list
|
|
39
|
+
/v1/items:
|
|
40
|
+
get:
|
|
41
|
+
summary: List folder items in a OneDrive or SharePoint drive
|
|
42
|
+
responses:
|
|
43
|
+
"200":
|
|
44
|
+
description: Drive items list
|
|
45
|
+
/v1/items/folder:
|
|
46
|
+
post:
|
|
47
|
+
summary: Create a new folder
|
|
48
|
+
responses:
|
|
49
|
+
"200":
|
|
50
|
+
description: Created folder item
|
|
51
|
+
/v1/items/upload:
|
|
52
|
+
post:
|
|
53
|
+
summary: Upload a file (local_path, content_base64, or content_text)
|
|
54
|
+
responses:
|
|
55
|
+
"200":
|
|
56
|
+
description: Uploaded DriveItem
|
|
57
|
+
/v1/items/{id}:
|
|
58
|
+
get:
|
|
59
|
+
summary: Get item metadata
|
|
60
|
+
responses:
|
|
61
|
+
"200":
|
|
62
|
+
description: DriveItem metadata
|
|
63
|
+
patch:
|
|
64
|
+
summary: Rename or move an item
|
|
65
|
+
responses:
|
|
66
|
+
"200":
|
|
67
|
+
description: Updated DriveItem
|
|
68
|
+
delete:
|
|
69
|
+
summary: Delete an item
|
|
70
|
+
responses:
|
|
71
|
+
"200":
|
|
72
|
+
description: Deletion confirmation
|
|
73
|
+
/v1/items/{id}/children:
|
|
74
|
+
get:
|
|
75
|
+
summary: List child items of a folder
|
|
76
|
+
responses:
|
|
77
|
+
"200":
|
|
78
|
+
description: Child DriveItems
|
|
79
|
+
/v1/items/{id}/content:
|
|
80
|
+
get:
|
|
81
|
+
summary: Read text/code file preview up to safe byte cap
|
|
82
|
+
responses:
|
|
83
|
+
"200":
|
|
84
|
+
description: Text content preview
|
|
85
|
+
/v1/items/{id}/versions:
|
|
86
|
+
get:
|
|
87
|
+
summary: List item version history
|
|
88
|
+
responses:
|
|
89
|
+
"200":
|
|
90
|
+
description: Version list
|
|
91
|
+
/v1/items/{id}/share:
|
|
92
|
+
post:
|
|
93
|
+
summary: Create a sharing link
|
|
94
|
+
responses:
|
|
95
|
+
"200":
|
|
96
|
+
description: Share link result
|
|
97
|
+
/v1/recent:
|
|
98
|
+
get:
|
|
99
|
+
summary: List recently accessed OneDrive files
|
|
100
|
+
responses:
|
|
101
|
+
"200":
|
|
102
|
+
description: Recent items
|
|
103
|
+
/v1/shared:
|
|
104
|
+
get:
|
|
105
|
+
summary: List files shared with me
|
|
106
|
+
responses:
|
|
107
|
+
"200":
|
|
108
|
+
description: Shared items
|
|
109
|
+
/v1/search:
|
|
110
|
+
get:
|
|
111
|
+
summary: Search files via SQLite FTS5 and/or Microsoft Graph
|
|
112
|
+
responses:
|
|
113
|
+
"200":
|
|
114
|
+
description: Matching items
|
|
115
|
+
/v1/download:
|
|
116
|
+
post:
|
|
117
|
+
summary: Download a file to local disk
|
|
118
|
+
responses:
|
|
119
|
+
"200":
|
|
120
|
+
description: "{ ok, path, file_name, mime_type, size_bytes, is_image }"
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bitefoundry/sharepoint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Unified Microsoft SharePoint & OneDrive terminal client & AI agent toolkit — Sites, Document Libraries & Personal Files (CLI, TUI, HTTP API, MCP)",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/BiteFoundry/sharepoint.git"
|
|
8
|
-
},
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"bin": {
|
|
11
|
-
"sharepoint": "bin/sharepoint.js",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"bin/
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"docs/
|
|
23
|
-
"README.md"
|
|
24
|
-
],
|
|
25
|
-
"engines": {
|
|
26
|
-
"node": ">=18"
|
|
27
|
-
},
|
|
28
|
-
"keywords": [
|
|
29
|
-
"microsoft-sharepoint",
|
|
30
|
-
"sharepoint",
|
|
31
|
-
"onedrive",
|
|
32
|
-
"microsoft-365",
|
|
33
|
-
"microsoft-graph",
|
|
34
|
-
"document-library",
|
|
35
|
-
"cloud-storage",
|
|
36
|
-
"cli",
|
|
37
|
-
"tui",
|
|
38
|
-
"mcp"
|
|
39
|
-
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"postinstall": "node scripts/postinstall.mjs",
|
|
42
|
-
"sync-version": "node scripts/sync-version.mjs",
|
|
43
|
-
"build:npm": "node scripts/build-npm.mjs"
|
|
44
|
-
},
|
|
45
|
-
"optionalDependencies": {
|
|
46
|
-
"@bitefoundry/sharepoint-win32-x64": "0.
|
|
47
|
-
"@bitefoundry/sharepoint-win32-arm64": "0.
|
|
48
|
-
"@bitefoundry/sharepoint-darwin-x64": "0.
|
|
49
|
-
"@bitefoundry/sharepoint-darwin-arm64": "0.
|
|
50
|
-
"@bitefoundry/sharepoint-linux-x64": "0.
|
|
51
|
-
"@bitefoundry/sharepoint-linux-arm64": "0.
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitefoundry/sharepoint",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Unified Microsoft SharePoint & OneDrive terminal client & AI agent toolkit — Sites, Document Libraries & Personal Files (CLI, TUI, HTTP API, MCP)",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/BiteFoundry/sharepoint.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bin": {
|
|
11
|
+
"sharepoint": "bin/sharepoint.js",
|
|
12
|
+
"bitefoundry-onedrive": "bin/bitefoundry-onedrive.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/sharepoint.js",
|
|
16
|
+
"bin/bitefoundry-onedrive.js",
|
|
17
|
+
"bin/launch.js",
|
|
18
|
+
"scripts/postinstall.mjs",
|
|
19
|
+
"docs/NPM.md",
|
|
20
|
+
"docs/API.md",
|
|
21
|
+
"docs/MCP.md",
|
|
22
|
+
"docs/openapi.yaml",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"microsoft-sharepoint",
|
|
30
|
+
"sharepoint",
|
|
31
|
+
"onedrive",
|
|
32
|
+
"microsoft-365",
|
|
33
|
+
"microsoft-graph",
|
|
34
|
+
"document-library",
|
|
35
|
+
"cloud-storage",
|
|
36
|
+
"cli",
|
|
37
|
+
"tui",
|
|
38
|
+
"mcp"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
42
|
+
"sync-version": "node scripts/sync-version.mjs",
|
|
43
|
+
"build:npm": "node scripts/build-npm.mjs"
|
|
44
|
+
},
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@bitefoundry/sharepoint-win32-x64": "0.2.0",
|
|
47
|
+
"@bitefoundry/sharepoint-win32-arm64": "0.2.0",
|
|
48
|
+
"@bitefoundry/sharepoint-darwin-x64": "0.2.0",
|
|
49
|
+
"@bitefoundry/sharepoint-darwin-arm64": "0.2.0",
|
|
50
|
+
"@bitefoundry/sharepoint-linux-x64": "0.2.0",
|
|
51
|
+
"@bitefoundry/sharepoint-linux-arm64": "0.2.0"
|
|
52
|
+
}
|
|
53
|
+
}
|