outlook-cli 1.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/CLI.md +89 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +104 -0
- package/README.md +994 -0
- package/auth/index.js +36 -0
- package/auth/oauth-server.js +139 -0
- package/auth/token-manager.js +199 -0
- package/auth/token-storage.js +282 -0
- package/auth/tools.js +127 -0
- package/calendar/accept.js +64 -0
- package/calendar/cancel.js +64 -0
- package/calendar/create.js +69 -0
- package/calendar/decline.js +64 -0
- package/calendar/delete.js +59 -0
- package/calendar/index.js +123 -0
- package/calendar/list.js +77 -0
- package/cli.js +1349 -0
- package/config.js +84 -0
- package/docs/PROJECT-STRUCTURE.md +52 -0
- package/docs/PUBLISHING.md +86 -0
- package/docs/REFERENCE.md +679 -0
- package/email/folder-utils.js +171 -0
- package/email/index.js +157 -0
- package/email/list.js +89 -0
- package/email/mark-as-read.js +101 -0
- package/email/read.js +128 -0
- package/email/search.js +282 -0
- package/email/send.js +120 -0
- package/folder/create.js +124 -0
- package/folder/index.js +78 -0
- package/folder/list.js +264 -0
- package/folder/move.js +163 -0
- package/index.js +136 -0
- package/outlook-auth-server.js +305 -0
- package/package.json +76 -0
- package/rules/create.js +248 -0
- package/rules/index.js +177 -0
- package/rules/list.js +202 -0
- package/tool-registry.js +54 -0
- package/utils/graph-api.js +120 -0
- package/utils/mock-data.js +145 -0
- package/utils/odata-helpers.js +40 -0
package/config.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for Outlook MCP Server
|
|
3
|
+
*/
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const pkg = require('./package.json');
|
|
7
|
+
|
|
8
|
+
require('dotenv').config();
|
|
9
|
+
|
|
10
|
+
function readEnv(...keys) {
|
|
11
|
+
for (const key of keys) {
|
|
12
|
+
const value = process.env[key];
|
|
13
|
+
if (value !== undefined && value !== '') {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readScopes() {
|
|
22
|
+
const rawScopes = readEnv('OUTLOOK_SCOPES', 'MS_SCOPES');
|
|
23
|
+
if (!rawScopes) {
|
|
24
|
+
return [
|
|
25
|
+
'offline_access',
|
|
26
|
+
'Mail.Read',
|
|
27
|
+
'Mail.ReadWrite',
|
|
28
|
+
'Mail.Send',
|
|
29
|
+
'User.Read',
|
|
30
|
+
'Calendars.Read',
|
|
31
|
+
'Calendars.ReadWrite'
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return rawScopes
|
|
36
|
+
.split(/[\s,]+/)
|
|
37
|
+
.map((scope) => scope.trim())
|
|
38
|
+
.filter(Boolean);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Ensure we have a home directory path even if process.env.HOME is undefined
|
|
42
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir() || '/tmp';
|
|
43
|
+
const tokenStorePath = readEnv('OUTLOOK_TOKEN_STORE_PATH', 'MS_TOKEN_STORE_PATH') || path.join(homeDir, '.outlook-mcp-tokens.json');
|
|
44
|
+
const redirectUri = readEnv('OUTLOOK_REDIRECT_URI', 'MS_REDIRECT_URI') || 'http://localhost:3333/auth/callback';
|
|
45
|
+
const authServerUrl = readEnv('OUTLOOK_AUTH_SERVER_URL', 'MS_AUTH_SERVER_URL') || 'http://localhost:3333';
|
|
46
|
+
const tokenEndpoint = readEnv('OUTLOOK_TOKEN_ENDPOINT', 'MS_TOKEN_ENDPOINT') || 'https://login.microsoftonline.com/consumers/oauth2/v2.0/token';
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
// Server information
|
|
50
|
+
SERVER_NAME: "outlook-assistant",
|
|
51
|
+
SERVER_VERSION: pkg.version,
|
|
52
|
+
|
|
53
|
+
// Test mode setting
|
|
54
|
+
USE_TEST_MODE: process.env.USE_TEST_MODE === 'true',
|
|
55
|
+
DEBUG_LOGS: process.env.OUTLOOK_DEBUG === 'true' || process.env.MCP_DEBUG === 'true',
|
|
56
|
+
|
|
57
|
+
// Authentication configuration
|
|
58
|
+
AUTH_CONFIG: {
|
|
59
|
+
clientId: readEnv('OUTLOOK_CLIENT_ID', 'MS_CLIENT_ID'),
|
|
60
|
+
clientSecret: readEnv('OUTLOOK_CLIENT_SECRET', 'MS_CLIENT_SECRET'),
|
|
61
|
+
redirectUri,
|
|
62
|
+
scopes: readScopes(),
|
|
63
|
+
tokenStorePath,
|
|
64
|
+
authServerUrl,
|
|
65
|
+
tokenEndpoint
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// Microsoft Graph API
|
|
69
|
+
GRAPH_API_ENDPOINT: 'https://graph.microsoft.com/v1.0/',
|
|
70
|
+
|
|
71
|
+
// Email constants
|
|
72
|
+
EMAIL_SELECT_FIELDS: 'id,subject,from,toRecipients,ccRecipients,receivedDateTime,bodyPreview,hasAttachments,importance,isRead',
|
|
73
|
+
EMAIL_DETAIL_FIELDS: 'id,subject,from,toRecipients,ccRecipients,bccRecipients,receivedDateTime,bodyPreview,body,hasAttachments,importance,isRead,internetMessageHeaders',
|
|
74
|
+
|
|
75
|
+
// Calendar constants
|
|
76
|
+
CALENDAR_SELECT_FIELDS: 'id,subject,bodyPreview,start,end,location,organizer,attendees,isAllDay,isCancelled',
|
|
77
|
+
|
|
78
|
+
// Pagination
|
|
79
|
+
DEFAULT_PAGE_SIZE: 25,
|
|
80
|
+
MAX_RESULT_COUNT: 50,
|
|
81
|
+
|
|
82
|
+
// Timezone
|
|
83
|
+
DEFAULT_TIMEZONE: "Central European Standard Time",
|
|
84
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
This repository is organized for both runtime clarity and npm publish hygiene.
|
|
4
|
+
|
|
5
|
+
Canonical repository:
|
|
6
|
+
|
|
7
|
+
- https://github.com/selvin-paul-raj/outlook-cli
|
|
8
|
+
|
|
9
|
+
## Runtime directories
|
|
10
|
+
|
|
11
|
+
- `auth/`: token management and auth tools
|
|
12
|
+
- `email/`: email listing, search, read, send, mark-read
|
|
13
|
+
- `calendar/`: event list/create/decline/cancel/delete
|
|
14
|
+
- `folder/`: folder list/create and message move
|
|
15
|
+
- `rules/`: inbox rule list/create/sequence update
|
|
16
|
+
- `utils/`: Graph API and OData helpers
|
|
17
|
+
|
|
18
|
+
## Runtime entry points
|
|
19
|
+
|
|
20
|
+
- `cli.js`: global CLI binary (`outlook-cli`)
|
|
21
|
+
- `index.js`: stdio MCP server entry point
|
|
22
|
+
- `outlook-auth-server.js`: local auth callback server
|
|
23
|
+
- `tool-registry.js`: shared tool registry used by CLI and MCP
|
|
24
|
+
- `config.js`: centralized configuration and env resolution
|
|
25
|
+
|
|
26
|
+
## Documentation layout
|
|
27
|
+
|
|
28
|
+
- `README.md`: package overview and first-run flow
|
|
29
|
+
- `CLI.md`: command quick reference
|
|
30
|
+
- `QUICKSTART.md`: short setup walkthrough
|
|
31
|
+
- `docs/REFERENCE.md`: exhaustive command/tool/parameter reference
|
|
32
|
+
- `docs/PUBLISHING.md`: release and npm publish checklist
|
|
33
|
+
|
|
34
|
+
## Test layout
|
|
35
|
+
|
|
36
|
+
- `test/auth/`: auth and token storage tests
|
|
37
|
+
- `test/calendar/`: calendar operation tests
|
|
38
|
+
|
|
39
|
+
## Packaging strategy (`package.json` -> `files`)
|
|
40
|
+
|
|
41
|
+
The publish tarball includes only runtime code and docs required by users:
|
|
42
|
+
|
|
43
|
+
- runtime modules (`auth`, `email`, `calendar`, `folder`, `rules`, `utils`)
|
|
44
|
+
- entry points (`cli.js`, `index.js`, `outlook-auth-server.js`, `tool-registry.js`, `config.js`)
|
|
45
|
+
- docs (`README.md`, `CLI.md`, `QUICKSTART.md`, `docs/`)
|
|
46
|
+
- `LICENSE`
|
|
47
|
+
|
|
48
|
+
Excluded by design:
|
|
49
|
+
|
|
50
|
+
- tests and local workspace artifacts
|
|
51
|
+
- `.env` files and secrets
|
|
52
|
+
- development-only notes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Publishing Checklist (npm)
|
|
2
|
+
|
|
3
|
+
Canonical repository:
|
|
4
|
+
|
|
5
|
+
- https://github.com/selvin-paul-raj/outlook-cli
|
|
6
|
+
|
|
7
|
+
## 1. Pre-flight
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
npm test
|
|
12
|
+
npm pack --dry-run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Ensure `npm pack --dry-run` includes only intended runtime files and docs.
|
|
16
|
+
|
|
17
|
+
## 2. Versioning
|
|
18
|
+
|
|
19
|
+
Update version based on release type:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm version patch
|
|
23
|
+
# or
|
|
24
|
+
npm version minor
|
|
25
|
+
# or
|
|
26
|
+
npm version major
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 3. Verify package metadata
|
|
30
|
+
|
|
31
|
+
Check in `package.json`:
|
|
32
|
+
|
|
33
|
+
- `name` is correct (`outlook-cli`)
|
|
34
|
+
- `bin` points to `./cli.js`
|
|
35
|
+
- `engines.node` matches supported runtime
|
|
36
|
+
- `files` list contains only publishable content
|
|
37
|
+
- `license` is set
|
|
38
|
+
|
|
39
|
+
## 4. Verify CLI behavior
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
node cli.js --help
|
|
43
|
+
node cli.js commands --json
|
|
44
|
+
node cli.js update --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 5. Publish
|
|
48
|
+
|
|
49
|
+
Login once if needed:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm login
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Publish:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm publish --access public
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 5.1 Push GitHub release metadata
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git push origin main
|
|
65
|
+
git push origin --tags
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then create a GitHub release from the pushed tag in:
|
|
69
|
+
|
|
70
|
+
- https://github.com/selvin-paul-raj/outlook-cli/releases
|
|
71
|
+
|
|
72
|
+
## 6. Post-publish smoke test
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm i -g outlook-cli@latest
|
|
76
|
+
outlook-cli --version
|
|
77
|
+
outlook-cli commands
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 7. Suggested release notes format
|
|
81
|
+
|
|
82
|
+
- New commands and flags
|
|
83
|
+
- Breaking changes
|
|
84
|
+
- Bug fixes
|
|
85
|
+
- Documentation updates
|
|
86
|
+
- Migration notes (if any)
|