Skip to content

Commit 43f493d

Browse files
authored
Add sentry to docs and bump agent deps (#230)
* Add sentry to docs * Update agent + modelcontextprotocol deps * Use getProps() which throws an error if props isn't defined. - In new versions of agents package, props might be undefined, so we now always have to check that's defined
1 parent d7a6029 commit 43f493d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4704
-538
lines changed

.changeset/tired-wings-dance.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'workers-observability': patch
3+
'@repo/mcp-observability': patch
4+
'cloudflare-casb-mcp-server': patch
5+
'cloudflare-browser-mcp-server': patch
6+
'containers-mcp': patch
7+
'workers-bindings': patch
8+
'docs-vectorize': patch
9+
'workers-builds': patch
10+
'@repo/eval-tools': patch
11+
'@repo/mcp-common': patch
12+
'dns-analytics': patch
13+
'dex-analysis': patch
14+
'docs-autorag': patch
15+
'cloudflare-ai-gateway-mcp-server': patch
16+
'auditlogs': patch
17+
'demo-day': patch
18+
'cloudflare-autorag-mcp-server': patch
19+
'graphql-mcp-server': patch
20+
'logpush': patch
21+
'cloudflare-radar-mcp-server': patch
22+
---
23+
24+
Update agent + modelcontextprotocol deps

apps/ai-gateway/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"dependencies": {
1515
"@cloudflare/workers-oauth-provider": "0.0.5",
1616
"@hono/zod-validator": "0.4.3",
17-
"@modelcontextprotocol/sdk": "1.17.2",
17+
"@modelcontextprotocol/sdk": "1.18.2",
1818
"@repo/mcp-common": "workspace:*",
1919
"@repo/mcp-observability": "workspace:*",
20-
"agents": "0.0.113",
20+
"agents": "0.2.7",
2121
"cloudflare": "4.2.0",
2222
"hono": "4.7.6",
2323
"zod": "3.24.2"

apps/ai-gateway/src/ai-gateway.app.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
99
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
1010
import { getEnv } from '@repo/mcp-common/src/env'
11+
import { getProps } from '@repo/mcp-common/src/get-props'
1112
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
1213
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
1314
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
@@ -51,7 +52,8 @@ export class AIGatewayMCP extends McpAgent<Env, State, Props> {
5152

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

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

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

8790
async setActiveAccountId(accountId: string) {
8891
try {
92+
const props = getProps(this)
8993
// account tokens are scoped to one account
90-
if (this.props.type === 'account_token') {
94+
if (props.type === 'account_token') {
9195
return
9296
}
93-
const userDetails = getUserDetails(env, this.props.user.id)
97+
const userDetails = getUserDetails(env, props.user.id)
9498
await userDetails.setActiveAccountId(accountId)
9599
} catch (e) {
96100
this.server.recordError(e)

apps/ai-gateway/src/tools/ai-gateway.tools.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getCloudflareClient } from '@repo/mcp-common/src/cloudflare-api'
2+
import { getProps } from '@repo/mcp-common/src/get-props'
23

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

@@ -26,7 +27,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
2627
}
2728
}
2829
try {
29-
const client = getCloudflareClient(agent.props.accessToken)
30+
const props = getProps(agent)
31+
const client = getCloudflareClient(props.accessToken)
3032
const r = await client.aiGateway.list({
3133
account_id: accountId,
3234
page: params.page,
@@ -73,7 +75,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
7375

7476
const { gateway_id, ...filters } = params
7577

76-
const client = getCloudflareClient(agent.props.accessToken)
78+
const props = getProps(agent)
79+
const client = getCloudflareClient(props.accessToken)
7780
const r = await client.aiGateway.logs.list(gateway_id, {
7881
...filters,
7982
account_id: accountId,
@@ -123,7 +126,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
123126
}
124127

125128
try {
126-
const client = getCloudflareClient(agent.props.accessToken)
129+
const props = getProps(agent)
130+
const client = getCloudflareClient(props.accessToken)
127131
const r = await client.aiGateway.logs.get(params.gateway_id, params.log_id, {
128132
account_id: accountId,
129133
})
@@ -172,7 +176,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
172176
}
173177

174178
try {
175-
const client = getCloudflareClient(agent.props.accessToken)
179+
const props = getProps(agent)
180+
const client = getCloudflareClient(props.accessToken)
176181
const r = await client.aiGateway.logs.request(params.gateway_id, params.log_id, {
177182
account_id: accountId,
178183
})
@@ -221,7 +226,8 @@ export function registerAIGatewayTools(agent: AIGatewayMCP) {
221226
}
222227

223228
try {
224-
const client = getCloudflareClient(agent.props.accessToken)
229+
const props = getProps(agent)
230+
const client = getCloudflareClient(props.accessToken)
225231
const r = await client.aiGateway.logs.response(params.gateway_id, params.log_id, {
226232
account_id: accountId,
227233
})

apps/auditlogs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"dependencies": {
1515
"@cloudflare/workers-oauth-provider": "0.0.5",
1616
"@hono/zod-validator": "0.4.3",
17-
"@modelcontextprotocol/sdk": "1.17.2",
17+
"@modelcontextprotocol/sdk": "1.18.2",
1818
"@repo/mcp-common": "workspace:*",
1919
"@repo/mcp-observability": "workspace:*",
20-
"agents": "0.0.113",
20+
"agents": "0.2.7",
2121
"cloudflare": "4.2.0",
2222
"hono": "4.7.6",
2323
"zod": "3.24.2"

apps/auditlogs/src/auditlogs.app.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
99
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
1010
import { getEnv } from '@repo/mcp-common/src/env'
11+
import { getProps } from '@repo/mcp-common/src/get-props'
1112
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
1213
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
1314
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
@@ -52,7 +53,8 @@ export class AuditlogMCP extends McpAgent<Env, State, Props> {
5253

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

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

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

8790
async setActiveAccountId(accountId: string) {
8891
try {
92+
const props = getProps(this)
8993
// account tokens are scoped to one account
90-
if (this.props.type === 'account_token') {
94+
if (props.type === 'account_token') {
9195
return
9296
}
93-
const userDetails = getUserDetails(env, this.props.user.id)
97+
const userDetails = getUserDetails(env, props.user.id)
9498
await userDetails.setActiveAccountId(accountId)
9599
} catch (e) {
96100
this.server.recordError(e)

apps/auditlogs/src/tools/auditlogs.tools.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { z } from 'zod'
22

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

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

@@ -253,7 +254,8 @@ export function registerAuditLogTools(agent: AuditlogMCP) {
253254
}
254255
}
255256
try {
256-
const result = await handleGetAuditLogs(accountId, agent.props.accessToken, params)
257+
const props = getProps(agent)
258+
const result = await handleGetAuditLogs(accountId, props.accessToken, params)
257259
return {
258260
content: [
259261
{

apps/autorag/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"dependencies": {
1515
"@cloudflare/workers-oauth-provider": "0.0.5",
1616
"@hono/zod-validator": "0.4.3",
17-
"@modelcontextprotocol/sdk": "1.17.2",
17+
"@modelcontextprotocol/sdk": "1.18.2",
1818
"@repo/mcp-common": "workspace:*",
1919
"@repo/mcp-observability": "workspace:*",
20-
"agents": "0.0.113",
20+
"agents": "0.2.7",
2121
"cloudflare": "4.2.0",
2222
"hono": "4.7.6",
2323
"zod": "3.24.2"

apps/autorag/src/autorag.app.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
99
import { getUserDetails, UserDetails } from '@repo/mcp-common/src/durable-objects/user_details.do'
1010
import { getEnv } from '@repo/mcp-common/src/env'
11+
import { getProps } from '@repo/mcp-common/src/get-props'
1112
import { RequiredScopes } from '@repo/mcp-common/src/scopes'
1213
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
1314
import { registerAccountTools } from '@repo/mcp-common/src/tools/account.tools'
@@ -51,7 +52,8 @@ export class AutoRAGMCP extends McpAgent<Env, State, Props> {
5152

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

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

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

8790
async setActiveAccountId(accountId: string) {
8891
try {
92+
const props = getProps(this)
8993
// account tokens are scoped to one account
90-
if (this.props.type === 'account_token') {
94+
if (props.type === 'account_token') {
9195
return
9296
}
93-
const userDetails = getUserDetails(env, this.props.user.id)
97+
const userDetails = getUserDetails(env, props.user.id)
9498
await userDetails.setActiveAccountId(accountId)
9599
} catch (e) {
96100
this.server.recordError(e)

apps/autorag/src/tools/autorag.tools.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { V4PagePaginationArray } from 'cloudflare/src/pagination.js'
22
import { z } from 'zod'
33

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

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

@@ -28,7 +29,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
2829
}
2930
}
3031
try {
31-
const client = getCloudflareClient(agent.props.accessToken)
32+
const props = getProps(agent)
33+
const client = getCloudflareClient(props.accessToken)
3234
const r = (await client.getAPIList(
3335
`/accounts/${accountId}/autorag/rags`,
3436
// @ts-ignore
@@ -90,7 +92,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
9092
}
9193
}
9294

93-
const client = getCloudflareClient(agent.props.accessToken)
95+
const props = getProps(agent)
96+
const client = getCloudflareClient(props.accessToken)
9497
const r = (await client.post(
9598
`/accounts/${accountId}/autorag/rags/${params.rag_id}/search`,
9699
{
@@ -155,7 +158,8 @@ export function registerAutoRAGTools(agent: AutoRAGMCP) {
155158
}
156159
}
157160

158-
const client = getCloudflareClient(agent.props.accessToken)
161+
const props = getProps(agent)
162+
const client = getCloudflareClient(props.accessToken)
159163
const r = (await client.post(
160164
`/accounts/${accountId}/autorag/rags/${params.rag_id}/ai-search`,
161165
{

0 commit comments

Comments
 (0)