Commit graph

79 commits

Author SHA1 Message Date
Basil Hosmer
1140815c7b
Add graceful degradation when auth server unavailable
Server starts immediately and retries auth connection in background.
Splash page and health endpoint remain accessible in degraded mode.
2025-10-07 14:36:33 -04:00
Basil Hosmer
500c263176
Fix documentation: rename oauth file and correct test commands
- Rename oauth-patterns.md to oauth-architecture-patterns.md for clarity
- Fix session-ownership.md test commands to run from mcp-server directory
- Update redisTransport.ts path reference to include mcp-server prefix
2025-10-06 21:59:26 -04:00
Basil Hosmer
5482d905a9
Fix security vulnerabilities identified by CodeQL
- Fix information exposure: return generic error instead of stack traces in sse.ts
- Add missing rate limiting to root route in index.ts
2025-10-06 21:38:33 -04:00
Basil Hosmer
c03a9b4e77
Remove embedded OAuth implementation and flatten directory structure
Simplified the repository to have a single OAuth pattern with separate auth and MCP servers at the top level. Preserved embedded OAuth documentation as an alternative pattern.
2025-10-06 21:30:14 -04:00
Basil Hosmer
c637d39f8d
Fix: Update package-lock.json with new workspace names
The workspace names were changed during refactoring but package-lock.json wasn't updated, causing CI failures with npm ci
2025-10-06 09:56:19 -04:00
Basil Hosmer
112997d352
refactor, improve docs 2025-10-05 23:51:06 -04:00
bhosmer-ant
dc6c2a00e9
Merge pull request #10 from modelcontextprotocol/basil/readme_update
update integrated mode language in README
2025-09-30 17:44:58 -04:00
Basil Hosmer
a5a60d8ade
update integrated mode language in README 2025-09-26 17:12:57 -04:00
bhosmer-ant
22b6268380
Merge pull request #9 from modelcontextprotocol/basil/separate_auth
Add Support for Separate Authorization Server Mode
2025-09-26 15:10:49 -04:00
Basil Hosmer
67def732ff
Fix token audience validation in separate auth mode
The auth server's /introspect endpoint now correctly sets the 'aud' field
to the resource server URL (BASE_URI) instead of the client ID. This ensures
proper audience validation when the MCP server verifies tokens in separate mode.

- Import BASE_URI in auth server
- Set aud to BASE_URI in introspection response
- Fixes "Token was not issued for this resource server" error

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 13:30:55 -04:00
Basil Hosmer
a735b9810c
Add comprehensive token validation to ExternalAuthVerifier
Enhance token validation in separate mode to fully comply with MCP specification:
- Validate audience (aud) claim to ensure tokens are issued for this specific MCP server
- Validate temporal claims (nbf, iat) with appropriate clock skew tolerance
- Add configurable canonical URI for audience validation
- Improve logging for validation failures

