togello-mcp-server 1.0.30 → 1.0.32

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/README.md CHANGED
@@ -51,6 +51,10 @@ https://your-domain.example/mcp
51
51
 
52
52
  ChatGPT developer mode can add remote MCP servers that use SSE. For production ChatGPT apps or connectors, use `passthrough` auth or a deployment that authenticates each user separately before forwarding requests to Togello.
53
53
 
54
+ Remote mode redirects OAuth authorization server metadata discovery paths at `/.well-known/oauth-authorization-server` and `/.well-known/oauth-authorization-server/mcp` to the Togello OAuth issuer configured with `TOGELLO_OAUTH_ISSUER` or `TOGELLO_API_BASE_URL`.
55
+
56
+ The configured OAuth issuer must be an origin URL without a path component.
57
+
54
58
  For OpenAI Apps domain verification, set `TOGELLO_MCP_OPENAI_APPS_CHALLENGE_TOKEN` to the verification token. Remote mode then serves it from `/.well-known/openai-apps-challenge` as `text/plain`. If both `TOGELLO_MCP_OPENAI_APPS_CHALLENGE_TOKEN` and `OPENAI_APPS_CHALLENGE_TOKEN` are set, the Togello-scoped variable takes precedence.
55
59
 
56
60
  ## Tools
@@ -19,6 +19,13 @@ const calendarDateMemoDateSchema = z
19
19
  .regex(/^\d{4}-\d{2}-\d{2}$/, 'Invalid date format, expected YYYY-MM-DD');
20
20
  const readOnlyToolAnnotations = {
21
21
  readOnlyHint: true,
22
+ openWorldHint: false,
23
+ destructiveHint: false,
24
+ };
25
+ const privateWriteToolAnnotations = {
26
+ readOnlyHint: false,
27
+ openWorldHint: false,
28
+ destructiveHint: false,
22
29
  };
23
30
  function withUpstreamToken(cb, resolveUpstreamToken, requireUpstreamToken = false) {
24
31
  return async (args, extra) => {
@@ -77,6 +84,7 @@ export function createMcpServer(options = {}) {
77
84
  .optional()
78
85
  .describe('Optional detail associated with the task.'),
79
86
  },
87
+ annotations: privateWriteToolAnnotations,
80
88
  }, withUpstreamToken(createTaskHandler, options.resolveUpstreamToken, options.requireUpstreamToken));
81
89
  server.registerTool('update-task', {
82
90
  description: 'Updates a task in the TODO feature.',
@@ -110,6 +118,7 @@ export function createMcpServer(options = {}) {
110
118
  .optional()
111
119
  .describe('Optional detail associated with the task. If omitted, the current value is kept.'),
112
120
  },
121
+ annotations: privateWriteToolAnnotations,
113
122
  }, withUpstreamToken(updateTaskHandler, options.resolveUpstreamToken, options.requireUpstreamToken));
114
123
  server.registerTool('get-calendar-date-memo', {
115
124
  description: 'Retrieves a calendar date memo for the specified date. Recognizes target date and memo content.',
@@ -126,6 +135,7 @@ export function createMcpServer(options = {}) {
126
135
  .string()
127
136
  .describe('Memo content for the date. Pass an empty or whitespace-only string to clear the memo.'),
128
137
  },
138
+ annotations: privateWriteToolAnnotations,
129
139
  }, withUpstreamToken(updateCalendarDateMemoHandler, options.resolveUpstreamToken, options.requireUpstreamToken));
130
140
  server.registerTool('get-todo-category-list', {
131
141
  description: 'Retrieves the list of categories from the TODO feature. Recognizes category name / category UUID',
@@ -154,6 +164,7 @@ export function createMcpServer(options = {}) {
154
164
  .string()
155
165
  .describe('You must specify a valid itemName obtained from get-activity-item-list. This tool requires a pre-existing activity item.'),
156
166
  },
167
+ annotations: privateWriteToolAnnotations,
157
168
  }, withUpstreamToken(startActivityLogHandler, options.resolveUpstreamToken, options.requireUpstreamToken));
158
169
  server.registerTool('complete-activity-log', {
159
170
  description: 'Completes an activity log.',
@@ -163,6 +174,7 @@ export function createMcpServer(options = {}) {
163
174
  .uuid()
164
175
  .describe('You must specify a valid activityLogUUID obtained from get-activity-log-list. This tool requires an existing activity log.'),
165
176
  },
177
+ annotations: privateWriteToolAnnotations,
166
178
  }, withUpstreamToken(completeActivityLogHandler, options.resolveUpstreamToken, options.requireUpstreamToken));
