kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
a085cbb2a4
commit
2d51267943
26
CLAUDE.md
26
CLAUDE.md
|
@ -10,12 +10,13 @@ This is a monorepo for Agentic - a platform that provides API gateway services f
|
||||||
|
|
||||||
The platform consists of:
|
The platform consists of:
|
||||||
|
|
||||||
- **API Service** (`apps/api/`) - Internal platform API with authentication, billing, and resource management
|
- **API Service** (`apps/api/`) - Platform backend API with authentication, billing, and resource management
|
||||||
- **Gateway Service** (`apps/gateway/`) - Cloudflare Worker that proxies requests to origin MCP/OpenAPI services
|
- **Gateway Service** (`apps/gateway/`) - Cloudflare Worker that proxies requests to origin MCP/OpenAPI services
|
||||||
|
- **Website** (`apps/web/`) - Next.js site for both the marketing site and authenticated webapp
|
||||||
- **E2E Tests** (`apps/e2e/`) - End-to-end test suite for HTTP and MCP gateway requests
|
- **E2E Tests** (`apps/e2e/`) - End-to-end test suite for HTTP and MCP gateway requests
|
||||||
- **Shared Packages** (`packages/`) - Common utilities, types, validators, and configuration
|
- **Shared Packages** (`packages/`) - Common utilities, types, validators, and configuration
|
||||||
|
|
||||||
The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier/toolName` for REST or `https://gateway.agentic.so/deploymentIdentifier/mcp` for MCP.
|
The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier/toolName` for HTTP requests or `https://gateway.agentic.so/deploymentIdentifier/mcp` for MCP.
|
||||||
|
|
||||||
### Development Commands
|
### Development Commands
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier
|
||||||
|
|
||||||
- `pnpm dev` - Start all services in development mode
|
- `pnpm dev` - Start all services in development mode
|
||||||
- `pnpm build` - Build all packages and apps
|
- `pnpm build` - Build all packages and apps
|
||||||
- `pnpm test` - Run all tests (format, lint, typecheck, unit)
|
- `pnpm test` - Run all tests (format, lint, typecheck, unit, but not e2e tests)
|
||||||
- `pnpm clean` - Clean all build artifacts
|
- `pnpm clean` - Clean all build artifacts
|
||||||
|
|
||||||
**Individual test commands:**
|
**Individual test commands:**
|
||||||
|
@ -40,9 +41,10 @@ The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier
|
||||||
|
|
||||||
**E2E testing:**
|
**E2E testing:**
|
||||||
|
|
||||||
- `cd apps/e2e && pnpm e2e` - Run all E2E tests
|
- (from the `apps/e2e` directory)
|
||||||
- `cd apps/e2e && pnpm e2e-http` - Run HTTP edge E2E tests
|
- `pnpm e2e` - Run all E2E tests
|
||||||
- `cd apps/e2e && pnpm e2e-mcp` - Run MCP edge E2E tests
|
- `pnpm e2e-http` - Run HTTP edge E2E tests
|
||||||
|
- `pnpm e2e-mcp` - Run MCP edge E2E tests
|
||||||
|
|
||||||
### Key Database Models
|
### Key Database Models
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ The system uses Drizzle ORM with PostgreSQL. Core entities:
|
||||||
- **User** - Platform users
|
- **User** - Platform users
|
||||||
- **Team** - Organizations with members and billing
|
- **Team** - Organizations with members and billing
|
||||||
- **Project** - Namespace API products comprised of immutable Deployments
|
- **Project** - Namespace API products comprised of immutable Deployments
|
||||||
- **Deployment** - Immutable instances of MCP/OpenAPI services
|
- **Deployment** - Immutable instances of MCP/OpenAPI services, including gateway and pricing config
|
||||||
- **Consumer** - Customer subscription tracking usage and billing
|
- **Consumer** - Customer subscription tracking usage and billing
|
||||||
|
|
||||||
### Agentic Configuration
|
### Agentic Configuration
|
||||||
|
@ -69,19 +71,23 @@ The platform supports both MCP servers and OpenAPI specifications as origin adap
|
||||||
### Gateway Request Flow
|
### Gateway Request Flow
|
||||||
|
|
||||||
1. Request hits gateway with deployment identifier
|
1. Request hits gateway with deployment identifier
|
||||||
2. Gateway validates consumer authentication/rate limits
|
2. Gateway validates consumer authentication/rate limits/caching
|
||||||
3. Request is transformed and forwarded to origin service
|
3. Request is transformed and forwarded to origin service
|
||||||
4. Response is processed and returned with appropriate headers
|
4. Response is processed and returned with appropriate headers
|
||||||
5. Usage is tracked for billing and analytics
|
5. Usage is tracked for billing and analytics
|
||||||
|
|
||||||
### Environment Setup
|
### Environment Setup
|
||||||
|
|
||||||
Both `apps/api` and `apps/gateway` require environment variables for:
|
All apps require environment variables for:
|
||||||
|
|
||||||
- Database connections (`DATABASE_URL`)
|
- Database connections (`DATABASE_URL`)
|
||||||
- External services (Stripe, GitHub, Resend, Sentry)
|
- External services (Stripe, GitHub, Resend, Sentry)
|
||||||
|
- Internal services (API, gateway, etc)
|
||||||
- Authentication secrets
|
- Authentication secrets
|
||||||
|
- Stripe secrets
|
||||||
- Admin API keys
|
- Admin API keys
|
||||||
|
- Sentry DSN
|
||||||
|
- etc
|
||||||
|
|
||||||
## Coding Conventions
|
## Coding Conventions
|
||||||
|
|
||||||
|
@ -105,7 +111,7 @@ Both `apps/api` and `apps/gateway` require environment variables for:
|
||||||
- `import { Foo } from './foo.js'`
|
- `import { Foo } from './foo.js'`
|
||||||
- `import { type Route } from './types/root.js'`
|
- `import { type Route } from './types/root.js'`
|
||||||
- `import { Foo } from './foo.ts'`
|
- `import { Foo } from './foo.ts'`
|
||||||
- Always prefer named exports over default exports
|
- Always prefer named exports over default exports except for when default exports are required (like in Next.js `page.tsx` components)
|
||||||
|
|
||||||
### Packages
|
### Packages
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function MarketplaceProjectIndex({
|
||||||
const checkout = searchParams.get('checkout')
|
const checkout = searchParams.get('checkout')
|
||||||
const plan = searchParams.get('plan')
|
const plan = searchParams.get('plan')
|
||||||
|
|
||||||
// Load the public project.
|
// Load the public project
|
||||||
const {
|
const {
|
||||||
data: project,
|
data: project,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -36,10 +36,10 @@ export function MarketplaceProjectIndex({
|
||||||
})
|
})
|
||||||
|
|
||||||
// If the user is authenticated, check if they have an active subscription to
|
// If the user is authenticated, check if they have an active subscription to
|
||||||
// this project.
|
// this project
|
||||||
const {
|
const {
|
||||||
data: consumer
|
data: consumer,
|
||||||
// isLoading: isConsumerLoading,
|
isLoading: isConsumerLoading
|
||||||
// isError: isConsumerError
|
// isError: isConsumerError
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: [
|
queryKey: [
|
||||||
|
@ -104,24 +104,29 @@ export function MarketplaceProjectIndex({
|
||||||
checkout === 'true' &&
|
checkout === 'true' &&
|
||||||
plan &&
|
plan &&
|
||||||
project &&
|
project &&
|
||||||
|
!isConsumerLoading &&
|
||||||
!hasInitializedCheckoutFromSearchParams.current
|
!hasInitializedCheckoutFromSearchParams.current
|
||||||
) {
|
) {
|
||||||
hasInitializedCheckoutFromSearchParams.current = true
|
hasInitializedCheckoutFromSearchParams.current = true
|
||||||
|
|
||||||
// Start checkout flow if search params have `?checkout=true&plan={plan}`
|
if (consumer?.plan !== plan) {
|
||||||
// This is to allow unauthenticated users to subscribe to a plan by first
|
// Start checkout flow if search params have `?checkout=true&plan={plan}`
|
||||||
// visiting `/login` or `/signup` and then being redirected to this page
|
// This is to allow unauthenticated users to subscribe to a plan by first
|
||||||
// with the target checkout search params already pre-filled.
|
// visiting `/login` or `/signup` and then being redirected to this page
|
||||||
// Another use case for this functionality is providing a single link to
|
// with the target checkout search params already pre-filled.
|
||||||
// subscribe to a specific project and pricing plan – with the checkout
|
// Another use case for this functionality is providing a single link to
|
||||||
// details pre-filled.
|
// subscribe to a specific project and pricing plan – with the checkout
|
||||||
void onSubscribe(checkout)
|
// details pre-filled.
|
||||||
|
void onSubscribe(checkout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
checkout,
|
checkout,
|
||||||
plan,
|
plan,
|
||||||
ctx,
|
ctx,
|
||||||
project,
|
project,
|
||||||
|
isConsumerLoading,
|
||||||
|
consumer,
|
||||||
onSubscribe,
|
onSubscribe,
|
||||||
hasInitializedCheckoutFromSearchParams
|
hasInitializedCheckoutFromSearchParams
|
||||||
])
|
])
|
||||||
|
|
|
@ -5,11 +5,12 @@ export default function IndexPage() {
|
||||||
<>
|
<>
|
||||||
<section>
|
<section>
|
||||||
<h1 className='my-0! text-center text-balance leading-snug md:leading-none text-4xl font-extrabold'>
|
<h1 className='my-0! text-center text-balance leading-snug md:leading-none text-4xl font-extrabold'>
|
||||||
Agentic MCP Gateway
|
MCP tools that actually work
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<h5 className='my-8! text-center text-balance text-lg'>
|
<h5 className='my-8! text-center text-balance text-lg'>
|
||||||
An API gateway built exclusively for AI agents.
|
Deploy any MCP server or OpenAPI service to Agentic's MCP gateway, and
|
||||||
|
in minutes have a production-ready, monetizable MCP product.
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<HeroButton>Get Started</HeroButton>
|
<HeroButton>Get Started</HeroButton>
|
||||||
|
|
|
@ -17,6 +17,10 @@ export function Header() {
|
||||||
</ActiveLink>
|
</ActiveLink>
|
||||||
|
|
||||||
<div className='flex justify-end items-center h-full gap-4'>
|
<div className='flex justify-end items-center h-full gap-4'>
|
||||||
|
<ActiveLink href='/marketplace' className='link'>
|
||||||
|
Marketplace
|
||||||
|
</ActiveLink>
|
||||||
|
|
||||||
<ActiveLink href='/about' className='link'>
|
<ActiveLink href='/about' className='link'>
|
||||||
About
|
About
|
||||||
</ActiveLink>
|
</ActiveLink>
|
||||||
|
|
15
readme.md
15
readme.md
|
@ -17,15 +17,19 @@
|
||||||
- webapp
|
- webapp
|
||||||
- consider a PrettyJson component which displays json but links to resources
|
- consider a PrettyJson component which displays json but links to resources
|
||||||
- stripe
|
- stripe
|
||||||
- if user is subscribed to a plan, show that plan as selected
|
- stripe checkout for changing plans? (need to at least be able to upgrade)
|
||||||
- stripe checkout
|
|
||||||
- stripe billing portal
|
- stripe billing portal
|
||||||
|
- should we bypass stripe for `free` plans to increase conversions?
|
||||||
- **API gateway**
|
- **API gateway**
|
||||||
- oauth flow
|
- oauth flow
|
||||||
- https://docs.scalekit.com/guides/mcp/oauth
|
- https://docs.scalekit.com/guides/mcp/oauth
|
||||||
- custom oauth flow might need to use separate domains per project instead of separate pathnames?
|
- custom oauth flow might need to use separate domains per project instead of separate pathnames?
|
||||||
- since the .well-known routes and standard oauth 2.1 routes are all at the top-level?
|
- since the .well-known routes and standard oauth 2.1 routes are all at the top-level?
|
||||||
- **test usage tracking and reporting**
|
- **e2e tests for usage tracking and reporting**
|
||||||
|
- marketplace
|
||||||
|
- need a different flag besides `private` for inclusion on the marketplace
|
||||||
|
- projects may be public but not accepted into the marketplace, and that's okay?
|
||||||
|
- => **punt on this for mvp**
|
||||||
- docs
|
- docs
|
||||||
- main readme
|
- main readme
|
||||||
- sub readmes
|
- sub readmes
|
||||||
|
@ -86,8 +90,9 @@
|
||||||
- how to guarantee that the request is coming from agentic?
|
- how to guarantee that the request is coming from agentic?
|
||||||
- `_meta` for tool calls
|
- `_meta` for tool calls
|
||||||
- _still need a way of doing this for initial connection requests_
|
- _still need a way of doing this for initial connection requests_
|
||||||
|
- _=> ask in the official mcp developers discord_
|
||||||
- mcp auth provider support
|
- mcp auth provider support
|
||||||
- binary bodies / responses?
|
- test binary bodies / responses / mcp resources
|
||||||
- resources
|
- resources
|
||||||
- prompts
|
- prompts
|
||||||
- other MCP features?
|
- other MCP features?
|
||||||
|
@ -100,7 +105,7 @@
|
||||||
- support multiple rate-limits by slug
|
- support multiple rate-limits by slug
|
||||||
- RateLimit-Policy: "burst";q=100;w=60,"daily";q=1000;w=86400
|
- RateLimit-Policy: "burst";q=100;w=60,"daily";q=1000;w=86400
|
||||||
- https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/
|
- https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/
|
||||||
- make `$schema` public for `agentic.config.json`
|
- make json `$schema` public for `agentic.config.json`
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue