Sync vault notes: April-November 2026 sessions, projects, and architecture
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe4fe656be
commit
994c7ae577
379 files changed
+55216
-107
No files matched your search
@@ -0,0 +1,361 @@
|
||||
---
|
||||
title: Hermes MCP OAuth & ChatGPT Integration
|
||||
date: 2026-04-15
|
||||
tags:
|
||||
- mcp
|
||||
- hermes
|
||||
- obsidian
|
||||
- oauth
|
||||
- chatgpt
|
||||
- ai-agents
|
||||
- deployment
|
||||
source: Claude / Kimi Code conversation
|
||||
---
|
||||
|
||||
# Hermes MCP — Obsidian, OAuth, and ChatGPT Integration
|
||||
|
||||
This note captures the full conversation history about extending `hermes-mcp` with Obsidian Sync support, adding HTTP/SSE transport, implementing OAuth 2.0 for ChatGPT MCP connector compatibility, and verifying deployment on Kubernetes.
|
||||
|
||||
---
|
||||
|
||||
## Initial Question: Using Obsidian Sync with hermes-mcp
|
||||
|
||||
**User:**
|
||||
> now that I have https://obsidian-sync.fetcherpay.com configured how can I use it? Can I incorporate it into the custom mcp hermes-mcp that checks connects my yahoo and fetcherpay.com emails or should I create another mcp for me to use it as either a mcp service or a skill? thoughts? I want to be able to use it in all my ai agents as well as code and others like it
|
||||
|
||||
**Claude:**
|
||||
> Recommendation: Extend hermes-mcp, Don't Create a Separate One
|
||||
> Your obsidian-sync.fetcherpay.com service should be integrated into your existing hermes-mcp server as additional tools/resources, not as a standalone MCP server or skill.
|
||||
>
|
||||
> Key reasons:
|
||||
> - MCP servers provide structured tool access to external systems
|
||||
> - Your email and knowledge management are both personal communication/knowledge infrastructure
|
||||
> - One server, unified auth, consistent error handling
|
||||
>
|
||||
> Suggested tools:
|
||||
> - `obsidian_search_notes`
|
||||
> - `obsidian_read_note`
|
||||
> - `obsidian_append_to_note`
|
||||
> - `obsidian_sync_status`
|
||||
|
||||
---
|
||||
|
||||
## Prompt to Implement Obsidian Tools in hermes-mcp
|
||||
|
||||
**Claude provided a comprehensive prompt for Kimi Code / Claude Code:**
|
||||
|
||||
> Existing hermes-mcp server manages Yahoo Mail and FetcherPay email operations
|
||||
> New service: https://obsidian-sync.fetcherpay.com
|
||||
> Goal: Unified MCP server for all personal knowledge and communication tools
|
||||
>
|
||||
> Deliverables:
|
||||
> 1. Updated source files with new Obsidian functionality
|
||||
> 2. Updated `.env.example` with `OBSIDIAN_VAULT_PATH`, `SYNCTHING_API_KEY`, etc.
|
||||
> 3. Updated README.md
|
||||
> 4. Test files
|
||||
> 5. Verification that existing email tools still work
|
||||
>
|
||||
> Do not create a separate MCP server. Integrate into existing hermes-mcp codebase.
|
||||
|
||||
---
|
||||
|
||||
## Implementation Result
|
||||
|
||||
**Claude / Kimi Code implemented:**
|
||||
- Direct vault access via container mount (`/home/garfield/obsidian/vaults`)
|
||||
- Syncthing API integration for sync status
|
||||
- All 4 Obsidian tools passing tests
|
||||
- `hermes-mcp` now handles both 📧 Email and 📝 Knowledge
|
||||
|
||||
---
|
||||
|
||||
## Exposing Tools to External AIs (ChatGPT, Kimi, etc.)
|
||||
|
||||
**Issue:** ChatGPT only saw email tools, not Obsidian tools.
|
||||
|
||||
**Diagnosis:** The running Kubernetes pod was 34 days old and didn't have the new code. Public traffic went to the stale K8s pod, not the newly built Docker container.
|
||||
|
||||
**Kimi Code fix:**
|
||||
- Rebuilt image and pushed to MicroK8s registry
|
||||
- Updated `hermes-k8s.yaml` with new env vars and vault mount
|
||||
- Rolled out deployment
|
||||
- Verified `/health` returns `toolCount: 10`
|
||||
- Verified `/tools` returns full manifest with auth
|
||||
|
||||
---
|
||||
|
||||
## Adding API Key Auth for External Access
|
||||
|
||||
**Kimi Code added:**
|
||||
- Simple API-key auth middleware (`x-api-key` header)
|
||||
- GET `/tools` manifest endpoint
|
||||
- Enhanced `/health` with tool count + transport list
|
||||
- Port mapping in `docker-compose.yml`
|
||||
- Auto-generated `MCP_API_KEY` in `.env`
|
||||
|
||||
**Verification:**
|
||||
```bash
|
||||
curl http://localhost:3456/health
|
||||
# {"status": "ok", "toolCount": 10, "transports": ["streamable-http", "sse"]}
|
||||
|
||||
curl -H "x-api-key: $MCP_API_KEY" http://localhost:3456/tools
|
||||
# Returns all 10 tools
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ChatGPT Auth Problem: OAuth Required
|
||||
|
||||
**Issue:** ChatGPT's MCP connector only offers `No Auth`, `OAuth`, or `Mixed`. It does not support simple API keys.
|
||||
|
||||
**Decision:** Implement OAuth 2.0 on hermes-mcp.
|
||||
|
||||
**Kimi Code implemented:**
|
||||
- `GET /oauth/authorize`
|
||||
- `POST /oauth/token`
|
||||
- `POST /oauth/register` (Dynamic Client Registration)
|
||||
- Authorization code flow with PKCE
|
||||
- In-memory store for auth codes and tokens
|
||||
- Bearer token validation middleware mapping to internal API key
|
||||
|
||||
---
|
||||
|
||||
## OAuth Discovery Fix
|
||||
|
||||
**Issue:** ChatGPT auto-discovered endpoints but showed placeholder `https://example.com` for Registration URL.
|
||||
|
||||
**Kimi Code fix:**
|
||||
- Added RFC 8414 discovery endpoint: `GET /.well-known/oauth-authorization-server`
|
||||
- Added OIDC discovery: `GET /.well-known/openid-configuration`
|
||||
- Updated `src/manifest.ts` to include `issuer` and `authorization_server_base`
|
||||
- Fixed `SERVER_URL` declaration in `src/index.ts`
|
||||
|
||||
**Verified:**
|
||||
```bash
|
||||
curl https://hermes.fetcherpay.com/.well-known/oauth-authorization-server
|
||||
# Returns correct issuer, authorization_endpoint, token_endpoint, registration_endpoint
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Final ChatGPT MCP Connector Configuration
|
||||
|
||||
| Field | Value |
|
||||
|-------|-------|
|
||||
| Name | `hermes-mcp` |
|
||||
| MCP Server URL | `https://hermes.fetcherpay.com/mcp` |
|
||||
| Authentication | `OAuth` |
|
||||
| Registration method | `Dynamic Client Registration (DCR)` |
|
||||
| Registration URL | `https://hermes.fetcherpay.com/oauth/register` |
|
||||
| Auth URL | `https://hermes.fetcherpay.com/oauth/authorize` |
|
||||
| Token URL | `https://hermes.fetcherpay.com/oauth/token` |
|
||||
| Authorization server base | `https://hermes.fetcherpay.com` |
|
||||
|
||||
**Important:** Delete any existing connector, hard-refresh ChatGPT, then recreate.
|
||||
|
||||
---
|
||||
|
||||
## Current Architecture
|
||||
|
||||
```
|
||||
ChatGPT / Kimi / Claude / Cursor
|
||||
|
|
||||
| OAuth 2.0 + Bearer Token
|
||||
v
|
||||
https://hermes.fetcherpay.com
|
||||
|
|
||||
hermes-mcp (K8s pod)
|
||||
|
|
||||
+----+----+
|
||||
| |
|
||||
Email IMAP Obsidian Vault
|
||||
(Yahoo, (/vaults mount)
|
||||
FetcherPay)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Security Notes
|
||||
|
||||
- `MCP_API_KEY` provides fallback protection
|
||||
- OAuth tokens expire (auth codes: 10 min, access tokens: 1 hour, refresh: 7 days)
|
||||
- K8s YAML currently contains plaintext secrets — migrate to Kubernetes Secrets when ready
|
||||
- Port 3456 mapped to host should be firewalled from public internet if used directly
|
||||
|
||||
---
|
||||
|
||||
## Tool Manifest (10 Tools)
|
||||
|
||||
**Email (6):**
|
||||
- `yahoo_search_emails`
|
||||
- `yahoo_send_email`
|
||||
- `yahoo_get_inbox`
|
||||
- `fetcherpay_send_email`
|
||||
- (plus other email utilities)
|
||||
|
||||
**Obsidian (4):**
|
||||
- `obsidian_search_notes`
|
||||
- `obsidian_read_note`
|
||||
- `obsidian_append_to_note`
|
||||
- `obsidian_sync_status`
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Reconnect ChatGPT MCP connector with OAuth settings above
|
||||
2. Test: "Search my notes for funding strategy"
|
||||
3. Migrate K8s secrets from plaintext env vars to Kubernetes Secrets
|
||||
4. Consider creating a Universal Tool Manifest (`/config/:agent` endpoints) for Cursor, Kimi, Claude Desktop auto-configuration
|
||||
|
||||
---
|
||||
|
||||
## Appendix A: Migrating K8s Secrets from Plaintext to Kubernetes Secrets
|
||||
|
||||
Currently `hermes-k8s.yaml` stores sensitive values (email passwords, `MCP_API_KEY`, `SYNCTHING_API_KEY`) as plaintext environment variables. This section outlines how to migrate them to Kubernetes Secrets.
|
||||
|
||||
### Step 1: Create the Secret Manifest
|
||||
|
||||
Create `hermes-secrets.yaml`:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: hermes-mcp-secrets
|
||||
namespace: fetcherpay
|
||||
type: Opaque
|
||||
stringData:
|
||||
# Email credentials
|
||||
YAHOO_USER: "your_yahoo_user@yahoo.com"
|
||||
YAHOO_PASS: "your_yahoo_password"
|
||||
FETCHERPAY_USER: "your_fetcherpay_user@fetcherpay.com"
|
||||
FETCHERPAY_PASS: "your_fetcherpay_password"
|
||||
|
||||
# MCP / OAuth
|
||||
MCP_API_KEY: "your_mcp_api_key"
|
||||
OAUTH_CLIENT_SECRET: "your_oauth_client_secret"
|
||||
|
||||
# Syncthing
|
||||
SYNCTHING_API_KEY: "your_syncthing_api_key"
|
||||
```
|
||||
|
||||
Apply it:
|
||||
|
||||
```bash
|
||||
microk8s kubectl apply -f hermes-secrets.yaml
|
||||
```
|
||||
|
||||
### Step 2: Update `hermes-k8s.yaml`
|
||||
|
||||
Remove plaintext `value:` entries and replace with `valueFrom:`:
|
||||
|
||||
```yaml
|
||||
# Before (plaintext):
|
||||
- name: MCP_API_KEY
|
||||
value: "114521f3f9e6858480d6269446a446ef"
|
||||
|
||||
# After (secret reference):
|
||||
- name: MCP_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hermes-mcp-secrets
|
||||
key: MCP_API_KEY
|
||||
```
|
||||
|
||||
Do this for **all** sensitive environment variables.
|
||||
|
||||
### Step 3: Non-Sensitive Env Vars Stay in Deployment
|
||||
|
||||
Keep these as `value:` in `hermes-k8s.yaml` because they are not secrets:
|
||||
|
||||
```yaml
|
||||
- name: SERVER_URL
|
||||
value: "https://hermes.fetcherpay.com"
|
||||
- name: PORT
|
||||
value: "3456"
|
||||
- name: OBSIDIAN_VAULT_PATH
|
||||
value: "/vaults"
|
||||
- name: SYNCTHING_URL
|
||||
value: "http://host.docker.internal:8384"
|
||||
- name: SYNCTHING_FOLDER_ID
|
||||
value: "your_folder_id"
|
||||
```
|
||||
|
||||
### Step 4: Rollout Restart
|
||||
|
||||
After updating the deployment YAML:
|
||||
|
||||
```bash
|
||||
microk8s kubectl apply -f hermes-k8s.yaml
|
||||
microk8s kubectl rollout restart deployment/hermes-mcp -n fetcherpay
|
||||
microk8s kubectl get pods -n fetcherpay -w
|
||||
```
|
||||
|
||||
### Step 5: Verify Secret Injection
|
||||
|
||||
Check that the pod starts and env vars are injected correctly:
|
||||
|
||||
```bash
|
||||
# Get pod name
|
||||
POD=$(microk8s kubectl get pods -n fetcherpay -l app=hermes-mcp -o jsonpath='{.items[0].metadata.name}')
|
||||
|
||||
# Verify a secret is present (value will be redacted in describe, but present in container)
|
||||
microk8s kubectl exec -n fetcherpay $POD -- env | grep MCP_API_KEY
|
||||
```
|
||||
|
||||
### Security Best Practices
|
||||
|
||||
| Practice | Why |
|
||||
|----------|-----|
|
||||
| Never commit `hermes-secrets.yaml` to Git | Prevents credential leakage |
|
||||
| Use `stringData` (not `data`) | Easier to read/write; K8s base64-encodes automatically |
|
||||
| Rotate `MCP_API_KEY` after migration | Limits blast radius if old plaintext was exposed |
|
||||
| Use Sealed Secrets or External Secrets Operator | For production, encrypt secrets at rest and integrate with Vault/AWS Secrets Manager |
|
||||
| Set RBAC on the Secret | Only the `hermes-mcp` ServiceAccount should read `hermes-mcp-secrets` |
|
||||
|
||||
### Quick RBAC Lockdown (Optional)
|
||||
|
||||
If you want to restrict which pods can read the secret, create a ServiceAccount and Role:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: hermes-mcp-sa
|
||||
namespace: fetcherpay
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
namespace: fetcherpay
|
||||
name: hermes-secret-reader
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
resourceNames: ["hermes-mcp-secrets"]
|
||||
verbs: ["get"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: hermes-secret-reader-binding
|
||||
namespace: fetcherpay
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: hermes-mcp-sa
|
||||
namespace: fetcherpay
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: hermes-secret-reader
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
```
|
||||
|
||||
Then add to the Deployment spec:
|
||||
|
||||
```yaml
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
serviceAccountName: hermes-mcp-sa
|
||||
```
|
||||
Reference in new issue
Block a user