Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Register your Scalekit environment with the Google Calendar connector so Scaleki
4. ### Add credentials in Scalekit

- In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** and open the connection you created.
- Copy the **Connection name** shown on that connection and use that exact value in your code as `connection_name` or `connectionName`. It may be something like `meeting-prep-agent-googlecalendar`, not `googlecalendar`.
- Enter your credentials:
- Client ID (from above)
- Client Secret (from above)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import { Tabs, TabItem } from '@astrojs/starlight/components'

Connect a user's Google Calendar account and make API calls on their behalf — Scalekit handles OAuth and token management automatically.

Before running this code, create the Google Calendar connection in **AgentKit** > **Connections** in the Scalekit dashboard and copy its exact **Connection name** into the `connection_name` or `connectionName` variable below.

## Proxy API Calls

<Tabs syncKey="tech-stack">
<TabItem label="Node.js">
```typescript
import { ScalekitClient } from '@scalekit-sdk/node';
import { ConnectorStatus } from '@scalekit-sdk/node/lib/pkg/grpc/scalekit/v1/connected_accounts/connected_accounts_pb';
import 'dotenv/config';

const connectionName = 'googlecalendar'; // get your connection name from connection configurations
const identifier = 'user_123'; // your unique user identifier
const connectionName = 'meeting-prep-agent-googlecalendar'; // copy the exact Connection name from AgentKit > Connections
const identifier = 'user_123'; // your unique user identifier

// Get your credentials from app.scalekit.com → Developers → Settings → API Credentials
const scalekit = new ScalekitClient(
Expand All @@ -21,14 +24,22 @@ Connect a user's Google Calendar account and make API calls on their behalf —
);
const actions = scalekit.actions;

// Authenticate the user
const { link } = await actions.getAuthorizationLink({
// Create or fetch the connected account first
const response = await actions.getOrCreateConnectedAccount({
connectionName,
identifier,
});
console.log('🔗 Authorize Google Calendar:', link); // present this link to your user for authorization, or click it yourself for testing
process.stdout.write('Press Enter after authorizing...');
await new Promise(r => process.stdin.once('data', r));
const connectedAccount = response.connectedAccount;

if (connectedAccount?.status !== ConnectorStatus.ACTIVE) {
const { link } = await actions.getAuthorizationLink({
connectionName,
identifier,
});
console.log('🔗 Authorize Google Calendar:', link); // present this link to your user for authorization, or click it yourself for testing
process.stdout.write('Press Enter after authorizing...');
await new Promise(r => process.stdin.once('data', r));
}

// Make a request via Scalekit proxy
const result = await actions.request({
Expand All @@ -46,8 +57,8 @@ Connect a user's Google Calendar account and make API calls on their behalf —
from dotenv import load_dotenv
load_dotenv()

connection_name = "googlecalendar" # get your connection name from connection configurations
identifier = "user_123" # your unique user identifier
connection_name = "meeting-prep-agent-googlecalendar" # copy the exact Connection name from AgentKit > Connections
identifier = "user_123" # your unique user identifier

# Get your credentials from app.scalekit.com → Developers → Settings → API Credentials
scalekit_client = scalekit.client.ScalekitClient(
Expand All @@ -57,14 +68,21 @@ Connect a user's Google Calendar account and make API calls on their behalf —
)
actions = scalekit_client.actions

# Authenticate the user
link_response = actions.get_authorization_link(
# Create or fetch the connected account first
response = actions.get_or_create_connected_account(
connection_name=connection_name,
identifier=identifier
)
# present this link to your user for authorization, or click it yourself for testing
print("🔗 Authorize Google Calendar:", link_response.link)
input("Press Enter after authorizing...")
connected_account = response.connected_account

if connected_account.status != "ACTIVE":
link_response = actions.get_authorization_link(
connection_name=connection_name,
identifier=identifier
)
# present this link to your user for authorization, or click it yourself for testing
print("🔗 Authorize Google Calendar:", link_response.link)
input("Press Enter after authorizing...")

# Make a request via Scalekit proxy
result = actions.request(
Expand All @@ -77,4 +95,3 @@ Connect a user's Google Calendar account and make API calls on their behalf —
```
</TabItem>
</Tabs>

