Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4d44c3f
Ignore the .mcp.json configuration (for now)
andrewdmontgomery Jul 25, 2025
d6a2ea7
Add @cloudflare/workers-oauth-provider package dependency
andrewdmontgomery Jul 25, 2025
522cd00
Add OAuth Envs
andrewdmontgomery Jul 25, 2025
5ccdfda
Create OAuthProvider
andrewdmontgomery Jul 25, 2025
880c814
Integrate OAuth authorization into MCP server request handling
andrewdmontgomery Jul 25, 2025
8da1238
Add skeleton of auth.ts
andrewdmontgomery Jul 25, 2025
8efd911
Implement the Cloudflare recommended pattern
andrewdmontgomery Jul 26, 2025
5f9a284
Remove env.ts, use generated types from Cloudflare wrangler
andrewdmontgomery Jul 26, 2025
4f35e1e
Organized OAuth source files
andrewdmontgomery Jul 26, 2025
3a50581
Add support for fetching my profile with OAuth token
andrewdmontgomery Jul 26, 2025
98628b8
Update workers-types
andrewdmontgomery Jul 26, 2025
9f2e0eb
Update GravatarMcpServer with UserProps
andrewdmontgomery Jul 26, 2025
09dec71
Add tool: get_my_profile
andrewdmontgomery Jul 26, 2025
494c34c
Create the shared utilities
andrewdmontgomery Jul 26, 2025
57a8306
Create the tool registry system
andrewdmontgomery Jul 26, 2025
9b135d5
Delete registry.ts
andrewdmontgomery Jul 26, 2025
76268dc
Update baseUrl to baseURL to match what fetch expects
andrewdmontgomery Jul 27, 2025
7442213
Swap out the fetch http client for the axios client in the generated …
andrewdmontgomery Jul 28, 2025
13c25a6
Delete integration test
andrewdmontgomery Jul 28, 2025
94b7cd3
Update tests to be compatible with our changes
andrewdmontgomery Jul 28, 2025
f3c9258
Constrain test coverage report to source files
andrewdmontgomery Jul 28, 2025
f7130b7
Add tests
andrewdmontgomery Jul 28, 2025
a3047af
Add OAuth scope: gravatar-profile:manage
andrewdmontgomery Jul 28, 2025
9a11bfc
Add tool: update_my_profile
andrewdmontgomery Jul 28, 2025
c77a773
Create .dev.vars.example
andrewdmontgomery Jul 28, 2025
54ad2a2
Update README.md with details about handling ENVs and secrets
andrewdmontgomery Jul 28, 2025
b0f5ecd
Update CLAUDE.md with details about updating ENVs and secrets
andrewdmontgomery Jul 28, 2025
cbcdf3b
Add tool: search-profiles-by-verified-account
andrewdmontgomery Jul 28, 2025
cf8266f
Fix redirect uris in wrangler.jsonc
andrewdmontgomery Jul 28, 2025
44517e6
Fix handling of token expiration
andrewdmontgomery Jul 28, 2025
638de3f
Improved logging when OAuth errors occur
andrewdmontgomery Jul 28, 2025
4c92582
Move image helpers into a separate source file
andrewdmontgomery Jul 28, 2025
300a1a9
Add TODO comment in integration guide fetcher
andrewdmontgomery Jul 28, 2025
e74e28b
Fix rebase mistakes
andrewdmontgomery Jul 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .dev.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Gravatar MCP Server - Development Secrets and Overrides
#
# Copy this file to `.dev.vars` and fill in your actual values.
# This file contains ONLY secrets and development-specific overrides.
# All other configuration is defined in wrangler.jsonc for clarity.

# =============================================================================
# SECRETS (Not stored in wrangler.jsonc for security)
# =============================================================================

# Gravatar API Configuration (Optional)
# Get your API key from: https://gravatar.com/developers/
GRAVATAR_API_KEY="your-gravatar-api-key-here"

# OAuth Client Secrets
# Get your app secrets from: https://developer.wordpress.com/apps/
OAUTH_CLIENT_ID=your-wordpress-app-client-id
OAUTH_CLIENT_SECRET=your-wordpress-app-client-secret

# OAuth Server Configuration Secrets
# Generate random 32+ character strings for these:
# You can use: openssl rand -hex 32
OAUTH_SIGNING_SECRET=generate-a-random-32-plus-character-string-for-jwt-signing
OAUTH_COOKIE_SECRET=generate-a-random-32-plus-character-string-for-cookie-encryption

# =============================================================================
# DEVELOPMENT-ONLY OVERRIDES (Optional)
# =============================================================================

# Debug Configuration
# Set to 'true' to enable detailed MCP transport logging
DEBUG=true

# OAuth 2.1 Authentication Configuration
# Set to 'true' to enable OAuth authentication for MCP endpoints
OAUTH_ENABLED=true

# OAuth Server Configuration (Development URLs)
# These should match your local development setup
OAUTH_ISSUER_URL=http://localhost:8787/mcp
OAUTH_BASE_URL=http://localhost:8787/mcp

# =============================================================================
# OPTIONAL DEVELOPMENT OVERRIDES
# Uncomment to override wrangler.jsonc defaults for local testing
# =============================================================================

# DNS Rebinding Protection Configuration
# ENABLE_DNS_REBINDING_PROTECTION=true
# ALLOWED_HOSTS=localhost:8787,127.0.0.1:8787
# ALLOWED_ORIGINS=http://localhost:8787,http://127.0.0.1:8787,http://localhost:6274

