Skip to content

Commit 33258f6

Browse files
john-walkoeclaude
andcommitted
Add Claude Code CLI merge scripts and update INSTALL.md
Adds support for Claude Code CLI users who use ~/.claude.json instead of Claude Desktop's claude_desktop_config.json. These scripts enable quick configuration merging without running the full setup workflow. Changes: 1. New Scripts: - deploy/merge_fpd_to_claude_json.py - Python script to merge FPD config into ~/.claude.json - deploy/quick_merge_claude_config.sh - Bash wrapper for the Python merge script 2. Documentation: - Updated INSTALL.md with new "Claude Code CLI Configuration (Alternative Method)" section - Documented difference between setup scripts (full installation) vs merge scripts (config only) - Added usage examples and expected output - Clarified prerequisites (API keys must already be configured) Use Cases: - Users who prefer Claude Code CLI over Claude Desktop - Quick redeployment after config changes - Adding FPD to existing ~/.claude.json without running full setup Scripts follow PTAB MCP pattern but adapted for FPD: - Server name: uspto_fpd - Command: fpd-mcp - Proxy port: 8081 (vs PTAB's 8083) - Includes FPD-specific environment variables Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 9022cea commit 33258f6

File tree

3 files changed

+172
-0
lines changed

3 files changed

+172
-0
lines changed

INSTALL.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,63 @@ Checking MCP server health...
527527
uspto_fpd: uv --directory /USER/uspto_fpd_mcp run fpd-mcp - ✓ Connected
528528
```
529529

530+
## 🔧 Claude Code CLI Configuration (Alternative Method)
531+
532+
**When to use this:** If you have Claude Code CLI installed and want to use the `~/.claude.json` configuration file instead of running the full setup script.
533+
534+
**Difference from setup scripts:**
535+
- **Setup scripts** (`linux_setup.sh`/`windows_setup.ps1`): Full installation with API key management, secure storage, and config merging
536+
- **Merge scripts** (below): Quick config merge only - assumes you already have API keys configured
537+
538+
### Quick Merge for Claude Code CLI
539+
540+
If you've already installed the FPD MCP and configured your API keys, you can quickly add it to Claude Code's `~/.claude.json` using the merge scripts:
541+
542+
**Linux/macOS:**
543+
```bash
544+
cd ~/uspto_fpd_mcp
545+
./deploy/quick_merge_claude_config.sh
546+
```
547+
548+
**Windows PowerShell:**
549+
```powershell
550+
cd C:\Users\YOUR_USERNAME\uspto_fpd_mcp
551+
python deploy\merge_fpd_to_claude_json.py
552+
```
553+
554+
The merge script will:
555+
- ✅ Create a timestamped backup of your existing `~/.claude.json`
556+
- ✅ Add or update the `uspto_fpd` server configuration
557+
- ✅ Preserve all your existing MCP server configurations
558+
- ✅ Set secure file permissions (600)
559+
560+
**Output Example:**
561+
```
562+
Creating backup: /home/USER/.claude.json.backup_20260117_143022
563+
Reading: /home/USER/.claude.json
564+
Writing: /home/USER/.claude.json
565+
566+
✓ SUCCESS: USPTO FPD MCP configuration added to ~/.claude.json
567+
568+
Configuration details:
569+
- Server name: uspto_fpd
570+
- Project directory: /home/USER/uspto_fpd_mcp
571+
- Proxy port: 8081
572+
573+
Next steps:
574+
1. Restart Claude Code CLI
575+
2. Run: claude mcp list
576+
3. Verify uspto_fpd appears in the list
577+
578+
Note: API keys are managed via DPAPI (Windows) or secure storage (Linux/macOS)
579+
Use deploy/manage_api_keys.ps1 (Windows) to configure API keys
580+
```
581+
582+
**Requirements:**
583+
- ✅ Must have `~/.claude.json` file (created by Claude Code CLI)
584+
- ✅ Must run from the `uspto_fpd_mcp` directory
585+
- ✅ API keys should already be configured in secure storage
586+
530587
**Example Configuration Generated:**
531588

532589
```json

deploy/merge_fpd_to_claude_json.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Merge USPTO FPD MCP configuration into ~/.claude.json
4+
5+
This script specifically handles the case where Claude Code CLI uses ~/.claude.json
6+
instead of ~/.config/Claude/claude_desktop_config.json (Claude Desktop)
7+
"""
8+
9+
import json
10+
import sys
11+
from pathlib import Path
12+
from datetime import datetime
13+
14+
def main():
15+
# Determine project directory
16+
project_dir = Path.cwd()
17+
if not (project_dir / "pyproject.toml").exists():
18+
print("ERROR: Must run from uspto_fpd_mcp directory")
19+
sys.exit(1)
20+
21+
# Claude config file location (Claude Code CLI)
22+
claude_config = Path.home() / ".claude.json"
23+
24+
if not claude_config.exists():
25+
print(f"ERROR: {claude_config} does not exist")
26+
print("Claude Code CLI may not be configured yet")
27+
print()
28+
print("If you are using Claude Desktop (not Claude Code CLI),")
29+
print("use the setup scripts instead:")
30+
print(" Windows: .\\deploy\\windows_setup.ps1")
31+
print(" Linux/macOS: ./deploy/linux_setup.sh")
32+
sys.exit(1)
33+
34+
# Backup existing config
35+
backup_path = Path(str(claude_config) + f".backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}")
36+
print(f"Creating backup: {backup_path}")
37+
backup_path.write_text(claude_config.read_text())
38+
39+
# Load existing config
40+
print(f"Reading: {claude_config}")
41+
with claude_config.open('r') as f:
42+
config = json.load(f)
43+
44+
# Ensure mcpServers exists
45+
if 'mcpServers' not in config:
46+
config['mcpServers'] = {}
47+
48+
# Check if uspto_fpd already exists
49+
if 'uspto_fpd' in config['mcpServers']:
50+
print("WARN: uspto_fpd already exists in config - will overwrite")
51+
52+
# Add or update uspto_fpd configuration
53+
config['mcpServers']['uspto_fpd'] = {
54+
'command': 'uv',
55+
'args': [
56+
'--directory',
57+
str(project_dir),
58+
'run',
59+
'fpd-mcp'
60+
],
61+
'env': {
62+
'FPD_PROXY_PORT': '8081',
63+
'ENABLE_PROXY_SERVER': 'true'
64+
}
65+
}
66+
67+
# Write updated config
68+
print(f"Writing: {claude_config}")
69+
with claude_config.open('w') as f:
70+
json.dump(config, f, indent=2)
71+
72+
# Set secure permissions
73+
claude_config.chmod(0o600)
74+
75+
print()
76+
print("✓ SUCCESS: USPTO FPD MCP configuration added to ~/.claude.json")
77+
print()
78+
print("Configuration details:")
79+
print(f" - Server name: uspto_fpd")
80+
print(f" - Project directory: {project_dir}")
81+
print(f" - Proxy port: 8081")
82+
print()
83+
print("Next steps:")
84+
print(" 1. Restart Claude Code CLI")
85+
print(" 2. Run: claude mcp list")
86+
print(" 3. Verify uspto_fpd appears in the list")
87+
print()
88+
print("Note: API keys are managed via DPAPI (Windows) or secure storage (Linux/macOS)")
89+
print(" Use deploy/manage_api_keys.ps1 (Windows) to configure API keys")
90+
print()
91+
92+
if __name__ == '__main__':
93+
main()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Quick script to merge FPD config into existing ~/.claude.json
4+
# This is a wrapper around merge_fpd_to_claude_json.py
5+
#
6+
# Use this for Claude Code CLI users who have ~/.claude.json
7+
# For Claude Desktop users, use linux_setup.sh instead
8+
9+
set -e
10+
11+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12+
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
13+
14+
# Change to project directory so the script can find pyproject.toml
15+
cd "$PROJECT_DIR"
16+
17+
echo "Merging USPTO FPD MCP configuration into ~/.claude.json"
18+
echo "========================================================="
19+
echo ""
20+
21+
# Run the Python merge script
22+
python3 "$SCRIPT_DIR/merge_fpd_to_claude_json.py"

0 commit comments

Comments
 (0)