pull/715/head
Travis Fischer 2025-06-08 00:45:57 +07:00
rodzic fbb9863208
commit ab32e0bb6a
7 zmienionych plików z 16 dodań i 11 usunięć

1
.gitignore vendored
Wyświetl plik

@ -46,6 +46,5 @@ out/
apps/api/auth-db-temp.json apps/api/auth-db-temp.json
.dev.vars .dev.vars
.dev.vars.*
.wrangler .wrangler

Wyświetl plik

@ -0,0 +1,5 @@
ENVIRONMENT=
SENTRY_DSN=
AGENTIC_API_BASE_URL=
AGENTIC_API_KEY=

Wyświetl plik

@ -78,7 +78,7 @@ app.all(async (ctx) => {
case 'mcp': { case 'mcp': {
assert( assert(
resolvedOriginRequest.toolArgs, resolvedOriginRequest.toolCallArgs,
500, 500,
'Tool args are required for MCP origin requests' 'Tool args are required for MCP origin requests'
) )
@ -99,7 +99,7 @@ app.all(async (ctx) => {
// TODO: add response caching for MCP tool calls // TODO: add response caching for MCP tool calls
const toolCallResponse = await client.callTool({ const toolCallResponse = await client.callTool({
name: resolvedOriginRequest.tool.name, name: resolvedOriginRequest.tool.name,
arguments: resolvedOriginRequest.toolArgs arguments: resolvedOriginRequest.toolCallArgs
}) })
originResponse = await createHttpResponseFromMcpToolCallResponse(ctx, { originResponse = await createHttpResponseFromMcpToolCallResponse(ctx, {

Wyświetl plik

@ -4,7 +4,7 @@ import type {
} from '@agentic/platform-types' } from '@agentic/platform-types'
import { assert } from '@agentic/platform-core' import { assert } from '@agentic/platform-core'
import type { GatewayHonoContext, ToolArgs } from './types' import type { GatewayHonoContext, ToolCallArgs } from './types'
export async function createRequestForOpenAPIOperation( export async function createRequestForOpenAPIOperation(
ctx: GatewayHonoContext, ctx: GatewayHonoContext,
@ -13,7 +13,7 @@ export async function createRequestForOpenAPIOperation(
operation, operation,
deployment deployment
}: { }: {
toolArgs: ToolArgs toolArgs: ToolCallArgs
operation: OpenAPIToolOperation operation: OpenAPIToolOperation
deployment: AdminDeployment deployment: AdminDeployment
} }

Wyświetl plik

@ -6,7 +6,7 @@ import type {
AdminConsumer, AdminConsumer,
GatewayHonoContext, GatewayHonoContext,
ResolvedOriginRequest, ResolvedOriginRequest,
ToolArgs ToolCallArgs
} from './types' } from './types'
import { createRequestForOpenAPIOperation } from './create-request-for-openapi-operation' import { createRequestForOpenAPIOperation } from './create-request-for-openapi-operation'
import { enforceRateLimit } from './enforce-rate-limit' import { enforceRateLimit } from './enforce-rate-limit'
@ -168,7 +168,7 @@ export async function resolveOriginRequest(
if (rateLimit) { if (rateLimit) {
await enforceRateLimit(ctx, { await enforceRateLimit(ctx, {
id: consumer?.id ?? ip, id: consumer?.id ?? ip,
interval: rateLimit.interval * 1000, interval: rateLimit.interval,
maxPerInterval: rateLimit.maxPerInterval, maxPerInterval: rateLimit.maxPerInterval,
method, method,
pathname pathname
@ -177,7 +177,7 @@ export async function resolveOriginRequest(
const { originAdapter } = deployment const { originAdapter } = deployment
let originRequest: Request | undefined let originRequest: Request | undefined
let toolArgs: ToolArgs | undefined let toolArgs: ToolCallArgs | undefined
if (originAdapter.type === 'raw') { if (originAdapter.type === 'raw') {
const originRequestUrl = `${deployment.originUrl}/${toolName}${requestUrl.search}` const originRequestUrl = `${deployment.originUrl}/${toolName}${requestUrl.search}`
@ -207,7 +207,7 @@ export async function resolveOriginRequest(
return { return {
originRequest, originRequest,
toolArgs, toolCallArgs: toolArgs,
deployment, deployment,
consumer, consumer,
tool, tool,

Wyświetl plik

@ -42,7 +42,7 @@ export type GatewayHonoEnv = {
export type GatewayHonoContext = Context<GatewayHonoEnv> export type GatewayHonoContext = Context<GatewayHonoEnv>
// TODO: better type here // TODO: better type here
export type ToolArgs = Record<string, any> export type ToolCallArgs = Record<string, any>
export type ResolvedOriginRequest = { export type ResolvedOriginRequest = {
deployment: AdminDeployment deployment: AdminDeployment
@ -55,5 +55,5 @@ export type ResolvedOriginRequest = {
pricingPlanSlug?: string pricingPlanSlug?: string
originRequest?: Request originRequest?: Request
toolArgs?: ToolArgs toolCallArgs?: ToolCallArgs
} }

Wyświetl plik

@ -29,6 +29,7 @@
- auth - auth
- custom auth pages for `openauth` - custom auth pages for `openauth`
- API gateway - API gateway
- enforce rate limits
- how to handle binary bodies and responses? - how to handle binary bodies and responses?
- add support for `immutable` in `toolConfigs` - add support for `immutable` in `toolConfigs`
- **Public MCP server interface** - **Public MCP server interface**