Skip to content

Commit 70b32e0

Browse files
committed
Remove apiToken as we now have OAuth setup
1 parent 014b9bb commit 70b32e0

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

apps/auditlogs/src/index.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { registerAccountTools } from '@repo/mcp-common/src/tools/account'
1616
import { MetricsTracker } from '../../../packages/mcp-observability/src'
1717
import { registerAuditLogTools } from './tools/auditlogs'
1818

19-
import type { AccountSchema, UserSchema } from '@repo/mcp-common/src/cloudflare-oauth-handler'
19+
import type { AuthProps } from '@repo/mcp-common/src/cloudflare-oauth-handler'
2020
import type { Env } from './context'
2121

2222
const env = getEnv<Env>()
@@ -30,12 +30,7 @@ const metrics = new MetricsTracker(env.MCP_METRICS, {
3030

3131
// Context from the auth process, encrypted & stored in the auth token
3232
// and provided to the DurableMCP as this.props
33-
export type Props = {
34-
accessToken: string
35-
apiToken: string
36-
user: UserSchema['result']
37-
accounts: AccountSchema['result']
38-
}
33+
type Props = AuthProps
3934

4035
export type State = { activeAccountId: string | null }
4136

@@ -65,8 +60,6 @@ export class AuditlogMCP extends McpAgent<Env, State, Props> {
6560
version: this.env.MCP_SERVER_VERSION,
6661
},
6762
})
68-
this.props.apiToken = env.CLOUDFLARE_ACCESS_TOKEN
69-
7063
registerAccountTools(this)
7164

7265
// Register Cloudflare Audit Log tools

apps/auditlogs/src/tools/auditlogs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ export function registerAuditLogTools(agent: AuditlogMCP) {
253253
}
254254
}
255255
try {
256-
const token = agent.props.apiToken.length > 0 ? agent.props.apiToken : agent.props.accessToken
257-
const result = await handleGetAuditLogs(accountId, token, params)
256+
const result = await handleGetAuditLogs(accountId, agent.props.accessToken, params)
258257
return {
259258
content: [
260259
{

apps/auditlogs/vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'
22

3-
import { Env } from './src/context'
3+
import type { Env } from './src/context'
44

55
export interface TestEnv extends Env {
66
CLOUDFLARE_MOCK_ACCOUNT_ID: string

0 commit comments

Comments
 (0)