Skip to content

Commit 3f930c5

Browse files
committed
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!
1 parent 5c408eb commit 3f930c5

File tree

1 file changed

+183
-8
lines changed

1 file changed

+183
-8
lines changed

README.md

Lines changed: 183 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,145 @@ This server serves as both primarily as a learning resource, and an example impl
3333
- **Horizontal Scaling**: Any instance can handle any request
3434

3535
### Authentication & Security
36+
- **Dual Mode Support**: Run with integrated or separate authorization server
3637
- **[OAuth 2.0](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization)**: Complete authorization flow with PKCE support
37-
- **Fake Auth Provider**: Built-in testing provider with localStorage user management
38-
- **Session Ownership**: User isolation and access control
38+
- **External Auth Ready**: Demonstrates integration with external OAuth providers
39+
- **Session Ownership**: User isolation and access control
3940
- **Security Headers**: CSP, HSTS, X-Frame-Options, and more
4041
- **Bearer Token Auth**: Middleware for protected endpoints
4142

43+
## Authentication Modes
44+
45+
The Everything Server supports two authentication modes to demonstrate different MCP deployment patterns:
46+
47+
### Integrated Mode (Default)
48+
The MCP server acts as its own OAuth 2.0 authorization server. This is simpler to deploy and suitable for standalone MCP servers.
49+
50+
```bash
51+
npm run dev:integrated
52+
```
53+
54+
### Separate Mode
55+
The MCP server delegates authentication to a standalone authorization server. This demonstrates how MCP servers can integrate with existing OAuth infrastructure. See [auth-server/README.md](auth-server/README.md) for more details about the standalone auth server.
56+
57+
```bash
58+
# Start both the auth server and MCP server
59+
npm run dev:with-separate-auth
60+
61+
# Or run them separately:
62+
# Terminal 1: Start the authorization server
63+
npm run dev:auth-server
64+
65+
# Terminal 2: Start the MCP server in separate mode
66+
npm run dev:separate
67+
```
68+
69+
In production, the separate authorization server would typically be replaced with:
70+
- Corporate SSO (Auth0, Okta)
71+
- Cloud providers (AWS Cognito, Azure AD)
72+
- Social providers (Google, GitHub)
73+
74+
### Testing with MCP Inspector
75+
76+
The MCP Inspector is a web-based tool for testing MCP servers. You can run it locally:
77+
```bash
78+
npx -y @modelcontextprotocol/inspector
79+
```
80+
81+
#### Integrated Mode
82+
```bash
83+
# 1. Start Redis
84+
docker compose up -d
85+
86+
# 2. Start the server
87+
npm run dev:integrated
88+
89+
# 3. Open MCP Inspector
90+
npx -y @modelcontextprotocol/inspector
91+
92+
# 4. Connect and test:
93+
# - Connect to http://localhost:3232
94+
# - Navigate to the Auth tab
95+
# - Complete the OAuth flow
96+
# - All auth endpoints will be served from :3232
97+
```
98+
99+
#### Separate Mode
100+
```bash
101+
# 1. Start Redis
102+
docker compose up -d
103+
104+
# 2. Start both servers
105+
npm run dev:with-separate-auth
106+
107+
# 3. Open MCP Inspector
108+
npx -y @modelcontextprotocol/inspector
109+
110+
# 4. Connect and test:
111+
# - Connect to http://localhost:3232
112+
# - Navigate to the Auth tab
113+
# - The auth flow will redirect to :3001 for authentication
114+
# - After auth, tokens from :3001 will be used on :3232
115+
```
116+
117+
### Architecture Diagrams
118+
119+
#### Integrated Mode
120+
```
121+
┌──────────┐ ┌─────────────────┐
122+
│ MCP │◀────▶│ MCP Server │
123+
│ Inspector│ │ (port 3232) │
124+
└──────────┘ │ │
125+
│ - OAuth Server │
126+
│ - Resource Server│
127+
└─────────────────┘
128+
```
129+
130+
#### Separate Mode
131+
```
132+
┌──────────┐ ┌─────────────────┐ ┌─────────────────┐
133+
│ MCP │◀────▶│ MCP Server │◀────▶│ Auth Server │
134+
│ Inspector│ │ (port 3232) │ │ (port 3001) │
135+
└──────────┘ │ │ │ │
136+
│ │ - Resource Server│ │ - OAuth Server │
137+
└───────────▶│ │ │ │
138+
└─────────────────┘ └─────────────────┘
139+
```
140+
42141
## Installation
43142

