arcade-mcp/libs/arcade-serve
Sterling Dreyer 069ce70fb2
Instrumentation for outbound requests (#726)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds OpenTelemetry instrumentation for outbound HTTP (httpx, aiohttp,
requests), guards span environment attribute, and updates
package/version deps.
> 
> - **Telemetry**:
> - Instrument outbound HTTP clients with OpenTelemetry: `httpx`,
`aiohttp-client`, and `requests`.
>   - Tighten excluded span types using `Literal`.
> - **Core**:
> - Guard setting `environment` span attribute in `CallToolComponent`
only if present on `worker`.
> - **Packaging**:
>   - Bump `arcade-serve` to `3.2.1`.
> - Add new dependencies for HTTP client instrumentation and `aiohttp`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9ab57f3c33d6033ff9ec4c6a40445a85328b169a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-12-12 15:30:11 -08:00
..
arcade_serve Instrumentation for outbound requests (#726) 2025-12-12 15:30:11 -08:00
pyproject.toml Instrumentation for outbound requests (#726) 2025-12-12 15:30:11 -08:00
README.md PyPI release arcade-serve and arcade-tdk (#432) 2025-06-13 13:06:11 -07:00

Arcade Serve

Serving infrastructure for Arcade tools and workers.

Overview

Arcade Serve provides the infrastructure for serving Arcade tools:

  • FastAPI Worker: High-performance FastAPI-based worker implementation
  • MCP Server: Model Context Protocol server for tool integration
  • Core Abstractions: Base worker classes and components
  • Authentication: Auth utilities and routing
  • Runtime Management: Tool execution and lifecycle management

Installation

pip install arcade-serve

Usage

To add a toolkit to a hosted worker such as FastAPI, you can register them in the worker itself. This allows you to explicitly define which tools should be included on a particular worker.

Here is an example of adding the math toolkit (pip install arcade-math) to a FastAPI Worker:

import arcade_math
from fastapi import FastAPI
from arcade_tdk import Toolkit
from arcade_serve.fastapi import FastAPIWorker

app = FastAPI()

worker_secret = os.environ.get("ARCADE_WORKER_SECRET")
worker = FastAPIWorker(app, secret=worker_secret)

worker.register_toolkit(Toolkit.from_module(arcade_math))

Here is an example of adding the math toolkit (pip install arcade-math) to a MCP Worker

import arcade_math
from arcade_core.catalog import ToolCatalog
from arcade_serve.mcp.stdio import StdioServer

# 1. Create and populate the tool catalog
catalog = ToolCatalog()
catalog.add_module(arcade_math)


# 2. Main entrypoint
async def main():
    # Create the worker with the tool catalog
    worker = StdioServer(catalog)

    # Run the worker
    await worker.run()


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

License

MIT License - see LICENSE file for details.