# Strands Agents

[Strands Agents](https://strandsagents.com/) is the open-source agent SDK
from AWS. It loads tools from any MCP server through its `MCPClient`, so a
Strands agent can use the hosted [Serply MCP server](/mcp) without an extra
package: point the client at `https://api.serply.io/mcp`, pass your key in
the `X-Api-Key` header, and the agent gets fourteen tools for live Google
Search, Scholar, News, Video, Jobs, Maps, Bing, Amazon, Reddit and page
scraping.

Everything on this page was run against `strands-agents` 1.56.0 with `mcp`
2.1.1 on 2026-09-17.

## Prerequisites

- Python 3.10 or newer, and `pip install strands-agents`. The `mcp` client
  library comes with it.
- A Serply API key from
  [app.serply.io/users/sign_up](https://app.serply.io/users/sign_up). New
  accounts include 2,500 free credits, no card required. Export it as
  `SERPLY_API_KEY`; keep it out of source files (see the
  [Authentication guide](/docs/guides/authentication)).
- A model provider Strands can reach. The default is Amazon Bedrock through
  the standard AWS credential chain. The Strands
  [quickstart](https://strandsagents.com/docs/user-guide/quickstart/) covers
  Bedrock and the other providers; the Serply side is the same for all of
  them.

## Connect the agent

```python
import os

from strands import Agent
from strands.tools.mcp import MCPClient

serply = MCPClient(
    url="https://api.serply.io/mcp",
    headers={"X-Api-Key": os.environ["SERPLY_API_KEY"]},
)

with serply:
    agent = Agent(tools=serply.list_tools_sync())
    agent(
        "What are the three most cited papers on retrieval augmented "
        "generation? Give the citation count for each."
    )
```

`MCPClient` takes the server URL and headers directly and opens a streamable
HTTP session. `list_tools_sync()` asks the server for its tool list and turns
each entry into a Strands tool, so the agent picks `google_scholar_search`
from the tool descriptions on its own and reads the citation counts out of
the result.

The `with` block keeps the session open while the agent runs. A tool call
outside it raises `MCPClientInitializationError` with the message "the client
session is not running", which is the first thing to check if a call fails
before it reaches Serply.

If you prefer to let Strands manage the session, pass the client itself as a
tool and skip the `with` block:

```python
agent = Agent(tools=[serply])
```

`MCPClient` implements the Strands `ToolProvider` interface, so the agent
opens the connection when it needs the tools and closes it when it is done.
Both forms load the same fourteen tools.

## Limit the tools the agent sees

Fourteen tools is more than most agents need, and every tool description
takes space in the model's context. Filter to the ones your agent should
use, and prefix them if the agent has tools from other servers too:

```python
serply = MCPClient(
    url="https://api.serply.io/mcp",
    headers={"X-Api-Key": os.environ["SERPLY_API_KEY"]},
    tool_filters={
        "allowed": [
            "google_scholar_search",
            "google_news_search",
            "google_search",
            "scrape_url",
        ]
    },
    prefix="serply",
)
```

`tool_filters` accepts `allowed` and `rejected` lists of tool names or
compiled regular expressions. `prefix` renames the tools on the agent side
to `serply_google_search` and so on; the server sees the original names.
With the filter above the agent's tool list is four entries:
`serply_google_scholar_search`, `serply_google_news_search`,
`serply_google_search` and `serply_scrape_url`.

## Call a tool without a model

To see what a tool returns before wiring it into an agent, call it through
the client directly. This costs one credit and no model tokens:

```python
with serply:
    result = serply.call_tool_sync(
        tool_use_id="scholar-1",
        name="google_scholar_search",
        arguments={"query": "retrieval augmented generation", "num": 3},
    )
    print(result["status"])
    print(result["content"][0]["text"])
```

```text
success
3 academic results for "retrieval augmented generation"

1. Retrieval-augmented generation for knowledge-intensive nlp tasks
   https://proceedings.neurips.cc/paper_files/paper/2020/hash/6b493230-Abstract.html
   P Lewis, E Perez, A Piktus, F Petroni... - Advances in neural ..., 2020 - proceedings.neurips.cc
   Cited by 29550

2. Retrieval-augmented generation for large language models: A survey
   https://arxiv.org/abs/2312.10997
   Y Gao, Y Xiong, X Gao, K Jia, J Pan, Y Bi, Y Dai... - arXiv preprint arXiv ..., 2023 - arxiv.org
   Cited by 8096
...
```

The text the model sees is exactly this block, which is why an agent given
these tools can quote a citation count or a publication date instead of
guessing.

## The tools

| Tool | Use it for |
|---|---|
| `google_search` | Organic Google results; `site:` and the other [search operators](/docs/guides/search-operators) pass through in the query |
| `google_scholar_search` | Papers with authors, venue, year and citation count |
| `google_news_search` | News coverage with publisher and publication date |
| `scrape_url` | Any public page as markdown or raw HTML, for reading a result in full |
| `bing_search` | Bing organic results plus the ads Google does not return |
| `google_video_search` | Video results |
| `google_jobs_search` | Postings from Google's jobs index |
| `google_maps_search` | Local businesses with address, rating, phone and hours |
| `amazon_product_search` | Product listings with prices and availability |
| `reddit_subreddit_posts`, `reddit_subreddit_about`, `reddit_user_posts`, `reddit_post`, `reddit_post_comments` | Reddit listings, profiles, posts and comment trees |

Every parameter and return shape is documented on the
[MCP Server](/mcp) page.

## What it costs

A tool call bills the same as the equivalent REST call: 1 credit per
successful, uncached request, against the same balance. See
[pricing](/pricing) for plans beyond the free credits.

## Troubleshooting

- **The tools list fine but every call returns `Invalid API key`.** The
  server accepts the connection and lists its tools before it checks the
  key; the key is checked on the first tool call, which then returns an
  error result containing `{"detail":"Invalid API key"}`. Confirm
  `SERPLY_API_KEY` is set in the environment the agent runs in.
- **`MCPClientInitializationError: the client session is not running`.**
  The tool was called outside the `with` block, or you built the tool list
  inside one `with` block and ran the agent outside it. Either keep the agent
  call inside the block or use the `Agent(tools=[serply])` form.
- **The connection times out on startup.** `MCPClient` waits 30 seconds for
  the server to answer `initialize`. Raise it with `startup_timeout=60` if
  you are behind a slow proxy; a healthy connection completes in well under
  a second.

## Related

- [MCP Server](/mcp) - the server address, every tool's parameters, and the
  config for Claude Code, Claude Desktop and Cursor
- [Strands MCP tools](https://strandsagents.com/docs/user-guide/concepts/tools/mcp-tools/) -
  the SDK's own reference for `MCPClient`, including OAuth and stdio servers
- [Agent Skill](/docs/guides/agent-skill) - a `SKILL.md` that teaches
  Skill-compatible agents the REST API and the MCP server