44143
### Prerequisites
45144
- Node.js >= 16
46-
- Redis server
145+
- Redis server (see Redis setup below)
47146
- npm or yarn
48147

148+
### Redis Setup
149+
The server requires Redis for session management and message routing.
150+
151+
**Option 1: Docker Compose (Recommended)**
152+
153+
Install a Docker runtime:
154+
- **macOS**: [OrbStack](https://orbstack.dev/) - Fast, lightweight, and free
155+
```bash
156+
brew install orbstack
157+
# Or download from https://orbstack.dev/download
158+
```
159+
- **Windows/Linux**: [Docker Desktop](https://www.docker.com/products/docker-desktop)
160+
161+
Start Redis:
162+
```bash
163+
docker compose up -d
164+
```
165+
166+
**Option 2: Local Installation**
167+
```bash
168+
# macOS
169+
brew install redis && brew services start redis
170+
171+
# Ubuntu/Debian
172+
sudo apt-get install redis-server && sudo systemctl start redis
173+
```
174+
49175
### Setup
50176
```bash
51177
# Clone the repository
@@ -62,30 +188,79 @@ cp .env.example .env
62188

63189
### Configuration
64190
Environment variables (`.env` file):
65-
```
66-
PORT=3232 # Server port
191+
```bash
192+
# Server Configuration
193+
PORT=3232 # MCP server port
67194
BASE_URI=http://localhost:3232 # Base URI for OAuth redirects
68-
REDIS_HOST=localhost # Redis server host
69-
REDIS_PORT=6379 # Redis server port
70-
REDIS_PASSWORD= # Redis password (if required)
195+
196+
# Redis Configuration
197+
REDIS_URL=redis://localhost:6379 # Redis connection URL
198+
199+
# Authentication Mode (integrated | separate)
200+
AUTH_MODE=integrated # Default: integrated mode
201+
202+
# Separate Mode Configuration (only used when AUTH_MODE=separate)
203+
AUTH_SERVER_URL=http://localhost:3001 # External auth server URL
204+
AUTH_SERVER_PORT=3001 # Auth server port (for standalone server)
205+
```
206+
207+
**Pre-configured environment files:**
208+
- `.env.integrated` - Configuration for integrated mode
209+
- `.env.separate` - Configuration for separate mode
210+
211+
```bash
212+
# Use integrated mode
213+
cp .env.integrated .env
214+
215+
# Use separate mode
216+
cp .env.separate .env
71217
```
72218

73219
## Development
74220

75221
### Commands
222+
223+
#### Development
76224
```bash
77225
# Start development server with hot reload
78226
npm run dev
79227

228+
# Start in integrated mode (MCP server as OAuth server)
229+
npm run dev:integrated
230+
231+
# Start in separate mode (external auth server)
232+
npm run dev:separate
233+
234+
# Start standalone authorization server
235+
npm run dev:auth-server
236+
237+
# Start both auth server and MCP server in separate mode
238+
npm run dev:with-separate-auth
239+
80240
# Start development server with debugging
81241
npm run dev:break
242+
```
82243

244+
#### Build & Production
245+
```bash
83246
# Build TypeScript to JavaScript
84247
npm run build
85248

249+
# Build authorization server
250+
npm run build:auth-server
251+
252+
# Build everything
253+
npm run build:all
254+
86255
# Run production server
87256
npm start
88257

258+
# Run production auth server
259+
npm run start:auth-server
260+
```
261+
262+
#### Testing & Quality
263+
```bash
89264
# Run linting
90265
npm run lint
91266

0 commit comments

Comments
 (0)