5 changes: 5 additions & 0 deletions src/configs/redirects.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ export const redirects = {
'/agentkit/bring-your-own-connector/using-tool-proxy':
'/agentkit/bring-your-own-connector/making-tool-calls/',

// Legacy framework pages moved to /agentkit/examples/
'/agentkit/frameworks': '/agentkit/examples/',
'/agentkit/frameworks/langchain': '/agentkit/examples/langchain/',
'/agentkit/frameworks/google-adk': '/agentkit/examples/google-adk/',
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Comment thread
saif-at-scalekit marked this conversation as resolved.
// Agent connectors redirects
'/reference/agent-connectors/[...slug]': '/agentkit/connectors/[...slug]',
'/reference/agent-connectors': '/agentkit/connectors/',
Expand Down
6 changes: 4 additions & 2 deletions src/content/docs/agentkit/connected-accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ A **connected account** is the per-user record that holds a user's credentials a

## Check account status

Use `get_or_create_connected_account` as the safe default when a user may be connecting for the first time. Use `get_connected_account` only when you know the account already exists and you need to inspect or return its stored auth details.

<Tabs syncKey="tech-stack">
<TabItem label="Python">
```python
response = actions.get_connected_account(
response = actions.get_or_create_connected_account(
connection_name="gmail",
identifier="user_123"
)
Expand All @@ -44,7 +46,7 @@ print(f"Status: {connected_account.status}")
</TabItem>
<TabItem label="Node.js">
```typescript
const response = await actions.getConnectedAccount({
const response = await actions.getOrCreateConnectedAccount({
connectionName: 'gmail',
identifier: 'user_123',
});
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/agentkit/connectors/googlecalendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ This connector uses **OAuth 2.0**. Scalekit acts as the OAuth client: it redirec

You supply your Google Calendar **Connected App** credentials (Client ID + Secret) once per environment in the Scalekit dashboard.

Before running the code examples below, create the Google Calendar connection in **AgentKit** > **Connections** and copy the exact **Connection name** from that connection into your code. The value in code must match the dashboard exactly.

<details>
<summary>Set up the connector</summary>

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/agentkit/examples/index.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Examples
title: AgentKit code samples
description: Full working examples showing how to integrate AgentKit with popular AI frameworks and agent platforms.
sidebar:
label: Examples
label: AgentKit code samples
order: 1
tableOfContents: false
---
Expand Down
15 changes: 10 additions & 5 deletions src/content/docs/agentkit/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ Complete these steps in the Scalekit dashboard before writing any code:
1. **Create a Scalekit account** at [app.scalekit.com](https://app.scalekit.com).
2. **Configure a Gmail connector** at Dashboard → **AgentKit** > **Connections** > **Create Connection** → select **Gmail**.

Create the connection in the dashboard before running any code. Then copy the exact **Connection name** from that connection and use that value in your code. It must match the dashboard exactly, and it is not always the provider slug `gmail`.

Gmail is enabled by default in new Scalekit environments. To connect to other services, create a connection for each app under **AgentKit** > **Connections** > **Create Connection**.

3. **Copy your API credentials** at Dashboard → **Developers → Settings → API Credentials**. Save these three values as environment variables:
- `SCALEKIT_CLIENT_ID`
- `SCALEKIT_CLIENT_SECRET`
- `SCALEKIT_ENV_URL`
- `GMAIL_CONNECTION_NAME` (copy the exact Connection name from **AgentKit** > **Connections**)

## Build your agent

Expand Down Expand Up @@ -127,6 +130,7 @@ Complete these steps in the Scalekit dashboard before writing any code:
env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions
connection_name = os.getenv("GMAIL_CONNECTION_NAME") # must match the Connection name in the dashboard exactly
```
</TabItem>
<TabItem label="Node.js">
Expand All @@ -142,20 +146,21 @@ Complete these steps in the Scalekit dashboard before writing any code:
);

const actions = scalekit.actions;
const connectionName = process.env.GMAIL_CONNECTION_NAME!; // must match the Connection name in the dashboard exactly
```
</TabItem>
</Tabs>

### 2. Create a connected account

Scalekit tracks each user's third-party connection as a connected account. This is the record that holds their OAuth tokens. Creating it tells Scalekit to start managing the user's Gmail access on your behalf.
Scalekit tracks each user's third-party connection as a connected account. This is the record that holds their OAuth tokens. Creating it tells Scalekit to start managing the user's Gmail access on your behalf. This step fails if the Gmail connection has not been created in **AgentKit** > **Connections** yet, or if `connection_name` does not match the dashboard exactly.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

<Tabs syncKey="tech-stack">
<TabItem label="Python">
```python wrap {2} showLineNumbers=false frame="none"
# Create or retrieve the user's connected Gmail account
response = actions.get_or_create_connected_account(
connection_name="gmail",
connection_name=connection_name,
identifier="user_123" # Replace with your system's unique user ID
)
connected_account = response.connected_account
Expand All @@ -166,7 +171,7 @@ Complete these steps in the Scalekit dashboard before writing any code:
```typescript showLineNumbers=false frame="none"
// Create or retrieve the user's connected Gmail account
const response = await actions.getOrCreateConnectedAccount({
connectionName: 'gmail',
connectionName,
identifier: 'user_123', // Replace with your system's unique user ID
});

Expand All @@ -187,7 +192,7 @@ Complete these steps in the Scalekit dashboard before writing any code:
if(connected_account.status != "ACTIVE"):
print(f"Gmail is not connected: {connected_account.status}")
link_response = actions.get_authorization_link(
connection_name="gmail",
connection_name=connection_name,
identifier="user_123"
)
print(f"🔗 click on the link to authorize Gmail", link_response.link)
Expand All @@ -202,7 +207,7 @@ Complete these steps in the Scalekit dashboard before writing any code:
if (connectedAccount?.status !== ConnectorStatus.ACTIVE) {
console.log('gmail is not connected:', connectedAccount?.status);
const linkResponse = await actions.getAuthorizationLink({
connectionName: 'gmail',
connectionName,
identifier: 'user_123',
});
console.log('🔗 click on the link to authorize gmail', linkResponse.link);
Expand Down
2 changes: 2 additions & 0 deletions src/content/docs/agentkit/sdks/python/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ print(account.connected_account.id)

Fetches auth details for a connected account. Returns sensitive credentials. Protect access to this method.

Use this when you know the connected account already exists and you need its credential payload. For first-time setup or general application flows, prefer `get_or_create_connected_account` so new users do not hit a not-found error.

Requires `connected_account_id` **or** `connection_name` + `identifier`.

<MethodParams label="Input schema" params={[
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/agentkit/tools/agent-tools-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ Let an LLM determine which tool to call and with what parameters based on user i
For more detailed framework-specific implementations, explore the AI framework guides:

<CardGrid>
<LinkCard title="LangChain Framework" icon="star" href="/agentkit/frameworks/langchain">
<LinkCard title="LangChain Framework" icon="star" href="/agentkit/examples/langchain/">
Build agents using LangChain with advanced tool calling and workflow capabilities.
</LinkCard>
<LinkCard title="Google ADK Framework" icon="star" href="/agentkit/frameworks/google-adk">
<LinkCard title="Google ADK Framework" icon="star" href="/agentkit/examples/google-adk/">
Create agents using Google ADK with Gemini models and native Google integration.
</LinkCard>
<LinkCard title="OpenClaw" icon="star" href="/agentkit/openclaw">
Expand Down
61 changes: 17 additions & 44 deletions src/content/docs/authenticate/set-up-scalekit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Before you begin, create a Scalekit account if you haven't already. After creati

## Set up Scalekit MCP Server <Badge text="Optional" />

Scalekit's Model Context Protocol (MCP) server connects your AI coding assistants to Scalekit. Manage environments, organizations, users, and authentication through natural language queries in Claude, Cursor, Windsurf, and other MCP-compatible tools.
Scalekit's Model Context Protocol (MCP) server connects your AI coding assistants to Scalekit. Manage environments, organizations, users, and authentication through natural language queries in your MCP client.

The MCP server provides AI assistants with tools for environment management, organization and user management, authentication connection setup, role administration, and admin portal access. It uses OAuth 2.1 authentication to securely connect your AI tools to your Scalekit workspace.

Expand All @@ -297,81 +297,54 @@ If you're building your own MCP server and need to add OAuth-based authorization

### Configure your MCP client

Based on your MCP client, follow the configuration instructions below:
Use the most common client configs below. For the full list of supported MCP hosts and editor setups, see the [Scalekit MCP server guide](/dev-kit/ai-assisted-development/scalekit-mcp-server/).

<Tabs>
<TabItem value="claude" label="Claude Desktop">
<TabItem value="claude-code" label="Claude Code">

1. Open the Claude Desktop app, go to Settings, then Developer
2. Click Edit Config
3. Open the `claude_desktop_config.json` file
4. Copy and paste the server config to your existing file, then save
5. Restart Claude
Run this command in your terminal:

```json
{
"mcpServers": {
"scalekit": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.scalekit.com/"]
}
}
}
```bash
claude mcp add --transport http scalekit https://mcp.scalekit.com/
```

</TabItem>

<TabItem value="cursor" label="Cursor">

1. Open Cursor, go to Settings, then Cursor Settings
2. Select MCP on the left
3. Click Add "New Global MCP Server" at the top right
4. Copy and paste the server config to your existing file, then save
5. Restart Cursor
Edit `~/.cursor/mcp.json`, or open **Cursor Settings → MCP → Add New Global MCP Server** and paste the config:

```json
{
"mcpServers": {
"scalekit": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.scalekit.com/"]
"url": "https://mcp.scalekit.com/"
}
}
}
```

</TabItem>

<TabItem value="windsurf" label="Windsurf">
<TabItem value="codex" label="Codex">

1. Open Windsurf, go to Settings, then Developer
2. Click Edit Config
3. Open the `windsurf_config.json` file
4. Copy and paste the server config to your existing file, then save
5. Restart Windsurf
Run this command in your terminal:

```json
{
"mcpServers": {
"scalekit": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.scalekit.com/"]
}
}
}
```bash
codex mcp add scalekit --url https://mcp.scalekit.com/
```

</TabItem>

<TabItem value="vscode" label="VS Code (1.101+)">
<TabItem value="opencode" label="OpenCode">

VS Code version 1.101 or greater supports OAuth natively. Configure the MCP server directly without the `mcp-remote` proxy:
Edit `opencode.json` in your project root:

```json
{
"servers": {
"mcp": {
"scalekit": {
"type": "http",
"type": "remote",
"url": "https://mcp.scalekit.com/"
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
Expand All @@ -384,7 +357,7 @@ VS Code version 1.101 or greater supports OAuth natively. Configure the MCP serv
After configuration, your MCP client will initiate an OAuth authorization workflow to securely connect to Scalekit's MCP server.

<Aside type="note">
The Scalekit MCP server source code is available on [GitHub](https://github.com/scalekit-inc/mcp). Feel free to explore the code, raise issues, or contribute new tools.
For Claude Desktop, VS Code, Windsurf, Gemini CLI, Kiro, Warp, Zed, and other hosts, use the full [Scalekit MCP server guide](/dev-kit/ai-assisted-development/scalekit-mcp-server/).
</Aside>

## Configure code editors for Scalekit documentation
Expand Down
14 changes: 10 additions & 4 deletions src/content/docs/cookbooks/daily-briefing-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,19 @@ For Google Calendar, retrieve a valid access token from Scalekit and call the Go

```python
def get_access_token(connector: str) -> str:
# get_connected_account always returns a fresh token —
# Scalekit refreshes expired tokens before returning.
response = actions.get_connected_account(
# Use get_or_create_connected_account as the safe default so
# first-time users do not hit RESOURCE_NOT_FOUND.
response = actions.get_or_create_connected_account(
connection_name=connector,
identifier=USER_ID,
)
tokens = response.connected_account.authorization_details["oauth_token"]
connected_account = response.connected_account
if connected_account.status != "ACTIVE":
raise RuntimeError(
f"{connector} is not active yet. Complete authorization first."
)

tokens = connected_account.authorization_details["oauth_token"]
return tokens["access_token"]

def fetch_calendar_events(access_token: str, max_results: int = 5) -> list:
Expand Down