Skip to content

feat(examples): add with-iflow-search-mcp example#1312

Open
zhengyanglsun wants to merge 2 commits into
VoltAgent:mainfrom
zhengyanglsun:examples/iflow-search-mcp
Open

feat(examples): add with-iflow-search-mcp example#1312
zhengyanglsun wants to merge 2 commits into
VoltAgent:mainfrom
zhengyanglsun:examples/iflow-search-mcp

Conversation

@zhengyanglsun
Copy link
Copy Markdown

@zhengyanglsun zhengyanglsun commented May 27, 2026

Summary

Adds a runnable example wiring @iflow-ai/search-mcp into VoltAgent via MCPConfiguration, following the existing examples/with-mcp pattern.

  • Spawns the MCP server on demand via npx -y @iflow-ai/search-mcp (no new runtime dependency added to VoltAgent itself).
  • Exposes iFlow Search MCP tools to a VoltAgent agent: web search, image search, and single-URL page fetch.
  • Documents VoltAgent's server-key tool-name prefix behavior in both the README and the agent instructions, e.g. iflow-search_iflow_web_search.
  • Tags outbound MCP attribution via IFLOW_MCP_CLIENT=voltagent so iFlow's analytics can distinguish traffic from this host.
  • Treats MCP tool results as untrusted web content in the agent instructions.

Security

  • No real API keys are committed. .env.example ships with YOUR_OPENAI_API_KEY / YOUR_IFLOW_API_KEY placeholders only, and .env is git-ignored.
  • The example only reads IFLOW_API_KEY from process.env and forwards it to the spawned MCP child.

Test plan

Verified locally on this branch:

  • pnpm biome check examples/with-iflow-search-mcp/ — clean, no fixes applied
  • npx prettier --check examples/with-iflow-search-mcp/**/*.{ts,tsx,md,json} — all clean
  • npx prettier --check examples/README.md — clean
  • pnpm --filter "voltagent-example-with-iflow-search-mcp^..." build — exit 0
  • pnpm exec tsc --noEmit from the example dir — exit 0
  • pnpm run build from the example dir — exit 0 (emits dist/index.js)
  • MCP wiring smoke: server spawned, tools/list returned the 3 prefixed iFlow tools (iflow-search_iflow_web_search, iflow-search_iflow_image_search, iflow-search_iflow_web_fetch), one web_search invocation returned items.
  • Full agent loop smoke: agent successfully invoked iflow-search_iflow_web_search and produced a final answer. Smoke used DeepSeek as the LLM provider (via DEEPSEEK_API_KEY from environment) and iFlow Search (via IFLOW_API_KEY from environment). DeepSeek was used only for the local smoke — it is not a dependency of the example; the committed src/index.ts still references openai/gpt-4o-mini per the established example convention.

🤖 Generated with Claude Code


Summary by cubic

Adds a runnable example that integrates @iflow-ai/search-mcp with VoltAgent via MCPConfiguration. It provides web search, image search, and single-page fetch tools without new core runtime deps, and now validates IFLOW_API_KEY at startup.

  • New Features

    • Adds examples/with-iflow-search-mcp, spawning the MCP server via npx -y @iflow-ai/search-mcp.
    • Exposes prefixed tools: iflow-search_iflow_web_search, iflow-search_iflow_image_search, iflow-search_iflow_web_fetch.
    • Forwards IFLOW_API_KEY to the MCP child and tags traffic with IFLOW_MCP_CLIENT=voltagent.
    • Includes example README, .env.example, and links it from examples/README.md.
  • Bug Fixes

    • Fails fast if IFLOW_API_KEY is missing, with a clear startup error.

Written for commit e5a612c. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features

    • Added "iFlow Search (MCP)" example demonstrating web search, image search, and single-page content fetch via the iFlow Search MCP.
  • Documentation

    • Added full example guide with setup, required API key placeholders, tool descriptions, wiring instructions, security notes, and troubleshooting.
  • Chores

    • Included example package/configuration and ignore rules to support running the example.

Review Change Stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

⚠️ No Changeset found

Latest commit: e5a612c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f5b4eab6-80e4-40bc-ae81-af9227bbb603

📥 Commits

Reviewing files that changed from the base of the PR and between 52113a1 and e5a612c.

