Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,9 @@
* Export worker
*
* OAuthProvider wraps the Hono app to add OAuth 2.1 + PKCE for MCP clients
* (Claude Desktop Cowork). Only mcp.chitty.cc/mcp requires OAuth;
* connect.chitty.cc/mcp/* continues using API key auth (backward compatible).
* (Claude Desktop Cowork). The mcp.chitty.cc aggregator (standalone service)
* owns OAuth upstream; connect.chitty.cc/mcp is the slim per-service MCP
* exposed here without auth (gateway authenticates and proxies in).
*
* OAuth endpoints served automatically:
* /.well-known/oauth-authorization-server — RFC 8414 discovery
Expand Down Expand Up @@ -2118,7 +2119,7 @@
* endpoint is handled internally by OAuthProvider and never reaches
* our defaultHandler.
*/
function stripRedirectUriQueryParams(request) {

Check warning on line 2122 in src/index.js

View workflow job for this annotation

GitHub Actions / Lint (22)

'stripRedirectUriQueryParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 2122 in src/index.js

View workflow job for this annotation

GitHub Actions / Lint (20)

'stripRedirectUriQueryParams' is defined but never used. Allowed unused vars must match /^_/u
const url = new URL(request.url);
const rawRedirect = url.searchParams.get("redirect_uri");
if (!rawRedirect) return request;
Expand Down Expand Up @@ -2294,15 +2295,16 @@
}
}

// When mcp.chitty.cc is fronted by Cloudflare Managed OAuth, Access owns
// the OAuth exchange and the origin should behave like a plain MCP server.
if (host === "mcp.chitty.cc" && url.pathname === "/mcp") {
// connect.chitty.cc/mcp — ChittyConnect's own slim MCP exposing only
// connect-specific tools. No auth: the upstream aggregator gateway
// (standalone mcp.chitty.cc service) authenticates and proxies in.
if (host === "connect.chitty.cc" && url.pathname === "/mcp") {
try {
return mcpAgentHandler.fetch(request, env, ctx);
Comment on lines +2298 to 2303
} catch (err) {
const errorInfo = formatCaughtError(err);
console.error(
`[MCP-Agent] /mcp threw: ${errorInfo.message}\n${errorInfo.stack}`,
`[MCP-Agent] connect.chitty.cc/mcp threw: ${errorInfo.message}\n${errorInfo.stack}`,
);
return new Response(
JSON.stringify({
Expand Down Expand Up @@ -2424,7 +2426,7 @@
// Scheduled handler for cron triggers
// - "0 * * * *" (hourly) → 1Password event sync to ChittyChronicle
// - every 5 min → Connection health checks
async scheduled(event, env, ctx) {

Check warning on line 2429 in src/index.js

View workflow job for this annotation

GitHub Actions / Lint (22)

'ctx' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 2429 in src/index.js

View workflow job for this annotation

GitHub Actions / Lint (20)

'ctx' is defined but never used. Allowed unused args must match /^_/u
console.log(
`[Scheduled] Cron trigger: ${event.cron} at ${new Date().toISOString()}`,
);
Expand Down
3 changes: 1 addition & 2 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@
],

"routes": [
{ "pattern": "connect.chitty.cc/*", "zone_name": "chitty.cc" },
{ "pattern": "mcp.chitty.cc/*", "zone_name": "chitty.cc" }
{ "pattern": "connect.chitty.cc/*", "zone_name": "chitty.cc" }
],
Comment on lines 316 to 318
"vars": {
"ENVIRONMENT": "production",
Expand Down
Loading