Skip to content

Commit 6ad8949

Browse files
committed
feat: add DataForSEO and Serper MCP integrations with OpenCode CLI testing support
- Add DataForSEO MCP subagent for comprehensive SEO data APIs - Add Serper MCP subagent for Google Search API - Add MCP config templates for both services - Update setup.sh to configure SEO MCP servers - Add OpenCode CLI testing section to documentation - Create opencode-test-helper.sh for testing config changes - Update generate-opencode-agents.sh with new MCP configurations - Update AGENTS.md and troubleshooting.md with CLI testing guidance
1 parent 2439089 commit 6ad8949

17 files changed

+1735
-18
lines changed

.agent/AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
| `build-mcp/` | MCP development (api-wrapper, deployment, server-patterns, transports) |
4646
| `memory/` | Cross-session memory patterns |
4747
| `wordpress/` | WordPress subagents (wp-dev, wp-admin, localwp, mainwp, wp-preferred) |
48-
| `seo/` | SEO subagents (google-search-console) |
48+
| `seo/` | SEO subagents (google-search-console, dataforseo, serper) |
4949
| `content/` | Content subagents (guidelines) |
5050
| `tools/ai-assistants/` | AI tools (agno, capsolver, windsurf, configuration) |
5151
| `tools/browser/` | Browser automation (playwright, stagehand, stagehand-python, chrome-devtools, crawl4ai, pagespeed) |
@@ -55,6 +55,7 @@
5555
| `tools/data-extraction/` | Data extraction (outscraper) |
5656
| `tools/deployment/` | Deployment tools (coolify, coolify-cli, coolify-setup, vercel) |
5757
| `tools/git/` | Git platforms (github-cli, gitlab-cli, gitea-cli, github-actions, authentication, security) |
58+
| `tools/credentials/` | Credential management (list-keys, api-key-management, api-key-setup, vaultwarden) |
5859
| `tools/opencode/` | OpenCode configuration and paths |
5960
| `services/hosting/` | Hosting providers (hostinger, hetzner, cloudflare, cloudron, closte, 101domains, spaceship, localhost, dns-providers, domain-purchasing) |
6061
| `services/email/` | Email services (ses) |
@@ -88,6 +89,7 @@ Read subagents only when task requires them. The AI-CONTEXT section above contai
8889
- Release/versioning → `workflows/`
8990
- Browser automation → `tools/browser/`
9091
- MCP development → `build-mcp/`
92+
- SEO analysis → `seo/` (google-search-console, dataforseo, serper)
9193

9294
## Security
9395

@@ -111,6 +113,7 @@ Never create files in `~/` root for files needed only with the current task.
111113

112114
| Script | Purpose |
113115
|--------|---------|
116+
| `list-keys-helper.sh` | List all API keys with their storage locations |
114117
| `linters-local.sh` | Run local linting (ShellCheck, secretlint, patterns) |
115118
| `code-audit-helper.sh` | Run remote auditing (CodeRabbit, Codacy, SonarCloud) |
116119
| `version-manager.sh` | Version bumps and releases |
@@ -123,6 +126,7 @@ Never create files in `~/` root for files needed only with the current task.
123126
| `sonarcloud-cli.sh` | SonarCloud analysis |
124127
| `codacy-cli.sh` | Codacy code quality |
125128
| `secretlint-helper.sh` | Secret detection |
129+
| `opencode-test-helper.sh` | Test OpenCode config changes via CLI |
126130

127131
## Quality Workflow
128132

