changes to support self hosted MCP server next to self-hosted 5etools - #16
Open
tz8 wants to merge 6 commits into
Open
changes to support self hosted MCP server next to self-hosted 5etools#16tz8 wants to merge 6 commits into
tz8 wants to merge 6 commits into
Conversation
- rawUrl() now redirects content fetches for the 2024/2014 ruleset repos to LOCAL_BASE_URL when set, e.g. a self-hosted 5etools static mirror. Manifest indexing still uses the GitHub Contents API (no static-mirror equivalent for directory listing). Homebrew content is never redirected. - New HTTP transport (src/http.ts) using the MCP SDK's stateless StreamableHTTPServerTransport, replacing the placeholder page. Exposes POST /mcp and GET /health. Optional MCP_HTTP_TOKEN bearer-auth guard on /mcp (open if unset). - Unit tests for both (tests/github.test.ts, tests/http.test.ts), all passing alongside the existing suite (433 tests total). - README: document LOCAL_BASE_URL, PORT, MCP_HTTP_TOKEN, and the new HTTP transport usage.
Add local mirror support and Streamable HTTP transport
- New src/manifest/local-builder.ts: scans a local 5etools data/ directory directly via fs.readdir instead of the GitHub Contents API. Uses file mtime+size as a cache-invalidation key in place of a GitHub blob SHA. - github.ts fetchRaw() now handles file:// URLs by reading straight from disk, so content fetching is fully network-free too when LOCAL_DATA_DIR is set (LOCAL_BASE_URL is then ignored). - builder.ts: buildManifest() branches on LOCAL_DATA_DIR; falls back to the existing GitHub-based path when unset, so stdio/Claude Desktop users are unaffected. - Homebrew indexing is unchanged (still GitHub-only, already non-fatal on rate-limit errors) — self-hosted mirrors don't bundle third-party homebrew content. - Tests: tests/manifest/local-builder.test.ts (5 tests) and file:// coverage added to tests/github.test.ts (2 tests). Full suite: 440 tests, lint/typecheck/build all clean. - Verified end-to-end against a real fixture data/ directory: served correct, fixture-only content with zero GitHub calls.
Add LOCAL_DATA_DIR: filesystem-based manifest indexing
…or for the HTTP transport
|
Successfully created multidev environment: pr-16 |
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.
both possible: working directly from the 5etools data directory or via http/https. Full disclosure: i am a long term programmer (40+ years), but i'm lazy so this code was created with support from Claude Code