Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Oct 6, 2025


PR-Codex overview

This PR introduces new features and documentation related to the MCP server and its integration with AI agents, specifically focusing on payment functionalities and examples for using the server with different programming languages.

Detailed summary

  • Added a new Agents option in the sidebar of sidebar.tsx.
  • Enhanced page.mdx with detailed instructions for creating AI agents using the MCP server.
  • Included code examples for both TypeScript and Python to demonstrate agent creation and tool usage.
  • Provided usage instructions for the API directly to handle payments.
  • Added a section listing available tools with descriptions for each.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added an “Agents” link in the Payments x402 sidebar for quicker navigation to agent workflows.
  • Documentation

    • Expanded MCP tools page with an intro on default tool availability, filtering via URL parameters, and a comprehensive “Available tools” listing.
    • Enhanced “Usage with LLM clients” with setup guides and examples for Cursor, Windsurf, VS Code, and Claude Code.
    • Introduced a new x402 Agents guide covering MCP-based paid API calls, TypeScript/Python ReAct agent examples, and direct API usage instructions.
    • Removed outdated agent-centric example in favor of updated integrations.

@vercel
Copy link

vercel bot commented Oct 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Oct 6, 2025 10:26am
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
nebula Skipped Skipped Oct 6, 2025 10:26am
thirdweb_playground Skipped Skipped Oct 6, 2025 10:26am
thirdweb-www Skipped Skipped Oct 6, 2025 10:26am
wallet-ui Skipped Skipped Oct 6, 2025 10:26am

@vercel vercel bot temporarily deployed to Preview – thirdweb-www October 6, 2025 10:16 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula October 6, 2025 10:16 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground October 6, 2025 10:16 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2025

⚠️ No Changeset found

Latest commit: 0384ee7

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

@vercel vercel bot temporarily deployed to Preview – wallet-ui October 6, 2025 10:16 Inactive
@joaquim-verges joaquim-verges marked this pull request as ready for review October 6, 2025 10:16
@joaquim-verges joaquim-verges requested review from a team as code owners October 6, 2025 10:16
@github-actions github-actions bot added the Portal Involves changes to the Portal (docs) codebase. label Oct 6, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Documentation updates expand MCP tool availability and client integration guidance, add an x402 Agents documentation page with TypeScript/Python examples and direct API usage, and include a new “Agents” link in the Payments x402 sidebar.

Changes

Cohort / File(s) Summary
MCP docs update
apps/portal/src/app/ai/mcp/page.mdx
Reworks MCP page: notes all tools available by default; adds tool-filtering via query params; lists available tools and order; expands “Usage with LLM clients” with setup for Cursor, Windsurf, VS Code, and Claude Code; removes prior agent-centric example block.
Payments x402 agents docs
apps/portal/src/app/payments/x402/agents/page.mdx
New page detailing an agent workflow to pay for x402-compatible API calls via remote MCP server; includes TS/Python ReAct agent examples, tool fetching, MCP config, and direct /v1/payments/x402/fetch usage with curl and OpenApiEndpoint annotation.
Payments navigation
apps/portal/src/app/payments/sidebar.tsx
Adds “Agents” link under x402 section pointing to ${paymentsSlug}/x402/agents.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Agent
  participant MCP Server
  participant Payments API (/v1/payments/x402/fetch)
  participant Target API (x402-compatible)

  User->>Agent: Request to call x402-protected API
  Agent->>MCP Server: List/Filter tools (query params)
  MCP Server-->>Agent: MCP tools (including fetch)
  Agent->>MCP Server: Invoke fetch tool with url, method, from
  MCP Server->>Payments API: POST fetch {url, method, from, ...}
  Payments API->>Target API: Perform paid request
  Target API-->>Payments API: Response
  Payments API-->>MCP Server: Result (status, body)
  MCP Server-->>Agent: Tool result
  Agent-->>User: Final answer with API response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes only the commented template and a PR-Codex overview but does not fill in the required title, reviewer notes, or testing instructions sections from the repository template. Without a clear title following the specified format, explicit notes for the reviewer, and steps to test the changes, it is missing essential information needed to understand and validate the updates. Please complete the template by providing a descriptive title in the required “[SDK/Dashboard/Portal] Feature/Fix: …” format, add any important notes for the reviewer to clarify the scope and context, and outline how to test the changes, including relevant unit tests or manual verification steps.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the main documentation updates by highlighting the addition of MCP tool filtering, agent examples, and the available tools list.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _Docs_Add_MCP_tool_filtering_agent_examples_and_available_tools_list

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

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

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.03%. Comparing base (938c1e2) to head (0384ee7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8188   +/-   ##
=======================================
  Coverage   55.03%   55.03%           
=======================================
  Files         919      919           
  Lines       60562    60562           
  Branches     4122     4122           
=======================================
  Hits        33332    33332           
  Misses      27126    27126           
  Partials      104      104           
Flag Coverage Δ
packages 55.03% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
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: 3

🧹 Nitpick comments (2)
apps/portal/src/app/ai/mcp/page.mdx (1)

44-62: Consider adding explicit return types to TypeScript example.

The TypeScript example demonstrates async tool fetching and agent creation but lacks explicit return types. While this is a documentation example, adding return types would align with the project's coding guidelines and serve as a better reference for users.

As per coding guidelines

Consider this enhancement:

 const mcpServers = {
   thirdweb: {
     url: `https://api.thirdweb.com/mcp?secretKey=<your-project-secret-key>`
   }
 };
 
 // Connect to MCP servers and get tools
 const client = new MultiServerMCPClient(mcpServers);
-const tools = await client.getTools();
+const tools: Tool[] = await client.getTools();
 
 const agent = createReactAgent({
   llm: model,
   tools: tools,
 });
-await agent.invoke({messages: [{ role: "user", content: "create a server wallet called 'my-wallet'" }]})
+const response = await agent.invoke({messages: [{ role: "user", content: "create a server wallet called 'my-wallet'" }]});

Note: You may need to import the Tool type from the appropriate package.

apps/portal/src/app/payments/x402/agents/page.mdx (1)

73-86: Consider adding response handling examples.

The direct API usage section shows how to call the endpoint but doesn't explain what happens next. Adding brief information about expected responses (success and error cases) would help users understand the complete flow.

Consider adding after line 84:

The endpoint returns:
- **200 OK**: The fetched data from the target URL (after payment if required)
- **402 Payment Required**: If payment cannot be completed automatically
- **4xx/5xx errors**: Standard HTTP error responses for invalid requests or server errors
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 938c1e2 and 0384ee7.

📒 Files selected for processing (3)
  • apps/portal/src/app/ai/mcp/page.mdx (2 hunks)
  • apps/portal/src/app/payments/sidebar.tsx (1 hunks)
  • apps/portal/src/app/payments/x402/agents/page.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/portal/src/app/payments/sidebar.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/app/payments/sidebar.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/portal/src/app/ai/mcp/page.mdx (1)

213-254: LGTM! Comprehensive tools list.

The available tools section provides a clear, complete enumeration of all MCP tools. This is well-referenced from both line 26 in this file and from the new agents documentation page.

apps/portal/src/app/payments/sidebar.tsx (1)

83-86: LGTM! Navigation link is properly structured.

The new "Agents" link is correctly placed in the x402 section and follows the established pattern for sidebar navigation items.


Make sure to keep your secret key safe and never share it with anyone.

By default, all tools are available. You can filter the tools available by passing multiple `tool` query parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix grammatical error in tool filtering explanation.

"passing multiple tool query parameter" should be "passing multiple tool query parameters" (plural form).

Apply this diff to fix the grammar:

-By default, all tools are available. You can filter the tools available by passing multiple `tool` query parameter.
+By default, all tools are available. You can filter the tools available by passing multiple `tool` query parameters.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
By default, all tools are available. You can filter the tools available by passing multiple `tool` query parameter.
By default, all tools are available. You can filter the tools available by passing multiple `tool` query parameters.
🤖 Prompt for AI Agents
In apps/portal/src/app/ai/mcp/page.mdx around line 20, the sentence "You can
filter the tools available by passing multiple `tool` query parameter." uses the
singular "parameter" incorrectly; change it to the plural "parameters" so the
line reads "You can filter the tools available by passing multiple `tool` query
parameters."


The easiest way to equip your agents with the ability to pay for API calls is to use the [remote MCP server](/ai/mcp) and provide the tools to your agent.

The MCP server comes with all the tools by default, but you can filter the tools available by passing multiple `tool` query parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix grammatical error in tool filtering explanation.

Same issue as in the MCP documentation: "passing multiple tool query parameter" should be "passing multiple tool query parameters" (plural form).

Apply this diff to fix the grammar:

-The MCP server comes with all the tools by default, but you can filter the tools available by passing multiple `tool` query parameter.
+The MCP server comes with all the tools by default, but you can filter the tools available by passing multiple `tool` query parameters.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The MCP server comes with all the tools by default, but you can filter the tools available by passing multiple `tool` query parameter.
The MCP server comes with all the tools by default, but you can filter the tools available by passing multiple `tool` query parameters.
🤖 Prompt for AI Agents
In apps/portal/src/app/payments/x402/agents/page.mdx around line 12, the
sentence uses the singular "query parameter" but should be plural; update the
sentence to read "passing multiple `tool` query parameters" so the grammar
correctly indicates multiple parameters.

const agent = createReactAgent({
llm: model,
tools: tools,
prompt: "Use the fetchWithPayment tool to fetch any endpoint. Always pay in {{tokenAddress}}. Your wallet address is {{walletAddress}}."
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify template placeholder usage in agent prompts.

Both TypeScript and Python examples include prompt templates with {{tokenAddress}} and {{walletAddress}} placeholders, but the documentation doesn't explain what these should be replaced with or how users should obtain these values.

Users may be confused about:

  • What format tokenAddress should be in (contract address, symbol, etc.)
  • Whether walletAddress refers to their user wallet or server wallet
  • Whether these are meant to be replaced before runtime or if the agent should handle them dynamically

Consider adding a brief explanation before or after the code examples, such as:

Replace the template placeholders in the prompt:
- `{{tokenAddress}}`: The ERC-20 token contract address to use for payments (e.g., USDC on Base)
- `{{walletAddress}}`: Your wallet address (from user wallets or server wallets)

Or if these are meant to be dynamic runtime values, clarify how the agent should resolve them.

Also applies to: 67-67

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.6 KB (0%) 1.3 s (0%) 245 ms (+181.64% 🔺) 1.6 s
thirdweb (cjs) 365.75 KB (0%) 7.4 s (0%) 852 ms (+8.19% 🔺) 8.2 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 82 ms (+1772.59% 🔺) 196 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 74 ms (+4020.12% 🔺) 85 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 102 ms (+2521.71% 🔺) 484 ms

@joaquim-verges joaquim-verges merged commit 5a26217 into main Oct 6, 2025
26 of 27 checks passed
@joaquim-verges joaquim-verges deleted the _Docs_Add_MCP_tool_filtering_agent_examples_and_available_tools_list branch October 6, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants