Skip to main content
Glama
Microsoft To Do for ChatGPT

Microsoft To Do for ChatGPT

by TheBig468
README.md
# Microsoft To Do for ChatGPT

An MIT-licensed, self-hostable MCP server for managing Microsoft To Do from ChatGPT. It uses Microsoft Graph v1.0 with delegated permissions, so each connection works with the Microsoft account that the user authorizes. The Streamable HTTP endpoint supports MCP 2026-07-28 and the 2025-11-25 handshake.

## What you can do

| Action | MCP tools |
| --- | --- |
| Browse lists and tasks | `list_task_lists`, `list_tasks`, `get_task` |
| Search by title or description | `search_tasks` |
| Create lists or tasks | `create_task_list`, `create_task` |
| Change a title, description, importance, or due date | `update_task` |
| Complete or reopen a task | `complete_task`, `reopen_task` |
| Request deletion and confirm it in the browser used to connect | `delete_task` |
| Find overdue or upcoming unfinished tasks | `get_overdue_tasks`, `get_upcoming_tasks` |

List tools return up to 50 items per page. Supply `nextCursor` on the next call to continue. Search and due-date summaries inspect up to 100 task pages per call and indicate whether the scan finished. Start with a list ID for large accounts. Due dates use `YYYY-MM-DD`. The due-date tools use calendar days in the requested time zone, defaulting to UTC, and read each task’s stored calendar date from Graph. Upcoming includes today.

## Architecture

```text
ChatGPT ── MCP access token ──> Express / TypeScript on Vercel
                                      ├── oidc-provider ── OAuth and consent
                                      ├── Upstash Redis ── encrypted, expiring authorization state
                                      └── Microsoft Graph ── delegated Microsoft access token
```

`oidc-provider` runs the MCP authorization server. `oauth4webapi` handles the separate Microsoft authorization-code exchange and refresh. Both flows use PKCE S256. The MCP server looks up each opaque access token in its issuer-specific store and validates its audience, expiry, client, scope, and active grant. Graph requests use `/me/todo` with the linked account’s Microsoft access token.

Redis lets any Vercel instance complete the same OAuth flow and enforce one-time state and delete confirmations. Records are encrypted with AES-256-GCM at the application layer. Microsoft token records expire 30 days after linking, MCP access tokens expire after 10 minutes, and pending delete requests expire after 5 minutes. Search results and task listings are read from Graph on demand. A pending deletion temporarily stores the selected task title and IDs. Service routes return generic errors and the app does not log tokens or task content.

Task text remains untrusted. HTML notes are converted to plain text and browser previews escape task titles. A deletion link alone cannot delete anything. Approval requires the browser that completed account linking and an explicit form submission. The server rechecks the task before deletion and consumes the approval request once. To disconnect, remove the plugin connection in ChatGPT and revoke the application’s access in your Microsoft account if you want to invalidate Microsoft authorization immediately.

## Run the automated checks

Use Node.js 24 LTS and npm.

```bash
npm ci
npm run build
npm test
```

The tests run the HTTP application with a local in-memory store and mock Microsoft OAuth and Graph responses. No Microsoft login, Redis service, or Vercel project is required for these tests.

## Configure Microsoft Entra

Open **Microsoft Entra ID → App registrations → To Do for ChatGPT**.

1. In **Overview**, copy **Application (client) ID** into `MICROSOFT_CLIENT_ID`.
2. Confirm **Accounts in any organizational directory and personal Microsoft accounts** is the supported account type. The server uses Microsoft’s `/common` authority. Work or school tenants can still impose their own consent policies.
3. Open **Authentication → Add a platform → Web** and add `https://YOUR-HOST/oauth/microsoft/callback`. `YOUR-HOST` must be the hostname you will use for `PUBLIC_ORIGIN`, such as `microsoft-todo-mcp.vercel.app` if that name is available. Register `http://localhost:3000/oauth/microsoft/callback` as an additional Web redirect only if running a live local OAuth test. Leave implicit grant and public-client flows disabled.
4. In **API permissions**, keep **Microsoft Graph → Delegated permissions → Tasks.ReadWrite**. The server also requests `offline_access` during OAuth to receive a Microsoft refresh token. The app does not use `User.Read`, application permissions, or an exposed Entra API.
5. In **Certificates & secrets → Client secrets**, create a client secret and copy its **Value** into `MICROSOFT_CLIENT_SECRET` before leaving the page.

[Microsoft authorization-code and redirect guidance](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow) · [Microsoft Graph To Do API](https://learn.microsoft.com/en-us/graph/api/resources/todo-overview?view=graph-rest-1.0)

## Configure the server

Create the local configuration file with `npm run setup:env`. It generates independent secrets and a private signing key directly into the git-ignored `.env`. Fill in the remaining values. For production, add every variable below to the Vercel **Production** environment. Enter the private JWK as raw JSON in Vercel, without the surrounding quotes used in `.env`.

| Variable | Production value |
| --- | --- |
| `PUBLIC_ORIGIN` | Exact HTTPS origin, for example `https://YOUR-HOST`. Omit the trailing slash and `/mcp`. |
| `MICROSOFT_CLIENT_ID` | Entra application client ID. |
| `MICROSOFT_CLIENT_SECRET` | Entra secret **Value**. |
| `MCP_CLIENT_ID` | A registered-client identifier for ChatGPT, for example `microsoft-todo-chatgpt`. |
| `MCP_CLIENT_SECRET` | Generated registered-client secret. Enter this same value privately in ChatGPT. |
| `MCP_REDIRECT_URI` | The exact ChatGPT callback shown in the connection’s management page. The RFC 9207 stable default is `https://chatgpt.com/connector_platform_oauth_redirect`. This value belongs here only. |
| `OIDC_COOKIE_KEY` | Generated cookie-signing secret. |
| `TOKEN_ENCRYPTION_KEY` | Generated 32-byte, base64url-encoded encryption key. |
| `OIDC_SIGNING_JWK` | Generated private RSA signing JWK. |
| `UPSTASH_REDIS_REST_URL` | REST URL of an Upstash Redis database. |
| `UPSTASH_REDIS_REST_TOKEN` | Read/write REST token for that database. |

An Upstash Redis free-tier instance is sufficient for a small test. Use a regional database close to the Vercel function region. Keep production secrets private and consistent across instances. Changing the encryption key or issuer invalidates existing connections. [Upstash Redis plans](https://upstash.com/pricing/redis)

For local development, set `PUBLIC_ORIGIN=http://localhost:3000`, use the exact redirect URI of your local registered MCP client for `MCP_REDIRECT_URI`, and run `npm run dev`. The local issuer has a separate Redis namespace. The production ChatGPT connection uses the public HTTPS endpoint.

## Deploy and connect to ChatGPT

1. Import the GitHub repository into Vercel after the implementation is pushed. Use the repository root, the **Express** framework, and **Node.js 24.x**. Set the production environment variables before deploying. Use a stable production URL reachable by ChatGPT. Verify `GET https://YOUR-HOST/.well-known/oauth-protected-resource/mcp` reports `https://YOUR-HOST/mcp` as the resource. [Vercel’s Express deployment guide](https://vercel.com/docs/frameworks/backend/express)
2. In **ChatGPT Plugins → Add custom MCP server**, enter `https://YOUR-HOST/mcp`. Select **OAuth** and enter the static credentials `MCP_CLIENT_ID` and `MCP_CLIENT_SECRET`. If the control asks for token endpoint authentication, use `client_secret_basic`. Confirm that ChatGPT’s displayed callback exactly matches `MCP_REDIRECT_URI`. Create and install the plugin, then sign in to Microsoft. [Connect a custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server) · [OpenAI authentication requirements](https://developers.openai.com/plugins/build/auth)
3. In ChatGPT, list your To Do lists. In a disposable list, create a task, edit its notes and due date, complete and reopen it, then request deletion. Verify the task stays visible until you approve the link in the browser used to connect. Repeat with a separate account or browser profile and verify its tasks stay isolated.

## Public directory release

After testing with both personal and work or school Microsoft accounts, prepare a public plugin package with the remote MCP URL and `provided` OAuth client mode, `client_secret_basic`, and base scope `tasks:manage`. Keep the OAuth client secret in the submission portal. The public submission also requires verified developer and domain information, a published privacy policy, listing assets, and review materials including a dedicated account with sample data, test scenarios and a walkthrough. [OpenAI packaging guide](https://developers.openai.com/plugins/build/plugins) · [OpenAI submission guide](https://developers.openai.com/plugins/deploy/submission)

## License

[MIT](LICENSE).

This software is provided as is, without warranty, under the MIT licence. The licence limits the authors’ and copyright holders’ liability to the extent permitted by applicable law. Any rights or remedies that cannot lawfully be excluded still apply.