Skip to content

simpleStreamableHttp: fix example code #660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025
Merged

Conversation

ochafik
Copy link
Contributor

@ochafik ochafik commented Jun 18, 2025

Update simpleStreamableHttp.ts example so its in-memory OAuth server isn't always strict (only make it strict if --oauth-strict isn't passed).

Follow up to #638 cc/ @pcarleton

Motivation and Context

While testing an old inspector's refresh flow w/ the new simpleStreamableHttp.ts, realized the in-memory oauth is too strict. This loosens it unless --oauth-strict is set.

How Has This Been Tested?

Using a pre-resources inspector (before modelcontextprotocol/inspector#526) + new typescript-sdk (after #638):

git clone https://github.com/modelcontextprotocol/typescript-sdk
( cd typescript-sdk && npx tsx src/examples/server/simpleStreamableHttp.ts  --oauth )& # no need for --oauth-strict here

git clone https://github.com/modelcontextprotocol/inspector
( cd inspector && npm run dev http://localhost:3000/mcp )

# Then:
# - Connect to the MCP server in the inspector (works),
# - Open the Auth panel
# - Click "Quick Refresh": fails!
# - Server console output says: "Invalid resource: undefined"

Breaking Changes

None (just better example in main branch)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update (the example being a form of documentation)

@ochafik ochafik changed the title simpleStreamableHttp: tweak example code simpleStreamableHttp: fix example code Jun 19, 2025
@ochafik ochafik added bug Something isn't working documentation Improvements or additions to documentation labels Jun 19, 2025
@ochafik ochafik marked this pull request as ready for review June 19, 2025 10:33
@ochafik ochafik requested a review from pcarleton June 19, 2025 10:33
Copy link
Contributor

@pcarleton pcarleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice lgtm

@ochafik ochafik merged commit 2a23890 into main Jun 19, 2025
5 checks passed
@ochafik ochafik deleted the ochafik/simple-server-tweaks branch June 19, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants