Skip to content

Add bundled SerpApi MCP server and serpapi-setup skill (v1.1.0) - #1

Draft
adarshdigievo wants to merge 1 commit into
mainfrom
plugin-revamp
Draft

adarshdigievo wants to merge 1 commit into
mainfrom
plugin-revamp

Conversation

@adarshdigievo

Copy link
Copy Markdown
Member

Summary

The plugin now works without a shell or an exported key, and can guide the user through setup when the key is missing.

  • Bundled MCP server. mcp.json adds SerpApi's hosted MCP server (https://mcp.serpapi.com/mcp) as serpapi. The key is a required plugin variable, SERPAPI_API_KEY, entered in Cursor's plugin settings and sent as a bearer token.
  • Search skill is MCP-first. search calls the MCP search tool and falls back to curl when the server or its key isn't available. The bundled engines/*.json files stay the default source for engine parameters.
  • New serpapi-setup skill, adapted from serpapi-codex-plugin with only the MCP and curl routes. It runs when a key or access is missing: it stores the key for curl in the OS credential store or a private file without the key appearing in chat, verifies with one real search, and diagnoses failed requests.
  • Key kept out of the URL. The curl pattern and all 25 examples now pipe the key to curl on stdin (--data-urlencode 'api_key@-') and start with -q, so a verbose or trace setting in ~/.curlrc can't print it.
  • Docs, tests, version. The README quick start covers key entry and /serpapi-setup, test.sh grows from 11 to 26 checks, and the version is 1.1.0.

The MCP server also exposes extract, search_table and search_dashboard, and its search tool accepts output: "md" for Markdown. Cursor Agent can use these once the server has a key. The setup skill's MCP guide mentions them in one line each; the search skill doesn't cover Extract or output formats yet.

AI disclosure

Changes made by Claude Fable 5.2 (GitHub Copilot Desktop). I made the design decisions; the model wrote the code, docs and tests. Claude Fable 5.2, Gemini 4 Carbon, GPT-6.1 Sol and GPT-6.2 Astra then reviewed the change over six rounds, and each finding was reproduced or checked against the code before anything was changed.

Testing

Run on macOS against commit 4029752:

  • bash test.sh: 26 passed, 0 failed, in the working tree and in a fresh clone of this branch. Its optional live API check was skipped because no key was set.
  • Cursor's plugin-template validator passes, and plugin.json is valid against the cursor/plugins manifest schema.
  • mcp.json against the hosted server: it connects and lists its four tools without a key. An unresolved placeholder returns Invalid SerpApi API key and an empty key returns Missing API key, the two errors the skills handle.
  • All 29 converted curl commands build the same path and parameters as on main. The 28 that were run with a dummy key each returned HTTP 401 and none printed the key, even with verbose and trace-ascii set in ~/.curlrc.
  • save-key.sh in scratch folders: it saves with directory mode 700 and file mode 600, and refuses an existing key, a symlinked config directory, and a parent directory writable by group or others.

Local Cursor test

To be added.

Not tested

  • PowerShell: save-key.ps1 and the PowerShell recipes have never been run.
  • Linux: test.sh has only run on macOS. CI runs it on Ubuntu for this PR.
  • A real API key through the plugin's MCP config, until the Cursor test above.

Bundle SerpApi's hosted MCP server in mcp.json, with the API key as a
required plugin variable (SERPAPI_API_KEY) that Cursor sends as a bearer
token. The search skill now calls the MCP search tool first and falls
back to curl, so a search no longer needs a shell or an exported key.

Add a serpapi-setup skill, adapted from serpapi-codex-plugin, for when a
key or access is missing. It covers the MCP and curl routes, stores the
key for curl in the OS credential store or a private file without it
appearing in chat, verifies a real search, and diagnoses failed requests.

The search skill's curl commands and its examples now pipe the key to
curl on stdin instead of placing it in the URL, and start with -q so a
verbose or trace setting in ~/.curlrc cannot print it.

The bundled engines/*.json files stay the default source for engine
parameters; the MCP resource is read only when a file is missing.
test.sh checks the new files, that every mcp.json variable is declared,
each skill's frontmatter, and a save-key.sh symlink regression.

Bump the plugin version to 1.1.0.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant