* Reorganize the examples folder * Add two mcp server examples. A local filesystem server and a simple 'starter' server. |
||
|---|---|---|
| .. | ||
| .env.example | ||
| .gitignore | ||
| generateText.js | ||
| index.js | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README.md | ||
Arcade - AI SDK
This example demonstrates how to integrate Arcade with the Vercel AI SDK to create powerful AI agents. Arcade provides access to a wide range of tools including Gmail, Slack, LinkedIn, and more. You can also develop custom tools using the Tool SDK.
For a list of all hosted tools and auth providers, see the Arcade Integrations documentation.
Prerequisites
- Node.js (v18.20.8 or higher)
- pnpm (v9.15.9 or higher)
- OpenAI API key
- Arcade API key
Installation
- Install dependencies:
pnpm install
- Set up environment variables:
-
Copy
.env.exampleto.env -
Fill in your API keys:
OPENAI_API_KEY=your_openai_api_key ARCADE_API_KEY=your_arcade_api_key
-
Basic Usage
This example demonstrates how to use Arcade's Gmail toolkit to create an AI agent that can read and summarize emails. The agent will access your Gmail account (after authorization) and process your most recent email.
To get started, run the development server:
pnpm dev
If you haven't authorized Arcade with Google yet, you'll see a message like this:
> pnpm dev
Authorization Required: Please visit this link to connect your Google account: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=....
Visit the provided URL in your browser to authorize Arcade with Google. Once authorized, run the script again.
You can also wait for authorization to complete before running the script using the helper methods in arcade.js.
Once you've authorized Arcade with a tool, you can use it in your agent by passing the user_id and won't need to authenticate for that specific tool again.
Development
To modify or extend the functionality:
- Update the
USER_IDconstant inindex.jswith your application's user identification - Modify the
toolkitparameter ingetArcadeToolsto access different tools. Available toolkits include:"gmail"- Gmail"slack"- Slack messaging and channels"github"- GitHub repositories and issues- And more in Arcade Integrations documentation
Security
- Never commit your
.envfile - Keep your API keys secure
- Use appropriate user identification in production
License
This project is licensed under the MIT License - see the LICENSE file for details.