Add hosted mode for Claude.ai (HTTP transport + OAuth)#6
Open
digitalhen wants to merge 3 commits into
Open
Conversation
Adds a hosted MCP server mode (`src/hosted.ts`) that runs alongside the existing stdio transport. This enables integration with Claude.ai and other remote MCP clients via Streamable HTTP. New features: - HTTP transport with Streamable HTTP (MCP spec compliant) - OAuth 2.0 with PKCE and dynamic client registration - Simple password-based authorization flow - Runtime tool discovery (no build step needed) - Docker support with Dockerfile and docker-compose.yml Also fixes positional argument mapping in callModularTool (both stdio and hosted modes). Methods like pingSet(data, config) now receive their arguments in the correct positions instead of as a merged object. The existing stdio mode (index.js) is unchanged and continues to work with Claude Desktop, Cursor, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude.ai setup instructions, Docker quickstart, Cloudflare Tunnel guide, OAuth flow explanation, and hosted-mode env vars. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude.ai re-authenticates on every request when expires_in is missing, treating the token as immediately expired. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/hosted.ts) that enables integration with Claude.ai and other remote MCP clients via Streamable HTTP transportDockerfile+docker-compose.yml) for easy self-hostingcallModularTool— methods likepingSet(data, config)andpingStart(jobid, data, config)now receive arguments in the correct positions instead of as a merged object (affects both stdio and hosted modes)How it works
The hosted mode (
yarn start:hostedor Docker) runs an Express HTTP server that:/mcp/authorize,/token,/register) with a simple password gate/.well-known/oauth-authorization-serverfor automatic discoveryThe existing stdio mode (
index.js) is completely unchanged — this is purely additive.Setup for Claude.ai
.env.exampleto.envand fill in OPNsense API credentials + an OAuth passworddocker compose up -d --build/mcpURLTest plan
index.jsor its generation)🤖 Generated with Claude Code