1. Updates docs to prefer `uv run server.py` instead of `arcade mcp` or `python -m arcade_mcp_server` 2. Found a bug with running stdio servers while updating the docs, so i snuck that in this PR
2.6 KiB
2.6 KiB
Arcade MCP Examples
This directory contains examples demonstrating how to build MCP servers with your Arcade tools.
Getting Started
The easiest way to get started is with arcade new:
# Install the CLI
uv pip install arcade-mcp
# Create a new server project with example tools
arcade new my_server
cd my_server
# Run your server
uv run server.py
This creates a complete project with server.py, pyproject.toml, and example tools showing best practices.
Examples Overview
Basic Examples
-
00_hello_world.py – Minimal tool example
- Single
@toolfunction showing the basics - Run:
uv run 00_hello_world.py(oruv run 00_hello_world.py stdio)
- Single
-
01_tools.py – Creating tools and discovery
- Simple parameters, lists, and
TypedDict - How the server discovers tools automatically
- Run:
uv run 01_tools.py
- Simple parameters, lists, and
-
02_building_apps.py – Building apps with MCPApp
- Create an
MCPApp, register tools with@app.tool - Run HTTP:
uv run 02_building_apps.py - Run stdio:
uv run 02_building_apps.py stdio
- Create an
-
03_context.py – Using
Context- Access secrets, logging, and user context
- Run:
uv run 03_context.py
-
04_tool_secrets.py – Working with secrets
- Use
requires_secretsand access masked values - Run:
uv run 04_secrets.py
- Use
-
05_logging.py – Logging with MCP
- Demonstrates debug/info/warning/error levels and structured logs
- Run:
uv run 05_logging.py
-
06_tool_organization.py – Tool organization and imports
- Demonstrate modular tool organization, importing from files and packages
- Run:
uv run 06_tool_organization.py
-
07_auth.py – Tools that require auth
- Create tools that require OAuth scopes
- Use Reddit OAuth to fetch posts
- Prerequisites: Run
arcade loginto authenticate with Arcade - Run:
uv run 07_auth.py
Running Examples
Recommended: Direct Python Execution
Most examples can be run directly with Python using uv:
# Run any example file directly
uv run 00_hello_world.py
uv run 02_building_apps.py
uv run 06_tool_organization.py
# With specific transport
uv run server.py stdio # For Claude Desktop
uv run server.py http # HTTP by default
# You can also run with python directly
python 00_hello_world.py
python 02_building_apps.py stdio
All example files include proper command-line argument handling with if __name__ == "__main__": blocks.