167
179
  server.registerTool('get-japan-current-time', {
168
180
  description: 'Returns the current time in Japan (JST).',
@@ -5,6 +5,12 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
5
5
  import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
6
6
  import { parseBearerToken } from './bearerToken.js';
7
7
  import { createMcpServer } from './mcpServer.js';
8
+ const authorizationServerMetadataPath = '/.well-known/oauth-authorization-server';
9
+ const authorizationServerMetadataCorsHeaders = {
10
+ 'Access-Control-Allow-Headers': 'Content-Type, Authorization, MCP-Protocol-Version, mcp-protocol-version',
11
+ 'Access-Control-Allow-Methods': 'GET, OPTIONS',
12
+ 'Access-Control-Allow-Origin': '*',
13
+ };
8
14
  const protectedResourceMetadataPath = '/.well-known/oauth-protected-resource';
9
15
  const openaiAppsChallengePath = '/.well-known/openai-apps-challenge';
10
16
  const maxRequestBodyBytes = 1_000_000;
@@ -21,8 +27,14 @@ export async function startRemoteServer(options) {
21
27
  const ssePath = options.ssePath ?? '/sse';
22
28
  const messagePath = options.messagePath ?? '/message';
23
29
  const publicBaseUrl = trimTrailingSlash(options.publicBaseUrl);
24
- const oauthIssuer = options.oauthIssuer;
30
+ const oauthIssuer = trimTrailingSlash(options.oauthIssuer);
31
+ validatePathlessOAuthIssuer(oauthIssuer);
25
32
  const protectedResourceMetadataUrl = `${publicBaseUrl}${protectedResourceMetadataPath}`;
33
+ const authorizationServerMetadataUrl = `${oauthIssuer}${authorizationServerMetadataPath}`;
34
+ const authorizationServerMetadataPaths = new Set([
35
+ authorizationServerMetadataPath,
36
+ `${authorizationServerMetadataPath}${mcpPath}`,
37
+ ]);
26
38
  const openaiAppsChallengeToken = options.openaiAppsChallengeToken?.trim();
27
39
  const sseSessions = new Map();
28
40
  const streamableSessions = new Map();
@@ -46,6 +58,16 @@ export async function startRemoteServer(options) {
46
58
  return;
47
59
  }
48
60
  }
61
+ if (authorizationServerMetadataPaths.has(requestUrl.pathname)) {
62
+ if (req.method === 'OPTIONS') {
63
+ writeAuthorizationServerMetadataOptionsResponse(res);
64
+ return;
65
+ }
66
+ if (req.method === 'GET') {
67
+ writeRedirectResponse(res, authorizationServerMetadataUrl);
68
+ return;
69
+ }
70
+ }
49
71
  if (requestUrl.pathname === protectedResourceMetadataPath) {
50
72
  if (req.method === 'OPTIONS') {
51
73
  writeOptionsResponse(res);
@@ -241,6 +263,12 @@ async function handleStreamableHttpRequest({ req, res, authMode, protectedResour
241
263
  function trimTrailingSlash(url) {
242
264
  return url.replace(/\/+$/, '');
243
265
  }
266
+ function validatePathlessOAuthIssuer(oauthIssuer) {
267
+ const { pathname } = new URL(oauthIssuer);
268
+ if (pathname !== '/') {
269
+ throw new Error(`Remote OAuth issuer must not include a path: ${oauthIssuer}`);
270
+ }
271
+ }
244
272
  function writeJsonResponse(res, body) {
245
273
  res.writeHead(200, {
246
274
  'Access-Control-Allow-Headers': 'Content-Type, Authorization',
@@ -251,6 +279,18 @@ function writeJsonResponse(res, body) {
251
279
  });
252
280
  res.end(JSON.stringify(body));
253
281
  }
282
+ function writeRedirectResponse(res, location) {
283
+ res.writeHead(302, {
284
+ ...authorizationServerMetadataCorsHeaders,
285
+ 'Cache-Control': 'no-store',
286
+ Location: location,
287
+ });
288
+ res.end();
289
+ }
290
+ function writeAuthorizationServerMetadataOptionsResponse(res) {
291
+ res.writeHead(204, authorizationServerMetadataCorsHeaders);
292
+ res.end();
293
+ }
254
294
  function writeTextResponse(res, body) {
255
295
  res.writeHead(200, {
256
296
  'Access-Control-Allow-Origin': '*',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "togello-mcp-server",
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "description": "MCP server for Togello tasks, calendar memos, calendar events, and activity logs.",
6
6
  "main": "build/index.js",
7
7
  "scripts": {