Repository navigation
feat(examples): add notes-oauth-keycloak end-to-end example - #44
Merged
Merged
Conversation
… 0.11.0 Unmodified output of: npx @agentailor/create-mcp-server@0.11.0 --name=notes-oauth-keycloak --oauth --no-git --no-skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds a local Keycloak (docker compose, realm imported from a file) and the changes that make the scaffolded --oauth server a complete example: - auth.ts forwards the token's sub/username and requires mcp:tools - notes are kept per user, keyed by sub; adds a whoami tool - get-token and smoke scripts; smoke checks 401s, offline tokens, identity and per-user isolation - realm: users get default roles and offline_access is mapped to its role, so self-registered clients such as the Inspector can sign in; the compose network has a fixed subnet so its gateway can be trusted for Dynamic Client Registration - examples index, README/AGENTS.md docs, and an examples CI workflow that also runs on template changes Co-Authored-By: Claude Opus 5.5 <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
Adds an
examples/folder with the first end-to-end example, notes-oauth-keycloak: the notes server fromcreate-mcp-server --oauth, a local Keycloak that is fully configured from a realm file (no console clicks), and notes kept per signed-in user.npx @agentailor/create-mcp-server@0.11.0 --name=notes-oauth-keycloak --oauth --no-git --no-skills.// example:in code and listed in the example README:auth.tsforwards the token'ssubandpreferred_usernameinAuthInfo.extra, and requires themcp:toolsscope.identity.ts(callerFrom(ctx)readsctx.http.authInfo). The store, tools and resources partition notes bysub. Adds awhoamitool.docker-compose.ymlruns Keycloak 26.4.7, importskeycloak/mcp-realm-realm.jsonon start, and has a healthcheck forup --wait.npm run tokenandnpm run smoke.examples/README.md, plus an Examples section in the rootREADME.mdandAGENTS.md..github/workflows/examples.ymlruns the example's tests and smoke test. It also triggers onsrc/templates/**, so template drift fails on the PR that causes it.Realm details worth knowing
<realm>-realm.json, or Keycloak refuses it.localhost. The compose network therefore has a fixed subnet, and the Trusted Hosts registration policy trusts its gateway. Without that, clients that register themselves (Dynamic Client Registration) get a 403.default-roles-mcp-realm, and theoffline_accessscope is mapped to its role. Without this, the Inspector's token exchange fails with "Offline tokens not allowed".Testing
npm run smokeagainst a live Keycloak passes 10 of 10. It checks: the metadata points at the issuer, requests without a token get 401 with aresource_metadatachallenge, a forged token gets 401, a user can get an offline token,whoamireturns alice withmcp:tools, and bob can't list or read alice's notes.src/isn't touched.examples.ymlworkflow runs for the first time on this PR.🤖 Generated with Claude Code