Skip to content

Python: document keyed web search with Serply MCP - #8319

Open
Serply (googio) wants to merge 1 commit into
microsoft:mainfrom
googio:feat/serply-search
Open

Python: document keyed web search with Serply MCP#8319
Serply (googio) wants to merge 1 commit into
microsoft:mainfrom
googio:feat/serply-search

Conversation

@googio

Copy link
Copy Markdown

Motivation & Context

The MCP README has an anonymous web search example (Parallel, #8084) and a generic header_provider sample, but no runnable example of a keyed web search server that combines the two. This adds one for the Serply MCP server, which exposes Google, Bing, Google News, Google Scholar, Google Maps, and page scraping tools behind an X-Api-Key header.

The example reuses the header_provider pattern from mcp_api_key_auth.py, so the key is scoped to api.serply.io requests, and calls the tools directly so it needs no model provider account.

I work with Serply, which operates this service.

Description & Review Guide

  • What are the major changes? One new README section after the Parallel example: dependency installation, tool discovery, and direct google_search and google_news_search calls through MCPStreamableHTTPTool with header_provider. One line under Prerequisites for SERPLY_API_KEY.
  • What is the impact of these changes? Documentation only. No code, dependencies, providers, or defaults change. Readers who do not set SERPLY_API_KEY are unaffected.
  • What do you want reviewers to focus on? Whether the section reads as complementary to the anonymous Parallel example. One note for the changelog: the code block works against main (it needs the ambient header_provider handshake fix from Python: preserve MCP request ownership on low-level sends #8246). Against the released agent-framework-core 1.18.0 wheel with mcp 1.30 the initialize request goes out without the header and Serply answers 401, so the example will start working for wheel users with the next release.

Verification: ran the exact code block from the README with agent-framework-core installed from this branch and a live key. Output listed the nine Serply tools, three web results with title, URL, and snippet, and a list of news articles. Ran ruff check and ruff format --check on the snippet with the repo config. No non-ASCII characters were added.

Related Issue

None. This follows the shape of #8084, which added the Parallel section without an issue.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documentation is internally consistent, scoped appropriately, and provides a complete runnable example.

Pull request overview

Adds a documentation-only Serply MCP example demonstrating authenticated web and news search without a model provider account.

Changes:

  • Documents dependency installation and SERPLY_API_KEY setup.
  • Adds direct google_search and google_news_search calls using host-scoped header_provider.
  • Describes available tools, output, data transmission, and connection cleanup.
File summaries
File Description
python/samples/02-agents/mcp/README.md Adds the keyed Serply MCP walkthrough and prerequisite.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@googio

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Add a README section to the MCP samples showing MCPStreamableHTTPTool
against the Serply MCP server with header_provider supplying the
X-Api-Key header, calling google_search and google_news_search directly.
Adds the SERPLY_API_KEY line under Prerequisites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants