Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions .changeset/tired-wings-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'workers-observability': patch
'@repo/mcp-observability': patch
'cloudflare-casb-mcp-server': patch
'cloudflare-browser-mcp-server': patch
'containers-mcp': patch
'workers-bindings': patch
'docs-vectorize': patch
'workers-builds': patch
'@repo/eval-tools': patch
'@repo/mcp-common': patch
'dns-analytics': patch
'dex-analysis': patch
'docs-autorag': patch
'cloudflare-ai-gateway-mcp-server': patch
'auditlogs': patch
'demo-day': patch
'cloudflare-autorag-mcp-server': patch
'graphql-mcp-server': patch
'logpush': patch
'cloudflare-radar-mcp-server': patch
---

Update agent + modelcontextprotocol deps
4 changes: 2 additions & 2 deletions apps/ai-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@cloudflare/workers-oauth-provider": "0.0.5",
"@hono/zod-validator": "0.4.3",
"@modelcontextprotocol/sdk": "1.17.2",
"@modelcontextprotocol/sdk": "1.18.2",
"@repo/mcp-common": "workspace:*",
"@repo/mcp-observability": "workspace:*",
"agents": "0.0.113",
"agents": "0.2.7",
"cloudflare": "4.2.0",
"hono": "4.7.6",
"zod": "3.24.2"
Expand Down
16 changes: 10 additions & 6 deletions apps/ai-gateway/src/ai-gateway.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
import { getEnv } from '@repo/mcp-common/src/env'
import { getProps } from '@repo/mcp-common/src/get-props'
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
Expand Down Expand Up @@ -51,7 +52,8 @@ export class AIGatewayMCP extends McpAgent<Env, State, Props> {

async init() {
// TODO: Probably we'll want to track account tokens usage through an account identifier at some point
const userId = this.props.type === 'user_token' ? this.props.user.id : undefined
const props = getProps(this)
const userId = props.type === 'user_token' ? props.user.id : undefined

this.server = new CloudflareMCPServer({
userId,
Expand All @@ -70,13 +72,14 @@ export class AIGatewayMCP extends McpAgent<Env, State, Props> {

async getActiveAccountId() {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
return this.props.account.id
if (props.type === 'account_token') {
return props.account.id
}
// Get UserDetails Durable Object based off the userId and retrieve the activeAccountId from it
// we do this so we can persist activeAccountId across sessions
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
return await userDetails.getActiveAccountId()
} catch (e) {
this.server.recordError(e)
Expand All @@ -86,11 +89,12 @@ export class AIGatewayMCP extends McpAgent<Env, State, Props> {

async setActiveAccountId(accountId: string) {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
if (props.type === 'account_token') {
return
}
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
await userDetails.setActiveAccountId(accountId)
} catch (e) {
this.server.recordError(e)
Expand Down
16 changes: 11 additions & 5 deletions apps/ai-gateway/src/tools/ai-gateway.tools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getCloudflareClient } from '@repo/mcp-common/src/cloudflare-api'
import { getProps } from '@repo/mcp-common/src/get-props'

import { GatewayIdParam, ListLogsParams, LogIdParam, pageParam, perPageParam } from '../types'

Expand Down Expand Up @@ -26,7 +27,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
}
}
try {
const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = await client.aiGateway.list({
account_id: accountId,
page: params.page,
Expand Down Expand Up @@ -73,7 +75,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {

const { gateway_id, ...filters } = params

const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = await client.aiGateway.logs.list(gateway_id, {
...filters,
account_id: accountId,
Expand Down Expand Up @@ -123,7 +126,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
}

try {
const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = await client.aiGateway.logs.get(params.gateway_id, params.log_id, {
account_id: accountId,
})
Expand Down Expand Up @@ -172,7 +176,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
}

try {
const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = await client.aiGateway.logs.request(params.gateway_id, params.log_id, {
account_id: accountId,
})
Expand Down Expand Up @@ -221,7 +226,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
}

try {
const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = await client.aiGateway.logs.response(params.gateway_id, params.log_id, {
account_id: accountId,
})
Expand Down
4 changes: 2 additions & 2 deletions apps/auditlogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@cloudflare/workers-oauth-provider": "0.0.5",
"@hono/zod-validator": "0.4.3",
"@modelcontextprotocol/sdk": "1.17.2",
"@modelcontextprotocol/sdk": "1.18.2",
"@repo/mcp-common": "workspace:*",
"@repo/mcp-observability": "workspace:*",
"agents": "0.0.113",
"agents": "0.2.7",
"cloudflare": "4.2.0",
"hono": "4.7.6",
"zod": "3.24.2"
Expand Down
16 changes: 10 additions & 6 deletions apps/auditlogs/src/auditlogs.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
import { getEnv } from '@repo/mcp-common/src/env'
import { getProps } from '@repo/mcp-common/src/get-props'
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
Expand Down Expand Up @@ -52,7 +53,8 @@ export class AuditlogMCP extends McpAgent<Env, State, Props> {

async init() {
// TODO: Probably we'll want to track account tokens usage through an account identifier at some point
const userId = this.props.type === 'user_token' ? this.props.user.id : undefined
const props = getProps(this)
const userId = props.type === 'user_token' ? props.user.id : undefined

this.server = new CloudflareMCPServer({
userId,
Expand All @@ -70,13 +72,14 @@ export class AuditlogMCP extends McpAgent<Env, State, Props> {

async getActiveAccountId() {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
return this.props.account.id
if (props.type === 'account_token') {
return props.account.id
}
// Get UserDetails Durable Object based off the userId and retrieve the activeAccountId from it
// we do this so we can persist activeAccountId across sessions
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
return await userDetails.getActiveAccountId()
} catch (e) {
this.server.recordError(e)
Expand All @@ -86,11 +89,12 @@ export class AuditlogMCP extends McpAgent<Env, State, Props> {

async setActiveAccountId(accountId: string) {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
if (props.type === 'account_token') {
return
}
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
await userDetails.setActiveAccountId(accountId)
} catch (e) {
this.server.recordError(e)
Expand Down
4 changes: 3 additions & 1 deletion apps/auditlogs/src/tools/auditlogs.tools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from 'zod'

import { fetchCloudflareApi } from '@repo/mcp-common/src/cloudflare-api'
import { getProps } from '@repo/mcp-common/src/get-props'

import type { AuditlogMCP } from '../auditlogs.app'

Expand Down Expand Up @@ -253,7 +254,8 @@ export function registerAuditLogTools(agent: AuditlogMCP) {
}
}
try {
const result = await handleGetAuditLogs(accountId, agent.props.accessToken, params)
const props = getProps(agent)
const result = await handleGetAuditLogs(accountId, props.accessToken, params)
return {
content: [
{
Expand Down
4 changes: 2 additions & 2 deletions apps/autorag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@cloudflare/workers-oauth-provider": "0.0.5",
"@hono/zod-validator": "0.4.3",
"@modelcontextprotocol/sdk": "1.17.2",
"@modelcontextprotocol/sdk": "1.18.2",
"@repo/mcp-common": "workspace:*",
"@repo/mcp-observability": "workspace:*",
"agents": "0.0.113",
"agents": "0.2.7",
"cloudflare": "4.2.0",
"hono": "4.7.6",
"zod": "3.24.2"
Expand Down
16 changes: 10 additions & 6 deletions apps/autorag/src/autorag.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
import { getEnv } from '@repo/mcp-common/src/env'
import { getProps } from '@repo/mcp-common/src/get-props'
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
Expand Down Expand Up @@ -51,7 +52,8 @@ export class AutoRAGMCP extends McpAgent<Env, State, Props> {

async init() {
// TODO: Probably we'll want to track account tokens usage through an account identifier at some point
const userId = this.props.type === 'user_token' ? this.props.user.id : undefined
const props = getProps(this)
const userId = props.type === 'user_token' ? props.user.id : undefined

this.server = new CloudflareMCPServer({
userId,
Expand All @@ -70,13 +72,14 @@ export class AutoRAGMCP extends McpAgent<Env, State, Props> {

async getActiveAccountId() {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
return this.props.account.id
if (props.type === 'account_token') {
return props.account.id
}
// Get UserDetails Durable Object based off the userId and retrieve the activeAccountId from it
// we do this so we can persist activeAccountId across sessions
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
return await userDetails.getActiveAccountId()
} catch (e) {
this.server.recordError(e)
Expand All @@ -86,11 +89,12 @@ export class AutoRAGMCP extends McpAgent<Env, State, Props> {

async setActiveAccountId(accountId: string) {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
if (props.type === 'account_token') {
return
}
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
await userDetails.setActiveAccountId(accountId)
} catch (e) {
this.server.recordError(e)
Expand Down
10 changes: 7 additions & 3 deletions apps/autorag/src/tools/autorag.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { V4PagePaginationArray } from 'cloudflare/src/pagination.js'
import { z } from 'zod'

import { getCloudflareClient } from '@repo/mcp-common/src/cloudflare-api'
import { getProps } from '@repo/mcp-common/src/get-props'

import { pageParam, perPageParam } from '../types'

Expand All @@ -28,7 +29,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
}
}
try {
const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = (await client.getAPIList(
`/accounts/${accountId}/autorag/rags`,
// @ts-ignore
Expand Down Expand Up @@ -90,7 +92,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
}
}

const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = (await client.post(
`/accounts/${accountId}/autorag/rags/${params.rag_id}/search`,
{
Expand Down Expand Up @@ -155,7 +158,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
}
}

const client = getCloudflareClient(agent.props.accessToken)
const props = getProps(agent)
const client = getCloudflareClient(props.accessToken)
const r = (await client.post(
`/accounts/${accountId}/autorag/rags/${params.rag_id}/ai-search`,
{
Expand Down
4 changes: 2 additions & 2 deletions apps/browser-rendering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@cloudflare/workers-oauth-provider": "0.0.5",
"@hono/zod-validator": "0.4.3",
"@modelcontextprotocol/sdk": "1.17.2",
"@modelcontextprotocol/sdk": "1.18.2",
"@repo/mcp-common": "workspace:*",
"@repo/mcp-observability": "workspace:*",
"agents": "0.0.113",
"agents": "0.2.7",
"cloudflare": "4.2.0",
"hono": "4.7.6",
"zod": "3.24.2"
Expand Down
16 changes: 10 additions & 6 deletions apps/browser-rendering/src/browser.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
import { getEnv } from '@repo/mcp-common/src/env'
import { getProps } from '@repo/mcp-common/src/get-props'
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
Expand Down Expand Up @@ -51,7 +52,8 @@ export class BrowserMCP extends McpAgent<Env, State, Props> {

async init() {
// TODO: Probably we'll want to track account tokens usage through an account identifier at some point
const userId = this.props.type === 'user_token' ? this.props.user.id : undefined
const props = getProps(this)
const userId = props.type === 'user_token' ? props.user.id : undefined

this.server = new CloudflareMCPServer({
userId,
Expand All @@ -70,13 +72,14 @@ export class BrowserMCP extends McpAgent<Env, State, Props> {

async getActiveAccountId() {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
return this.props.account.id
if (props.type === 'account_token') {
return props.account.id
}
// Get UserDetails Durable Object based off the userId and retrieve the activeAccountId from it
// we do this so we can persist activeAccountId across sessions
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
return await userDetails.getActiveAccountId()
} catch (e) {
this.server.recordError(e)
Expand All @@ -86,11 +89,12 @@ export class BrowserMCP extends McpAgent<Env, State, Props> {

async setActiveAccountId(accountId: string) {
try {
const props = getProps(this)
// account tokens are scoped to one account
if (this.props.type === 'account_token') {
if (props.type === 'account_token') {
return
}
const userDetails = getUserDetails(env, this.props.user.id)
const userDetails = getUserDetails(env, props.user.id)
await userDetails.setActiveAccountId(accountId)
} catch (e) {
this.server.recordError(e)
Expand Down
Loading