@@ -6,16 +6,36 @@ See [the documentation](https://mcp-auth.dev/docs) for the full guide.
6
6
7
7
## Prerequisites
8
8
9
+ ### Virtual environment setup
10
+
11
+ First, navigate to the project root directory and set up a virtual environment:
12
+
13
+ ``` bash
14
+ # Navigate to the project root directory (one level up from samples)
15
+ cd ..
16
+
17
+ # Create a new virtual environment using uv
18
+ uv venv
19
+
20
+ # Activate the virtual environment (optional when using 'uv run')
21
+ source .venv/bin/activate
22
+ ```
23
+
9
24
### Install dependencies
10
25
11
- First, install the required dependencies:
26
+ Install the required dependencies using uv :
12
27
13
28
``` bash
14
- # Install production dependencies
15
- pip install -e .
29
+ # Make sure you are in the project root directory (where pyproject.toml is located)
30
+ # Install the project in development mode
31
+ uv pip install -e .
16
32
17
33
# Install development dependencies (optional, for development and testing)
18
- pip install -e " .[dev]"
34
+ uv pip install -e " .[dev]"
35
+
36
+ # Alternative: Traditional pip method (after activating virtual environment)
37
+ # pip install -e .
38
+ # pip install -e ".[dev]"
19
39
```
20
40
21
41
### Environment setup
@@ -27,7 +47,7 @@ Set up the required environment variable:
27
47
export MCP_AUTH_ISSUER=< your_auth_issuer_url>
28
48
```
29
49
30
- ## Directory Structure
50
+ ## Directory structure
31
51
32
52
- ` current/ ` : Latest sample implementations (MCP server as resource server)
33
53
- ` v0_1_1/ ` : Legacy sample implementations (MCP server as authorization server)
@@ -48,8 +68,8 @@ To run the Todo Manager server:
48
68
# Make sure you are in the samples directory first
49
69
cd samples
50
70
51
- # Start the Todo Manager server
52
- uvicorn current.todo-manager.server:app --host 0 .0.0.0 --port 3001
71
+ # Start the Todo Manager server using uv
72
+ uv run uvicorn current.todo-manager.server:app --host 127 .0.0.1 --port 3001
53
73
```
54
74
55
75
## Legacy examples (v0.1.1)
@@ -63,12 +83,13 @@ A simple server that demonstrates basic authentication. It provides a single too
63
83
- ` whoami ` : Returns the authenticated user's information
64
84
65
85
To run the WhoAmI server:
86
+
66
87
``` bash
67
88
# Make sure you are in the samples directory first
68
89
cd samples
69
90
70
- # Start the WhoAmI server
71
- uvicorn v0_1_1.whoami:app --host 0 .0.0.0 --port 3001
91
+ # Start the WhoAmI server using uv
92
+ uv run uvicorn v0_1_1.whoami:app --host 127 .0.0.1 --port 3001
72
93
```
73
94
74
95
### Todo Manager MCP server (legacy)
@@ -80,10 +101,11 @@ Legacy version of the todo manager that acts as both authorization and resource
80
101
- ` delete-todo ` : Delete a todo (requires ` delete:todos ` scope for others' todos)
81
102
82
103
To run the legacy Todo Manager server:
104
+
83
105
``` bash
84
106
# Make sure you are in the samples directory first
85
107
cd samples
86
108
87
- # Start the legacy Todo Manager server
88
- uvicorn v0_1_1.todo-manager.server:app --host 0 .0.0.0 --port 3001
109
+ # Start the legacy Todo Manager server using uv
110
+ uv run uvicorn v0_1_1.todo-manager.server:app --host 127 .0.0.1 --port 3001
89
111
```
0 commit comments