📒 Files selected for processing (2)
  • examples/with-iflow-search-mcp/README.md
  • examples/with-iflow-search-mcp/src/index.ts
✅ Files skipped from review due to trivial changes (1)
  • examples/with-iflow-search-mcp/README.md

📝 Walkthrough

Walkthrough

This PR introduces a new complete example demonstrating how to integrate the iFlow Search MCP (Model Context Protocol) server with VoltAgent. The example includes documentation, project scaffolding, and a working implementation that wires an MCP stdio server into an agent configured for web search, image search, and page fetch capabilities.

Changes

iFlow Search MCP Example Integration

Layer / File(s) Summary
Example documentation and registry
examples/README.md, examples/with-iflow-search-mcp/README.md
Comprehensive README covering installation, tool definitions, environment variables, MCP server wiring via npx, security considerations, and troubleshooting. Registry entry links to the example.
Project configuration and scaffolding
examples/with-iflow-search-mcp/package.json, tsconfig.json, .env.example, .gitignore
Dependencies (VoltAgent CLI/core, Hono adapter, ai, zod), TypeScript ES2022 configuration with strict checks, API key placeholders, and standard project ignores.
MCP agent orchestration
examples/with-iflow-search-mcp/src/index.ts
Initializes pino logger, constructs MCPConfiguration for the iFlow Search stdio server, fetches MCP-provided tools, instantiates an Agent with openai/gpt-4o-mini and untrusted-output handling instructions, and registers it in a VoltAgent wired to Hono.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • VoltAgent/voltagent#1289: Both PRs add new example packages under examples/ that wire external search/data providers into VoltAgent tools/agents.

Suggested reviewers

  • omeraplak

Poem

🐰 A warren of search tools, now unified and clear,
iFlow's swift findings brought into the sphere,
MCP speaks softly through stdio's gentle way,
VoltAgent listens—web, image, content by day! 🌐✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(examples): add with-iflow-search-mcp example' accurately summarizes the main change: adding a new example for integrating iFlow Search MCP with VoltAgent.
Description check ✅ Passed The PR description is comprehensive and covers the required template sections: it details the new behavior (the example implementation), security considerations, and includes an extensive test plan verifying functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/with-iflow-search-mcp/README.md`:
- Around line 110-112: The README's statement that "The MCP server process reads
IFLOW_API_KEY from its own environment only. It never touches the filesystem and
never reads `~/.npmrc`, dotfiles, or keychains." is incorrect about npm/npx;
update this wording to: explain that the MCP server reads IFLOW_API_KEY from its
environment and does not itself read or write credential files, but note that
tools invoked via npm/npx may load npm configuration from standard locations
(including `~/.npmrc`, user dotfiles, or keychains) before executing packages,
so users should not rely on npm/npx isolation guarantees and must keep `.env`
out of version control; change the sentence referencing "never reads `~/.npmrc`"
to this clarified statement.

In `@examples/with-iflow-search-mcp/src/index.ts`:
- Around line 16-19: Ensure the app fails fast when IFLOW_API_KEY is missing by
validating process.env.IFLOW_API_KEY before building the env object (the code
that sets IFLOW_API_KEY: process.env.IFLOW_API_KEY ?? ""). If the value is
undefined or empty, throw a clear Error (or call process.exit with a descriptive
message) at startup so the MCP child never receives an empty key; update the
startup logic that creates the env map (where IFLOW_API_KEY is assigned) to
perform this check and use the validated value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1edbf9ee-1fed-4ff1-b926-c7345921fe1c

📥 Commits

Reviewing files that changed from the base of the PR and between 5be7626 and 52113a1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • examples/README.md
  • examples/with-iflow-search-mcp/.env.example
  • examples/with-iflow-search-mcp/.gitignore
  • examples/with-iflow-search-mcp/README.md
  • examples/with-iflow-search-mcp/package.json
  • examples/with-iflow-search-mcp/src/index.ts
  • examples/with-iflow-search-mcp/tsconfig.json

Comment thread examples/with-iflow-search-mcp/README.md
Comment thread examples/with-iflow-search-mcp/src/index.ts
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 8 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread examples/with-iflow-search-mcp/README.md Outdated
Comment thread examples/with-iflow-search-mcp/README.md Outdated
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