.agent/aidevops/troubleshooting.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,39 @@ echo $CLOUDFLARE_ACCOUNT_ID
218218
echo $CLOUDFLARE_API_TOKEN
219219
```
220220

221+
### **5. Test Configuration Changes with CLI**
222+
223+
The OpenCode TUI requires restart to pick up `opencode.json` changes. Use CLI for quick testing:
224+
225+
```bash
226+
# Test new MCP configuration
227+
opencode run "List available tools from dataforseo_*" --agent SEO
228+
229+
# Debug MCP connection (shows errors in terminal)
230+
opencode run "Call serper_google_search with query 'test'" --agent SEO 2>&1
231+
232+
# Verify agent has correct tool access
233+
opencode run "What MCP tools can you access?" --agent SEO
234+
235+
# Test slash commands
236+
opencode run "/new-command arg1" --agent Build+
237+
```
238+
239+
**Workflow for adding new MCPs:**
240+
241+
1. Edit `~/.config/opencode/opencode.json`
242+
2. Test with CLI: `opencode run "Test [mcp]" --agent [agent] 2>&1`
243+
3. If working, restart TUI to use interactively
244+
4. If failing, check stderr output and iterate on config
245+
5. Update `generate-opencode-agents.sh` to persist changes
246+
247+
**Helper script for common tests:**
248+
249+
```bash
250+
~/.aidevops/agents/scripts/opencode-test-helper.sh test-mcp dataforseo SEO
251+
~/.aidevops/agents/scripts/opencode-test-helper.sh test-agent Plan+
252+
```
253+
221254
## Performance Optimization
222255

223256
### **Chrome DevTools Optimization**

.agent/scripts/context-builder-helper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
set -euo pipefail
2121

2222
# Configuration
23-
# shellcheck disable=SC2034
2423
declare SCRIPT_DIR
2524
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit
2625
readonly SCRIPT_DIR
26+
export SCRIPT_DIR # Available for sourced scripts
2727
declare SCRIPT_NAME
2828
SCRIPT_NAME="$(basename "$0")"
2929
readonly SCRIPT_NAME

.agent/scripts/generate-opencode-agents.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ echo -e "${BLUE}Configuring primary agents in opencode.json...${NC}"
6363
# Check if opencode.json exists
6464
if [[ ! -f "$OPENCODE_CONFIG" ]]; then
6565
echo -e "${YELLOW}Warning: $OPENCODE_CONFIG not found. Creating minimal config.${NC}"
66+
# shellcheck disable=SC2016
6667
echo '{"$schema": "https://opencode.ai/config.json"}' > "$OPENCODE_CONFIG"
6768
fi
6869

@@ -318,6 +319,8 @@ primary_agents = {
318319
"webfetch": True,
319320
"gsc_*": True,
320321
"ahrefs_*": True,
322+
"dataforseo_*": True,
323+
"serper_*": True,
321324
"augment-context-engine_*": True
322325
}
323326
},
@@ -370,6 +373,32 @@ if 'outscraper_*' not in config['tools']:
370373
config['tools']['outscraper_*'] = False
371374
print(" Added outscraper_* to tools (disabled globally, enabled for @outscraper subagent)")
372375
376+
# DataForSEO MCP - for comprehensive SEO data
377+
if 'dataforseo' not in config['mcp']:
378+
config['mcp']['dataforseo'] = {
379+
"type": "local",
380+
"command": ["/bin/bash", "-c", "source ~/.config/aidevops/mcp-env.sh && DATAFORSEO_USERNAME=$DATAFORSEO_USERNAME DATAFORSEO_PASSWORD=$DATAFORSEO_PASSWORD /opt/homebrew/bin/npx dataforseo-mcp-server"],
381+
"enabled": True
382+
}
383+
print(" Added dataforseo MCP server")
384+
385+
if 'dataforseo_*' not in config['tools']:
386+
config['tools']['dataforseo_*'] = False
387+
print(" Added dataforseo_* to tools (disabled globally, enabled for SEO agent)")
388+
389+
# Serper MCP - for Google Search API
390+
if 'serper' not in config['mcp']:
391+
config['mcp']['serper'] = {
392+
"type": "local",
393+
"command": ["/bin/bash", "-c", "source ~/.config/aidevops/mcp-env.sh && SERPER_API_KEY=$SERPER_API_KEY /opt/homebrew/bin/serper-mcp-server"],
394+
"enabled": True
395+
}
396+
print(" Added serper MCP server")
397+
398+
if 'serper_*' not in config['tools']:
399+
config['tools']['serper_*'] = False
400+
print(" Added serper_* to tools (disabled globally, enabled for SEO agent)")
401+
373402
with open(config_path, 'w') as f:
374403
json.dump(config, f, indent=2)
375404
@@ -395,7 +424,7 @@ while IFS= read -r f; do
395424
name=$(basename "$f" .md)
396425
[[ "$name" == "AGENTS" || "$name" == "README" ]] && continue
397426

398-
rel_path="${f#$AGENTS_DIR/}"
427+
rel_path="${f#"$AGENTS_DIR"/}"
399428

400429
# Determine additional tools based on subagent name/path
401430
extra_tools=""
@@ -412,6 +441,12 @@ while IFS= read -r f; do
412441
google-search-console)
413442
extra_tools=$' gsc_*: true'
414443
;;
444+
dataforseo)
445+
extra_tools=$' dataforseo_*: true\n webfetch: true'
446+
;;
447+
serper)
448+
extra_tools=$' serper_*: true\n webfetch: true'
449+
;;
415450
*)
416451
;; # No extra tools for other agents
417452
esac

.agent/scripts/generate-opencode-commands.sh

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616
set -euo pipefail
1717

18-
AGENTS_DIR="$HOME/.aidevops/agents"
1918
OPENCODE_COMMAND_DIR="$HOME/.config/opencode/command"
2019

2120
# Colors
2221
GREEN='\033[0;32m'
2322
BLUE='\033[0;34m'
24-
YELLOW='\033[1;33m'
2523
NC='\033[0m'
2624

2725
echo -e "${BLUE}Generating OpenCode commands...${NC}"
@@ -326,6 +324,48 @@ EOF
326324
((command_count++))
327325
echo -e " ${GREEN}${NC} Created /hotfix command"
328326

327+
# =============================================================================
328+
# LIST-KEYS COMMAND
329+
# =============================================================================
330+
# List all API keys available in session
331+
332+
cat > "$OPENCODE_COMMAND_DIR/list-keys.md" << 'EOF'
333+
---
334+
description: List all API keys available in session with their storage locations
335+
agent: Build+
336+
---
337+
338+
Run the list-keys helper script and format the output as a markdown table:
339+
340+
!`~/.aidevops/agents/scripts/list-keys-helper.sh --json $ARGUMENTS`
341+
342+
Parse the JSON output and present as markdown tables grouped by source.
343+
344+
Format with padded columns for readability:
345+
346+
```
347+
### ~/.config/aidevops/mcp-env.sh
348+
349+
| Key | Status |
350+
|----------------------------|---------------|
351+
| OPENAI_API_KEY | ✓ loaded |
352+
| ANTHROPIC_API_KEY | ✓ loaded |
353+
| TEST_KEY | ⚠ placeholder |
354+
```
355+
356+
Status icons:
357+
- ✓ loaded
358+
- ⚠ placeholder (needs real value)
359+
- ✗ not loaded
360+
- ℹ configured
361+
362+
Pad key names to align columns. End with total count.
363+
364+
Security: Key values are NEVER displayed.
365+
EOF
366+
((command_count++))
367+
echo -e " ${GREEN}${NC} Created /list-keys command"
368+
329369
# =============================================================================
330370
# CONTEXT BUILDER COMMAND
331371
# =============================================================================
@@ -403,6 +443,7 @@ echo " /feature - Create feature branch"
403443
echo " /bugfix - Create bugfix branch"
404444
echo " /hotfix - Create hotfix branch"
405445
echo " /context - Build AI context"
446+
echo " /list-keys - List API keys with storage locations"
406447
echo ""
407448
echo "Quality workflow: /linters-local -> /code-audit-remote -> /pr"
408449
echo ""

0 commit comments

Comments
 (0)