Skip to content

Commit 695f9f6

Browse files
committed
Add customization guide and fix broken doc references
- Create docs/customization-guide.md with guidance on replacing demo functionality - Add customization section to main README - Fix all references to renamed oauth-architecture-patterns.md - Update repository structure comments to clarify what to replace vs keep
1 parent 78a7d1c commit 695f9f6

4 files changed

Lines changed: 133 additions & 8 deletions

File tree

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,24 @@ For detailed instructions, see [Installation](#installation).
5353
This repository demonstrates a production-ready MCP deployment pattern with separate authorization and resource servers:
5454

5555
```
56-
auth-server/ # OAuth 2.0 authorization server
56+
auth-server/ # OAuth 2.0 authorization server (demo only - replace in production)
5757
└── src/ # Authorization endpoints and token management
5858
59-
mcp-server/ # MCP resource server
59+
mcp-server/ # MCP resource server (customize tools/resources/prompts)
6060
└── src/ # MCP protocol implementation with external auth
6161
6262
scripts/ # Testing and deployment scripts
6363
docs/ # Architecture and API documentation
6464
examples/ # Example code and usage patterns
6565
```
6666

67-
The architecture separates authentication concerns from MCP functionality, allowing you to integrate with existing OAuth providers (Auth0, Okta, etc.) or deploy your own authorization server.
67+
The architecture separates authentication concerns from MCP functionality, allowing you to integrate with commercial OAuth providers (Auth0, Okta, etc.).
68+
69+
## Customizing for Your Use Case
70+
71+
This is a reference implementation with demo tools, resources, and prompts. To adapt it for production:
72+
- **Replace MCP features:** See [Customization Guide](docs/customization-guide.md) for replacing demo functionality with your own
73+
- **Integrate OAuth provider:** See [OAuth Architecture Patterns](docs/oauth-architecture-patterns.md) for production authentication setup
6874

6975
## Usage Examples
7076

@@ -174,7 +180,7 @@ sequenceDiagram
174180
Client->>User: 9. Results
175181
```
176182

177-
The auth server is separate so you can easily replace it with Auth0, Okta, or any OAuth provider. See [docs/oauth-patterns.md](docs/oauth-patterns.md) for alternative architectures.
183+
The auth server is separate so you can easily replace it with Auth0, Okta, or any OAuth provider. See [docs/oauth-architecture-patterns.md](docs/oauth-architecture-patterns.md) for integration guidance.
178184

179185
## Table of Contents
180186

@@ -320,7 +326,7 @@ This architecture pattern:
320326
- **Scales independently**: Auth and MCP servers can scale based on their load
321327
- **Follows standards**: Uses OAuth 2.0 and token introspection (RFC 7662)
322328

323-
For alternative patterns like embedded OAuth, see [docs/oauth-patterns.md](docs/oauth-patterns.md).
329+
For alternative patterns like embedded OAuth, see [docs/oauth-architecture-patterns.md](docs/oauth-architecture-patterns.md).
324330

325331
### OAuth Flow
326332

@@ -361,9 +367,10 @@ The `/mock-upstream-idp` endpoints simulate what a real identity provider (Googl
361367
├── scripts/ # Testing and deployment
362368
│ └── test-e2e.sh # End-to-end OAuth + MCP verification
363369
├── docs/
370+
│ ├── customization-guide.md # How to adapt this for your use case
364371
│ ├── endpoints.md # API endpoint reference
365372
│ ├── oauth-flow.md # OAuth flow documentation
366-
│ ├── oauth-patterns.md # Alternative OAuth patterns
373+
│ ├── oauth-architecture-patterns.md # OAuth integration guidance
367374
│ └── session-ownership.md # Session management details
368375
├── examples/ # Example code and usage patterns
369376
│ ├── client.js # Node.js client example

auth-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ This server stores in Redis:
119119

120120
- [Main README](../README.md) - Complete project documentation
121121
- [MCP Server README](../mcp-server/README.md) - How MCP server uses these tokens
122-
- [OAuth Patterns](../docs/oauth-patterns.md) - OAuth architecture patterns
122+
- [OAuth Architecture Patterns](../docs/oauth-architecture-patterns.md) - OAuth integration options
123123
- [OAuth Flow](../docs/oauth-flow.md) - Detailed OAuth flow analysis

docs/customization-guide.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Customization Guide
2+
3+
This reference implementation includes demo functionality to showcase MCP features. Here's how to adapt it for your own use case.
4+
5+
## Overview: What to Customize vs. Keep
6+
7+
**Replace with your own:**
8+
- MCP tools, resources, and prompts (your business logic)
9+
- Authentication provider (use commercial OAuth provider)
10+
11+
**Keep as-is (infrastructure):**
12+
- Redis transport and session management
13+
- HTTP handlers and routing
14+
- Security middleware and rate limiting
15+
- Logging infrastructure
16+
17+
---
18+
19+
## Customizing MCP Functionality
20+
21+
All MCP feature implementations live in **`mcp-server/src/services/mcp.ts`**. This is where you define what your server can do.
22+
23+
### Tools
24+
25+
Replace the 7 demo tools (echo, add, etc.) with your actual tools:
26+
27+
**Location:** `createMcpServer()` function, look for the `CallToolRequestSchema` handler
28+
29+
**What to change:**
30+
- Tool definitions: name, description, input schema (using Zod)
31+
- Tool execution logic: what happens when the tool is called
32+
- Return format: text, images, or embedded resources
33+
34+
**Pattern:** Each tool validates input with a Zod schema and returns content in MCP format.
35+
36+
### Resources
37+
38+
Replace the 100 fake resources with your actual data sources:
39+
40+
**Location:** `createMcpServer()` function, resource-related handlers:
41+
- `ListResourcesRequestSchema` - List available resources
42+
- `ReadResourceRequestSchema` - Read specific resources
43+
- `SubscribeRequestSchema` / `UnsubscribeRequestSchema` - Resource updates
44+
45+
**What to change:**
46+
- Resource URIs and names
47+
- Data fetching logic
48+
- Pagination if needed
49+
- Update notifications for subscribed resources
50+
51+
**Pattern:** Resources use URIs (e.g., `db://users/123`) and return content as text, JSON, or binary.
52+
53+
### Prompts
54+
55+
Replace the 3 demo prompts with useful prompts for your domain:
56+
57+
**Location:** `createMcpServer()` function, prompt-related handlers:
58+
- `ListPromptsRequestSchema` - List available prompts
59+
- `GetPromptRequestSchema` - Return prompt content
60+
61+
**What to change:**
62+
- Prompt names and descriptions
63+
- Prompt arguments and validation
64+
- Prompt content and embedded resources
65+
66+
**Pattern:** Prompts can include dynamic arguments and reference resources.
67+
68+
---
69+
70+
## Customizing Authentication
71+
72+
**Replace the demo auth server** with a commercial OAuth provider (Auth0, Okta, Azure AD, AWS Cognito, Google, GitHub, etc.).
73+
74+
See [OAuth Architecture Patterns](oauth-architecture-patterns.md#using-a-commercial-auth-provider) for detailed integration steps.
75+
76+
**Do not repurpose the demo auth server** - it's designed for development/testing only. Commercial providers offer better security, reliability, and user management.
77+
78+
---
79+
80+
## Configuration
81+
82+
Update environment variables for your deployment:
83+
84+
**MCP Server** (`mcp-server/.env`):
85+
```bash
86+
BASE_URI=https://your-mcp-server.com
87+
PORT=443
88+
AUTH_SERVER_URL=https://your-tenant.auth0.com
89+
REDIS_URL=redis://your-redis-server:6379
90+
```
91+
92+
**Auth Server** (only if using the demo server for development):
93+
```bash
94+
AUTH_SERVER_URL=http://localhost:3001
95+
BASE_URI=https://your-mcp-server.com
96+
```
97+
98+
---
99+
100+
## Testing Your Customizations
101+
102+
1. **Unit tests:** Add tests for your tools/resources in `mcp-server/src/services/`
103+
2. **Integration tests:** Test with MCP Inspector or client.js
104+
3. **Build and lint:** Run `npm run build && npm run lint`
105+
4. **End-to-end:** Use the examples to verify OAuth and MCP flows
106+
107+
---
108+
109+
## Next Steps
110+
111+
1. Fork/clone this repository
112+
2. Replace tools, resources, and prompts in `mcp-server/src/services/mcp.ts`
113+
3. Integrate with your OAuth provider (see OAuth Architecture Patterns doc)
114+
4. Update environment variables for your deployment
115+
5. Test thoroughly before deploying
116+
117+
For questions about the MCP protocol itself, see the [MCP specification](https://modelcontextprotocol.io/specification).

mcp-server/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ To use a commercial OAuth provider instead of the demo auth server, see [OAuth A
130130
## Related Documentation
131131

132132
- [Main README](../README.md) - Complete project documentation
133+
- [Customization Guide](../docs/customization-guide.md) - How to adapt this for your use case
133134
- [Auth Server README](../auth-server/README.md) - The demo OAuth provider
134-
- [OAuth Patterns](../docs/oauth-patterns.md) - OAuth architecture patterns
135+
- [OAuth Architecture Patterns](../docs/oauth-architecture-patterns.md) - OAuth integration options
135136
- [OAuth Flow](../docs/oauth-flow.md) - Detailed OAuth flow analysis
136137
- [Session Ownership](../docs/session-ownership.md) - Session management details

0 commit comments

Comments
 (0)