# OAuth Service Documentation
# OAUTH_SERVICE_DOCS_URL=https://docs.yourapp.com/oauth

# =============================================================================
# SETUP INSTRUCTIONS
# =============================================================================
#
# 1. Copy this file to `.dev.vars`:
# cp .dev.vars.example .dev.vars
#
# 2. Get a Gravatar API key (optional):
# - Visit https://gravatar.com/developers/
# - Create an application and copy the API key
# - Replace "your-gravatar-api-key-here" above
#
# 3. Create a WordPress.com OAuth app:
# - Visit https://developer.wordpress.com/apps/
# - Create a new application
# - Set redirect URI to: http://localhost:8787/callback
# - Copy the Client ID and Client Secret
# - Replace the OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET above
#
# 4. Generate random secrets:
# - Run: openssl rand -hex 32
# - Use the output for OAUTH_SIGNING_SECRET and OAUTH_COOKIE_SECRET
# - Make sure each secret is unique
#
# 5. Test your setup:
# - Run: npm run dev
# - Visit: http://localhost:8787
# - Try the OAuth authentication flow
#
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,6 @@ dist
# Client
.clinerules/
memory-bank/

# MCP
.mcp.json
48 changes: 38 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,19 +367,47 @@ export default {
};
```

## API Key Configuration
## Development Setup

The server supports optional Gravatar API key configuration:
### Environment Configuration

### Production
```bash
npx wrangler secret put GRAVATAR_API_KEY
```
The server requires environment variables for secrets and configuration:

### Development
Create `.dev.vars`:
1. **Copy the example file:**
```bash
cp .dev.vars.example .dev.vars
```

2. **Fill in your values:**
- Get a Gravatar API key from https://gravatar.com/developers/
- Create a WordPress.com OAuth app at https://developer.wordpress.com/apps/
- Generate random secrets for JWT signing and cookie encryption
- See `.dev.vars.example` for detailed setup instructions

### Configuration Architecture

- **`wrangler.jsonc`** - Contains all explicit configuration for each environment
- **`.dev.vars`** - Contains only secrets and development-specific overrides
- **`.dev.vars.example`** - Template file with setup instructions

### Production Deployment

Set secrets for each environment using Wrangler:

**For staging:**
```bash
GRAVATAR_API_KEY=your-api-key-here
npx wrangler secret put GRAVATAR_API_KEY --env staging
npx wrangler secret put OAUTH_CLIENT_ID --env staging
npx wrangler secret put OAUTH_CLIENT_SECRET --env staging
npx wrangler secret put OAUTH_SIGNING_SECRET --env staging
npx wrangler secret put OAUTH_COOKIE_SECRET --env staging
```

The API key enables access to additional profile fields and authenticated endpoints.
**For production:**
```bash
npx wrangler secret put GRAVATAR_API_KEY --env production
npx wrangler secret put OAUTH_CLIENT_ID --env production
npx wrangler secret put OAUTH_CLIENT_SECRET --env production
npx wrangler secret put OAUTH_SIGNING_SECRET --env production
npx wrangler secret put OAUTH_COOKIE_SECRET --env production
```
48 changes: 35 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,52 @@ When using email-based tools, you can provide any valid email format. The system
2. Generate the appropriate hash for API requests
3. Process the email securely without storing it

## API Key Configuration (Optional)
## Configuration

The server works without authentication, but you can optionally configure a Gravatar API key to access additional profile fields.
### Development Setup

### For Production Deployment
The server requires environment variables for secrets and OAuth configuration:

Set the API key as a Cloudflare Workers secret:
1. **Copy the example file:**
```bash
cp .dev.vars.example .dev.vars
```

```bash
npx wrangler secret put GRAVATAR_API_KEY
```
2. **Fill in your values:**
- Get a Gravatar API key from https://gravatar.com/developers/ (optional)
- Create a WordPress.com OAuth app at https://developer.wordpress.com/apps/
- Generate random secrets for JWT signing and cookie encryption
- See `.dev.vars.example` for detailed setup instructions

### Configuration Architecture

When prompted, enter your Gravatar API key. The key will be securely stored and automatically used by the deployed server.
- **`wrangler.jsonc`** - Contains all explicit configuration for each environment
- **`.dev.vars`** - Contains only secrets and development-specific overrides
- **`.dev.vars.example`** - Template file with setup instructions (safe to commit)

### For Local Development
### Production Deployment

Create a `.dev.vars` file in the project root:
Set secrets for each environment using Wrangler:

**For staging:**
```bash
npx wrangler secret put GRAVATAR_API_KEY --env staging
npx wrangler secret put OAUTH_CLIENT_ID --env staging
npx wrangler secret put OAUTH_CLIENT_SECRET --env staging
npx wrangler secret put OAUTH_SIGNING_SECRET --env staging
npx wrangler secret put OAUTH_COOKIE_SECRET --env staging
```

**For production:**
```bash
# .dev.vars
GRAVATAR_API_KEY=your-api-key-here
npx wrangler secret put GRAVATAR_API_KEY --env production
npx wrangler secret put OAUTH_CLIENT_ID --env production
npx wrangler secret put OAUTH_CLIENT_SECRET --env production
npx wrangler secret put OAUTH_SIGNING_SECRET --env production
npx wrangler secret put OAUTH_COOKIE_SECRET --env production
```

This file is automatically loaded during local development and should not be committed to version control (it's already in `.gitignore`).
The server works without the Gravatar API key, but configuring it enables access to additional profile fields.

## Development

Expand Down
Loading