These changes prevent token passthrough attacks and ensure tokens are
properly scoped to the intended resource server, as required by the
MCP OAuth 2.0 specification.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 16:33:02 -04:00
Basil Hosmer
dbd3e9a853
Revert OAuth metadata change for backwards compatibility
Keep serving .well-known/oauth-authorization-server from MCP server
in separate mode as some clients may expect to find it there
2025-09-23 16:19:47 -04:00
Basil Hosmer
e393cb2129
Add OAuth protected resource metadata endpoint for separate mode
Fixes MCP Inspector connection by providing OAuth discovery endpoint
that points to the external auth server at http://localhost:3001
2025-09-15 02:57:56 -04:00
Basil Hosmer
34fe20efc4
Implement Redis namespace isolation for auth and MCP keys 2025-09-15 02:33:59 -04:00
Basil Hosmer
4a081bc816
Improve e2e tests with OAuth flow validation
Add state parameter round-trip validation to prevent CSRF attacks.
Document each OAuth step including PKCE generation and token exchange.
Kill existing servers before starting new ones to avoid conflicts.
2025-09-15 02:11:23 -04:00
Basil Hosmer
4fe137426b
Add debug logging for OAuth flow troubleshooting
Add logging to track authorization flow steps and token introspection
to help diagnose issues with separate mode authentication.
2025-09-15 02:11:07 -04:00
Basil Hosmer
b32d638c87
Consolidate TypeScript build configuration
Use single tsconfig.json for both main server and auth-server to avoid
nested directory issues during build. Update e2e test scripts to run
directly instead of using concurrently.
2025-09-15 02:10:52 -04:00
Basil Hosmer
56a43ac67f
Fix OAuth metadata endpoint in separate mode
Remove incorrect mcpAuthMetadataRouter call when running in separate mode.
The resource server should not serve OAuth metadata endpoints - only the
auth server should provide these endpoints.
2025-09-15 02:10:36 -04:00
Basil Hosmer
67d9a94853
improvements to README.md 2025-09-12 17:12:43 -04:00
Basil Hosmer
5f545ce4c4
Fix CI build by using public npm registry in package-lock.json
The package-lock.json contained references to Anthropic's internal
artifactory registry which GitHub Actions cannot access, causing
npm ci to fail. Regenerated with public registry.npmjs.org.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 10:00:16 -04:00
Basil Hosmer
fdbf40bdc7
Simplify build scripts to catch all compilation errors
- Make 'npm run build' build both main server and auth server
- Remove redundant build:auth-server and build:all scripts
- Update README to reflect simplified build command
- Ensures compilation errors in auth server are caught by default build
2025-09-12 00:48:18 -04:00
Basil Hosmer
4e3414fe9c
Fix undefined staticFileRateLimit in auth server
- Add missing staticFileRateLimit definition in auth-server/index.ts
- Resolves compilation error in auth server build
- Addresses PR check failure about missing rate limiting on line 123
2025-09-12 00:44:29 -04:00
Basil Hosmer
ecd82f43c9
Add rate limiting to auth server static file endpoint
- Apply staticFileRateLimit to /mcp-logo.png route in auth server
- Addresses remaining check failure about missing rate limiting
- Matches rate limiting pattern used in main server
2025-09-12 00:36:21 -04:00
Basil Hosmer
890beed75a
Add rate limiting and improve e2e testing workflow
- Add express-rate-limit to custom endpoints for security:
  - /introspect: 100 requests per 5 minutes
  - /fakeupstreamauth/*: 20 requests per minute
  - Static files: 25 requests per 10 minutes
- Add automated e2e testing npm scripts using concurrently:
  - npm run test:e2e:integrated: Auto-starts server and runs test
  - npm run test:e2e:separate: Auto-starts both servers and runs test
- Update README with automated testing approach documentation
- Update docs/streamable-http-design.md with current file structure
- Remove redundancy in README e2e testing documentation
- Verified: All tests, linting, and e2e scripts pass with rate limiting
2025-09-12 00:27:07 -04:00
Basil Hosmer
1e47b07d2c
Update documentation for current implementation
- Update streamable-http-design.md with correct file references
- Reflect current dual transport architecture (SSE + Streamable HTTP)
- Update file paths to match actual implementation structure
- Clarify stateful session management approach
- Remove outdated research content, focus on current implementation
2025-09-11 23:58:57 -04:00
Basil Hosmer
40773bd051
Add end-to-end verification scripts and fix server issues
- Fix server hanging issue: incomplete HTTP responses in shttp.ts
- Add proper JSON-RPC error responses per MCP specification
- Fix PKCE challenge encoding: use base64url not standard base64
- Add comprehensive e2e scripts with OAuth flow and feature testing:
  - scripts/test-integrated-e2e.sh: Tests integrated mode
  - scripts/test-separate-e2e.sh: Tests separate mode
- Scripts verify all README claims: 7 tools, 100 resources (paginated), 3 prompts
- Add environment variable support and prerequisite checking
- Add TODO documentation for Streamable HTTP implementation choices
- Update README with table of contents and scripts documentation
- Update project structure to include scripts directory

Scripts successfully verify:
✅ Complete OAuth 2.0 + PKCE flows in both modes
✅ Token introspection and cross-server session management
✅ All MCP features working correctly
✅ README accuracy (tool/resource counts verified programmatically)
2025-09-11 23:52:39 -04:00
Basil Hosmer
9ffe376932
Fix endpoint consistency and documentation accuracy
- Remove /oauth prefix from introspect endpoint to match SDK pattern
- Fix auth-server endpoints: /introspect not /oauth/introspect
- Update external-verifier to call correct introspect endpoint
- Add 30-day expiry to client registration (REDIS_EXPIRY_TIMES.CLIENT_REGISTRATION)
- Remove inaccurate scratch/ directory references from README
- Add backlinks from auth-server/README.md to main README sections
- Verified all implementation details against running servers and Redis data
2025-09-11 21:08:29 -04:00
Basil Hosmer
d368c8d8c7
address comments:
* fix: add /mcp to endpoints in misc README.mds
* improve architecture interaction diagrams in README.md
* add "OAuth Flow Analysis" section in README.md
2025-09-11 17:37:52 -04:00
Basil Hosmer
b7965602ba
add docker-compose.yml 2025-09-04 22:46:32 -04:00
Basil Hosmer
3f930c5092
Phase 7: Complete README documentation for dual auth modes
- Updated Prerequisites with Redis setup (Docker Compose + OrbStack)
- Added comprehensive Authentication Modes section
- Added Testing with MCP Inspector section with step-by-step guides
- Updated Features to highlight dual mode support
- Updated Configuration with new environment variables
- Updated Development Commands with all new npm scripts
- Added architecture diagrams for both modes
- Referenced auth-server/README.md for detailed auth server info

All phases now completed - Mode 2 implementation ready for use!
2025-09-04 22:42:50 -04:00
Basil Hosmer
5c408eb43d
Phase 4: Create standalone authorization server
- Created auth-server/index.ts with full OAuth endpoint support
- Reuses EverythingAuthProvider from main server
- Added custom /oauth/introspect endpoint for token validation
- Includes fake upstream auth routes for user authentication
- Added TypeScript configuration for auth server
- Added comprehensive npm scripts for all modes:
  - dev:integrated, dev:separate, dev:auth-server
  - dev:with-separate-auth (runs both servers)
  - build:auth-server, build:all
- Added concurrently dependency for running multiple servers
- Added detailed README for auth server
- Successfully serves OAuth metadata and health endpoints
2025-09-04 22:01:57 -04:00
Basil Hosmer
4771c6eb34
Add retry logic and token caching
- Implemented retry logic (5 attempts, 3 second delay) for auth server connection
- Added token validation caching with 60-second default TTL
- Cache respects token expiration time if provided
- Cache invalidation on 401/403 responses
- Automatic cache cleanup every minute
- Debug logging for cache hits and misses
2025-09-04 19:29:54 -04:00
Basil Hosmer
03deb88ea0
Fix build and lint issues
- Corrected imports in external-verifier.ts (OAuthTokenVerifier from provider.js)
- Fixed InvalidTokenError import from errors.js
- Changed logger.warn to logger.info (warn method doesn't exist)
- Removed unused OAuthTokens import from services/auth.ts
2025-09-04 19:15:45 -04:00
Basil Hosmer
0135abd62a
Phase 3: Implement MCP server mode switching
- Created ExternalAuthVerifier for token validation with external auth server
- Added mode switching logic to src/index.ts
- Integrated mode uses mcpAuthRouter (current behavior)
- Separate mode uses mcpAuthMetadataRouter and external verifier
- Fake upstream auth routes only available in integrated mode
- Added auth server metadata fetching with error handling
2025-09-03 23:50:32 -04:00
Basil Hosmer
98cec052e4
Phase 2: Extract shared auth logic
- Created shared/types.ts with well-documented type definitions
- Created shared/auth-core.ts with core auth functions (PKCE, tokens, encryption)
- Created shared/redis-auth.ts with Redis operations for auth data
- Updated src/services/auth.ts to use shared modules
- Added TokenIntrospectionResponse interface for Mode 2
2025-09-03 23:48:27 -04:00
Basil Hosmer
1bcb85bb4f
Phase 1: Add configuration for integrated/separate auth modes
- Updated config.ts with AUTH_MODE, AUTH_SERVER_URL, AUTH_SERVER_PORT
- Added validation for port consistency between URL and PORT variables
- Added comprehensive JSDoc comments for all config variables
- Created .env.integrated and .env.separate config files
- Updated redis.ts to use REDIS_URL from config
- Added .claude/ to .gitignore
2025-09-03 22:54:27 -04:00
Jerome
4015781772
Merge pull request #7 from modelcontextprotocol/fix-splash-page-styling
Fix splash page styling issues
2025-08-28 00:25:26 +01:00
Jerome
72fcc292f4
Fix splash page styling issues
- Moved inline CSS to external stylesheet to comply with CSP
- Added black background to logo area for visibility of white MCP logo
- Updated specification link to point to dated version (2025-06-18)
- Changed "MCP Everything Server" to "MCP Example Server"
- Added route to serve styles.css file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 23:46:11 +01:00
Jerome
4254bf3e48
Merge pull request #6 from modelcontextprotocol/add-splash-page
Add splash page for MCP Everything Server
2025-08-27 14:55:27 +01:00
Jerome
0e50f08c92
Update package-lock.json dependencies
Refreshed package dependencies to ensure clean installation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 13:54:14 +01:00
Jerome
3e81ec45a8
Add splash page for MCP Everything Server
Implemented a clean, informative splash page at the root endpoint that showcases:
- Server features and capabilities
- API endpoints documentation
- Links to GitHub repository and MCP documentation
- Black and white theme matching MCP branding
- Responsive design for mobile and desktop

The splash page provides users with an immediate overview of the server's functionality
and serves as a landing page for the MCP Everything Server.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 20:07:19 +01:00
Jerome
59afc14742
Added readme to the MCP Everything Server project 2025-07-25 13:13:22 +01:00
Jerome
a7b1083243
Merge pull request #4 from modelcontextprotocol/pcarleton/prm-www
Add PRM metadata to www-authenticate
2025-07-22 13:58:33 +01:00
Paul Carleton
1160524a70
types 2025-07-17 14:20:50 +01:00
Paul Carleton
077fed19b9
Add PRM metadata to www-authenticate 2025-07-17 13:54:28 +01:00
Jerome
927d34c0d1
Fix 'stream is not readable' error in SSE message handler
- Replace getRawBody with direct req.body usage since express.json() middleware already parses it
- Add debugging support with --inspect flag for dev scripts
- Add VS Code launch configurations for debugging

The issue was that getRawBody tried to read an already-consumed stream. Since express.json()
middleware is applied globally, we can directly use req.body instead.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 13:41:34 +01:00
Jerome
2f1aa9c93b
Merge pull request #2 from modelcontextprotocol/feature/streamable-http-transport
Implement streamable HTTP transport with Redis-based session management
2025-07-10 17:30:46 +01:00
Jerome
36f86c2657
Fix TypeScript errors with proper typing
- Add MCPInitResponse interface for test responses
- Replace 'any' types with proper interface
- Remove unused JSONRPCResponse import
- Maintain type safety while fixing build errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 17:29:42 +01:00
Jerome
c6f3f40937
Fix all ESLint errors
- Remove unused imports and variables
- Replace 'any' types with proper type guards
- Add comments to empty catch blocks
- Fix Response/Request type imports in logger
- Use 'unknown' instead of 'any' for generic types
- Remove unused createMcpServer and setSessionOwner imports

All ESLint checks now pass.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 16:52:32 +01:00
Jerome
e13aefc8c4
Fix TypeScript type conflicts and update build process
- Add overrides for @types/express to resolve version conflicts
- Remove SDK build step from CI as we're now using published version
- Move mcp.png to src/static folder and update serving path
- Add copy-static script to build process

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 16:39:41 +01:00