docs: fix simple-auth README references to non-existent scripts (#1829)
This commit is contained in:
parent
3ffe142e9a
commit
6b69f6354a
2 changed files with 51 additions and 26 deletions
|
|
@ -19,22 +19,41 @@ uv sync --reinstall
|
||||||
|
|
||||||
### 1. Start an MCP server with OAuth support
|
### 1. Start an MCP server with OAuth support
|
||||||
|
|
||||||
|
The simple-auth server example provides three server configurations. See [examples/servers/simple-auth/README.md](../../servers/simple-auth/README.md) for full details.
|
||||||
|
|
||||||
|
#### Option A: New Architecture (Recommended)
|
||||||
|
|
||||||
|
Separate Authorization Server and Resource Server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Example with mcp-simple-auth
|
# Terminal 1: Start Authorization Server on port 9000
|
||||||
cd path/to/mcp-simple-auth
|
cd examples/servers/simple-auth
|
||||||
uv run mcp-simple-auth --transport streamable-http --port 3001
|
uv run mcp-simple-auth-as --port=9000
|
||||||
|
|
||||||
|
# Terminal 2: Start Resource Server on port 8001
|
||||||
|
cd examples/servers/simple-auth
|
||||||
|
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Option B: Legacy Server (Backwards Compatibility)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Single server that acts as both AS and RS (port 8000)
|
||||||
|
cd examples/servers/simple-auth
|
||||||
|
uv run mcp-simple-auth-legacy --port=8000 --transport=streamable-http
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Run the client
|
### 2. Run the client
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Connect to Resource Server (new architecture, default port 8001)
|
||||||
|
MCP_SERVER_PORT=8001 uv run mcp-simple-auth-client
|
||||||
|
|
||||||
|
# Connect to Legacy Server (port 8000)
|
||||||
uv run mcp-simple-auth-client
|
uv run mcp-simple-auth-client
|
||||||
|
|
||||||
# Or with custom server URL
|
|
||||||
MCP_SERVER_PORT=3001 uv run mcp-simple-auth-client
|
|
||||||
|
|
||||||
# Use SSE transport
|
# Use SSE transport
|
||||||
MCP_TRANSPORT_TYPE=sse uv run mcp-simple-auth-client
|
MCP_SERVER_PORT=8001 MCP_TRANSPORT_TYPE=sse uv run mcp-simple-auth-client
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Complete OAuth flow
|
### 3. Complete OAuth flow
|
||||||
|
|
@ -48,27 +67,32 @@ The client will open your browser for authentication. After completing OAuth, yo
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
🔐 Simple MCP Auth Client
|
🚀 Simple MCP Auth Client
|
||||||
Connecting to: http://localhost:3001
|
Connecting to: http://localhost:8001/mcp
|
||||||
|
Transport type: streamable-http
|
||||||
|
|
||||||
Please visit the following URL to authorize the application:
|
🔗 Attempting to connect to http://localhost:8001/mcp...
|
||||||
http://localhost:3001/authorize?response_type=code&client_id=...
|
📡 Opening StreamableHTTP transport connection with auth...
|
||||||
|
Opening browser for authorization: http://localhost:9000/authorize?...
|
||||||
|
|
||||||
✅ Connected to MCP server at http://localhost:3001
|
✅ Connected to MCP server at http://localhost:8001/mcp
|
||||||
|
|
||||||
mcp> list
|
mcp> list
|
||||||
📋 Available tools:
|
📋 Available tools:
|
||||||
1. echo - Echo back the input text
|
1. get_time
|
||||||
|
Description: Get the current server time.
|
||||||
|
|
||||||
mcp> call echo {"text": "Hello, world!"}
|
mcp> call get_time
|
||||||
🔧 Tool 'echo' result:
|
🔧 Tool 'get_time' result:
|
||||||
Hello, world!
|
{"current_time": "2024-01-15T10:30:00", "timezone": "UTC", ...}
|
||||||
|
|
||||||
mcp> quit
|
mcp> quit
|
||||||
👋 Goodbye!
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
- `MCP_SERVER_PORT` - Server URL (default: 8000)
|
| Environment Variable | Description | Default |
|
||||||
- `MCP_TRANSPORT_TYPE` - Transport type: `streamable-http` (default) or `sse`
|
|---------------------|-------------|---------|
|
||||||
|
| `MCP_SERVER_PORT` | Port number of the MCP server | `8000` |
|
||||||
|
| `MCP_TRANSPORT_TYPE` | Transport type: `streamable-http` or `sse` | `streamable-http` |
|
||||||
|
| `MCP_CLIENT_METADATA_URL` | Optional URL for client metadata (CIMD) | None |
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ uv run mcp-simple-auth-as --port=9000
|
||||||
cd examples/servers/simple-auth
|
cd examples/servers/simple-auth
|
||||||
|
|
||||||
# Start Resource Server on port 8001, connected to Authorization Server
|
# Start Resource Server on port 8001, connected to Authorization Server
|
||||||
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http
|
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http
|
||||||
|
|
||||||
# With RFC 8707 strict resource validation (recommended for production)
|
# With RFC 8707 strict resource validation (recommended for production)
|
||||||
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http --oauth-strict
|
uv run mcp-simple-auth-rs --port=8001 --auth-server=http://localhost:9000 --transport=streamable-http --oauth-strict
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -84,8 +84,9 @@ For backwards compatibility with older MCP implementations, a legacy server is p
|
||||||
### Running the Legacy Server
|
### Running the Legacy Server
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Start legacy authorization server on port 8002
|
# Start legacy server on port 8000 (the default)
|
||||||
uv run mcp-simple-auth-legacy --port=8002
|
cd examples/servers/simple-auth
|
||||||
|
uv run mcp-simple-auth-legacy --port=8000 --transport=streamable-http
|
||||||
```
|
```
|
||||||
|
|
||||||
**Differences from the new architecture:**
|
**Differences from the new architecture:**
|
||||||
|
|
@ -101,7 +102,7 @@ uv run mcp-simple-auth-legacy --port=8002
|
||||||
```bash
|
```bash
|
||||||
# Test with client (will automatically fall back to legacy discovery)
|
# Test with client (will automatically fall back to legacy discovery)
|
||||||
cd examples/clients/simple-auth-client
|
cd examples/clients/simple-auth-client
|
||||||
MCP_SERVER_PORT=8002 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client
|
MCP_SERVER_PORT=8000 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client
|
||||||
```
|
```
|
||||||
|
|
||||||
The client will:
|
The client will:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue