@co-native-ab/graphdo-ts 0.1.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 +7 -0
- package/README.md +270 -0
- package/dist/index.js +45565 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Co-native AB
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# graphdo-ts
|
|
2
|
+
|
|
3
|
+
A TypeScript [MCP server](https://modelcontextprotocol.io) that gives AI agents scoped, low-risk access to Microsoft Graph.
|
|
4
|
+
|
|
5
|
+
The design intentionally minimizes blast radius — agents can only mail _you_, only touch tasks in a single configured list, and never see resources outside the scopes you've granted. Critical decisions like signing in and choosing which list to operate on require a human in the loop via the browser. Using an AI agent is never risk-free, but graphdo-ts is designed to keep the exposure as small as possible while still being useful. Current capabilities cover email and Microsoft To Do; more Graph surfaces will be added over time with the same focus on minimizing risk.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
graphdo-ts currently exposes **15 MCP tools**:
|
|
12
|
+
|
|
13
|
+
| Tool | Description |
|
|
14
|
+
| ------------------ | ------------------------------------------------------------------------------------ |
|
|
15
|
+
| `login` | Authenticate via browser login |
|
|
16
|
+
| `logout` | Clear cached tokens and sign out |
|
|
17
|
+
| `auth_status` | Check authentication status, current user, and configuration |
|
|
18
|
+
| `mail_send` | Send an email to yourself (from and to your Microsoft account) |
|
|
19
|
+
| `todo_config` | Configure which Microsoft To Do list to use (opens browser for human-only selection) |
|
|
20
|
+
| `todo_list` | List todos with pagination, filtering, and sorting |
|
|
21
|
+
| `todo_show` | Show a single todo with full details including checklist steps |
|
|
22
|
+
| `todo_create` | Create a new todo with optional due date, importance, reminder, and recurrence |
|
|
23
|
+
| `todo_update` | Update an existing todo (title, body, importance, due date, reminder, recurrence) |
|
|
24
|
+
| `todo_complete` | Mark a todo as completed |
|
|
25
|
+
| `todo_delete` | Delete a todo |
|
|
26
|
+
| `todo_steps` | List all checklist steps (sub-items) within a todo |
|
|
27
|
+
| `todo_add_step` | Add a new checklist step to a todo |
|
|
28
|
+
| `todo_update_step` | Update a checklist step — rename it, check it off, or uncheck it |
|
|
29
|
+
| `todo_delete_step` | Delete a checklist step from a todo |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
graphdo-ts is distributed in three formats:
|
|
36
|
+
|
|
37
|
+
### MCPB Bundle (Recommended for Claude Desktop)
|
|
38
|
+
|
|
39
|
+
The [MCPB](https://github.com/modelcontextprotocol/mcpb) bundle is self-contained — it includes the server and a bundled Node.js runtime. No separate Node.js installation required.
|
|
40
|
+
|
|
41
|
+
Download the latest `.mcpb` file from [GitHub Releases](https://github.com/co-native-ab/graphdo-ts/releases/latest).
|
|
42
|
+
|
|
43
|
+
**Claude Desktop:** Double-click the `.mcpb` file, or open Claude Desktop → **Settings** → **Extensions** → **Install Extension** and select the file.
|
|
44
|
+
|
|
45
|
+
After installation, graphdo appears in your extensions list. You can configure optional settings (debug logging, custom client ID, tenant ID) through the extension settings UI.
|
|
46
|
+
|
|
47
|
+
### npm (Recommended for other MCP clients)
|
|
48
|
+
|
|
49
|
+
Requires [Node.js](https://nodejs.org/) 22 or later.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx @co-native-ab/graphdo-ts
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Configure in your MCP client:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["@co-native-ab/graphdo-ts"]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Standalone JS Bundle
|
|
65
|
+
|
|
66
|
+
Download `graphdo-ts-vX.Y.Z.js` from [GitHub Releases](https://github.com/co-native-ab/graphdo-ts/releases/latest) and run directly with Node.js:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
node graphdo-ts-vX.Y.Z.js
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Authentication
|
|
75
|
+
|
|
76
|
+
graphdo-ts uses MSAL to authenticate with Microsoft. When the agent calls the `login` tool:
|
|
77
|
+
|
|
78
|
+
1. The tool opens **interactive browser login** - your default browser navigates to Microsoft's sign-in page
|
|
79
|
+
2. You authenticate in the browser, which redirects to a local server that captures the auth code
|
|
80
|
+
3. Login completes immediately - no manual code entry needed
|
|
81
|
+
|
|
82
|
+
If a browser cannot be opened automatically, the tool returns the login URL as an error message. You can copy and paste this URL into any browser to complete authentication.
|
|
83
|
+
|
|
84
|
+
When you use the `logout` tool, cached tokens are cleared and a confirmation page opens in the browser.
|
|
85
|
+
|
|
86
|
+
Use the `auth_status` tool to check whether you are logged in and see the current user and configuration.
|
|
87
|
+
|
|
88
|
+
Tokens are automatically refreshed using the cached refresh token. To sign out and clear cached tokens, use the `logout` tool.
|
|
89
|
+
|
|
90
|
+
The Azure AD client ID (`b073490b-a1a2-4bb8-9d83-00bb5c15fcfd`) is built into the server. No client-side configuration is needed unless your organization uses a custom app registration. If you need to use your own app registration, set `GRAPHDO_CLIENT_ID` and optionally `GRAPHDO_TENANT_ID` (see [Environment Variables](#environment-variables)). When installed via MCPB, these can also be configured through the extension settings UI.
|
|
91
|
+
|
|
92
|
+
### Required Scopes
|
|
93
|
+
|
|
94
|
+
These scopes reflect the current set of capabilities. Additional scopes may be required as new Graph surfaces are added.
|
|
95
|
+
|
|
96
|
+
| Scope | Purpose |
|
|
97
|
+
| ----------------- | ----------------------------------------------- |
|
|
98
|
+
| `Mail.Send` | Send emails as the signed-in user |
|
|
99
|
+
| `Tasks.ReadWrite` | Read and write the user's Microsoft To Do tasks |
|
|
100
|
+
| `User.Read` | Read the signed-in user's basic profile |
|
|
101
|
+
| `offline_access` | Enable refresh tokens for persistent sessions |
|
|
102
|
+
|
|
103
|
+
### Todo List Selection
|
|
104
|
+
|
|
105
|
+
Before using todo tools, select which Microsoft To Do list to use. Call the `todo_config` tool - it opens a browser window with your available lists. Click the one you want, and the configuration is saved.
|
|
106
|
+
|
|
107
|
+
**Security:** This is a human-only action. The AI agent cannot programmatically change which list it operates on - only you can make this selection through the browser.
|
|
108
|
+
|
|
109
|
+
If a browser cannot be opened automatically, the tool displays a URL you can visit manually.
|
|
110
|
+
|
|
111
|
+
The configuration is stored in the OS config directory:
|
|
112
|
+
|
|
113
|
+
- **Linux:** `~/.config/graphdo-ts/config.json`
|
|
114
|
+
- **macOS:** `~/Library/Application Support/graphdo-ts/config.json`
|
|
115
|
+
- **Windows:** `%APPDATA%/graphdo-ts/config.json`
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Organization Setup
|
|
120
|
+
|
|
121
|
+
> **Personal Microsoft accounts** (like @outlook.com or @hotmail.com) can skip this section entirely. This is only relevant for work or school accounts managed by an organization.
|
|
122
|
+
|
|
123
|
+
### For regular users
|
|
124
|
+
|
|
125
|
+
When you first use the `login` tool, Microsoft may tell you that you need admin approval. This means your IT administrator needs to grant graphdo-ts permission to access your email and tasks on behalf of your organization.
|
|
126
|
+
|
|
127
|
+
**What to tell your IT admin:**
|
|
128
|
+
|
|
129
|
+
> "I'd like to use an AI tool called graphdo-ts that helps me send emails to myself and manage my todo list. It needs admin consent for the following **delegated** permissions: User.Read, Mail.Send, Tasks.ReadWrite, and offline_access. The application ID is `b073490b-a1a2-4bb8-9d83-00bb5c15fcfd` and it's published by Co-native AB."
|
|
130
|
+
|
|
131
|
+
### For IT administrators
|
|
132
|
+
|
|
133
|
+
graphdo-ts uses a multi-tenant application published by Co-native AB. To grant consent for your organization:
|
|
134
|
+
|
|
135
|
+
1. Go to the [Azure Portal](https://portal.azure.com) → **Microsoft Entra ID** → **Enterprise applications**.
|
|
136
|
+
2. Click **New application** → **All applications** → search for the application ID: `b073490b-a1a2-4bb8-9d83-00bb5c15fcfd`.
|
|
137
|
+
3. If the app doesn't appear, a user can trigger the consent flow by calling the `login` tool — this will create a service principal in your tenant.
|
|
138
|
+
4. Go to **Permissions** and click **Grant admin consent for [your organization]**.
|
|
139
|
+
5. Review and approve the following delegated permissions:
|
|
140
|
+
|
|
141
|
+
| Permission | Type | Description |
|
|
142
|
+
| ----------------- | --------- | ---------------------------------------------------------------------------- |
|
|
143
|
+
| `User.Read` | Delegated | Read the signed-in user's basic profile |
|
|
144
|
+
| `Mail.Send` | Delegated | Send mail as the signed-in user |
|
|
145
|
+
| `Tasks.ReadWrite` | Delegated | Read and write the signed-in user's tasks |
|
|
146
|
+
| `offline_access` | Delegated | Maintain access to data you have given it access to (enables refresh tokens) |
|
|
147
|
+
|
|
148
|
+
6. Once consent is granted, all users in your organization can use the `login` tool without further approval.
|
|
149
|
+
|
|
150
|
+
**Security — minimizing blast radius:**
|
|
151
|
+
|
|
152
|
+
graphdo-ts is designed to keep AI agent access as limited as possible while still being useful. Using an AI agent with access to your Microsoft account is never risk-free, but the following measures minimize the exposure:
|
|
153
|
+
|
|
154
|
+
- **Scoped permissions** — only delegated permissions are used (User.Read, Mail.Send, Tasks.ReadWrite, offline_access). The agent acts as the signed-in user, never as an application with broader access.
|
|
155
|
+
- **Email to self only** — the agent can only send emails to the signed-in user themselves, not to other recipients.
|
|
156
|
+
- **Single todo list** — the agent can only access tasks in one specific list, chosen by you.
|
|
157
|
+
- **Human-in-the-loop for critical decisions** — signing in and selecting which todo list to use both require human interaction via the browser. The AI agent cannot perform these actions programmatically.
|
|
158
|
+
- **Open source** — the source code is available at [github.com/co-native-ab/graphdo-ts](https://github.com/co-native-ab/graphdo-ts) for review.
|
|
159
|
+
|
|
160
|
+
As new Graph surfaces are added, the same principle applies: minimize blast radius, require human confirmation for sensitive operations, and request only the scopes that are strictly needed.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Troubleshooting
|
|
165
|
+
|
|
166
|
+
**"I need admin approval"**
|
|
167
|
+
Your organization's IT administrator needs to approve graphdo-ts. See [Organization Setup](#organization-setup) for what to tell them.
|
|
168
|
+
|
|
169
|
+
**"No todo lists found"**
|
|
170
|
+
Create a list in Microsoft To Do first. Open [to-do.office.com](https://to-do.office.com), create a list, then call `todo_config` again.
|
|
171
|
+
|
|
172
|
+
**"The browser didn't open"**
|
|
173
|
+
The `login` tool will return the login URL in its error message. Copy and paste the URL into your browser to complete authentication.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Privacy & Security
|
|
178
|
+
|
|
179
|
+
graphdo-ts is designed around the principle of **minimizing blast radius** — keeping AI agent access as narrow as possible while still enabling useful work. Using an AI agent is never risk-free, but the following measures reduce the exposure:
|
|
180
|
+
|
|
181
|
+
- 🔒 **Scoped access** — graphdo-ts only accesses **your own** email and tasks. It cannot access anyone else's data.
|
|
182
|
+
- 📧 **Email to self only** — the agent can **only send emails to yourself**. It cannot send to other recipients.
|
|
183
|
+
- 📋 **Single todo list** — the agent operates on **one specific list** that you choose via the browser. It cannot switch lists on its own.
|
|
184
|
+
- 🧑 **Human-in-the-loop** — signing in and selecting which todo list to use both require **human interaction via the browser**. The AI agent cannot perform these actions programmatically.
|
|
185
|
+
- 💻 **Local credentials** — your login credentials are cached **locally on your computer** and nowhere else.
|
|
186
|
+
- 🌐 **Microsoft only** — no data is sent anywhere except to **Microsoft's official servers** (the same ones Outlook and To Do use).
|
|
187
|
+
- 📖 **Open source** — the source code is **fully open** at [github.com/co-native-ab/graphdo-ts](https://github.com/co-native-ab/graphdo-ts) — anyone can review exactly what it does.
|
|
188
|
+
|
|
189
|
+
As new capabilities are added, the same principle applies: minimize blast radius, require human confirmation for sensitive operations, and request only the permissions that are strictly needed.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Development
|
|
194
|
+
|
|
195
|
+
### Prerequisites
|
|
196
|
+
|
|
197
|
+
- Node.js 22+
|
|
198
|
+
|
|
199
|
+
### Setup
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
git clone https://github.com/co-native-ab/graphdo-ts.git
|
|
203
|
+
cd graphdo-ts
|
|
204
|
+
npm install
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Scripts
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run build # Build with esbuild (dist/index.js)
|
|
211
|
+
npm run lint # ESLint (strict + stylistic)
|
|
212
|
+
npm run typecheck # tsc --noEmit
|
|
213
|
+
npm run test # Run tests via vitest
|
|
214
|
+
npm run format # Format code with Prettier
|
|
215
|
+
npm run format:check # Check formatting without writing
|
|
216
|
+
npm run check # format:check + lint + typecheck + test (all four)
|
|
217
|
+
npm run mcpb # Build + create MCPB bundle
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Environment Variables
|
|
221
|
+
|
|
222
|
+
| Variable | Description | Default |
|
|
223
|
+
| ---------------------- | ---------------------------------------------------------------------- | -------------------------------------- |
|
|
224
|
+
| `GRAPHDO_DEBUG` | Enable debug logging (`true`/`false`) | `false` |
|
|
225
|
+
| `GRAPHDO_CLIENT_ID` | Azure AD (Entra ID) application client ID | `b073490b-a1a2-4bb8-9d83-00bb5c15fcfd` |
|
|
226
|
+
| `GRAPHDO_TENANT_ID` | Azure AD tenant ID (`common`, `organizations`, `consumers`, or a GUID) | `common` |
|
|
227
|
+
| `GRAPHDO_CONFIG_DIR` | Override config directory | OS default |
|
|
228
|
+
| `GRAPHDO_GRAPH_URL` | Override Graph API base URL | `https://graph.microsoft.com/v1.0` |
|
|
229
|
+
| `GRAPHDO_ACCESS_TOKEN` | Skip MSAL auth and use a static Bearer token | - |
|
|
230
|
+
|
|
231
|
+
When installed via [MCPB](https://github.com/modelcontextprotocol/mcpb), `GRAPHDO_DEBUG`, `GRAPHDO_CLIENT_ID`, and `GRAPHDO_TENANT_ID` are exposed as configurable settings in the extension UI and automatically passed as environment variables.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Architecture
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
Claude Desktop / MCP Client
|
|
239
|
+
│
|
|
240
|
+
│ stdio (JSON-RPC)
|
|
241
|
+
▼
|
|
242
|
+
MCP Server (StdioServerTransport)
|
|
243
|
+
│
|
|
244
|
+
├─── MSAL Auth (browser-only) ──→ Azure AD
|
|
245
|
+
│
|
|
246
|
+
├─── Graph Client (native fetch)
|
|
247
|
+
│ │
|
|
248
|
+
│ │ Bearer token
|
|
249
|
+
│ ▼
|
|
250
|
+
│ Microsoft Graph API (v1.0)
|
|
251
|
+
│
|
|
252
|
+
└─── Config (OS config dir)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- **Stdio transport** - communicates via stdin/stdout JSON-RPC (designed for MCPB)
|
|
256
|
+
- **MSAL authentication** - interactive browser login only, tokens cached locally
|
|
257
|
+
- **Graph client** - lightweight wrapper around `fetch` (no Microsoft Graph SDK)
|
|
258
|
+
- **Minimal dependencies** - three runtime deps: `@modelcontextprotocol/sdk`, `zod`, `@azure/msal-node`
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Contributing
|
|
263
|
+
|
|
264
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and PR process.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
MIT
|