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:
|
||||
|
||||
- **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
|
||||
- **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
|
||||
- **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
|
||||
|
||||
|
@ -23,7 +24,7 @@ The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier
|
|||
|
||||
- `pnpm dev` - Start all services in development mode
|
||||
- `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
|
||||
|
||||
**Individual test commands:**
|
||||
|
@ -40,9 +41,10 @@ The gateway accepts requests at `https://gateway.agentic.so/deploymentIdentifier
|
|||
|
||||
**E2E testing:**
|
||||
|
||||
- `cd apps/e2e && pnpm e2e` - Run all E2E tests
|
||||
- `cd apps/e2e && pnpm e2e-http` - Run HTTP edge E2E tests
|
||||
- `cd apps/e2e && pnpm e2e-mcp` - Run MCP edge E2E tests
|
||||
- (from the `apps/e2e` directory)
|
||||
- `pnpm e2e` - Run all E2E tests
|
||||
- `pnpm e2e-http` - Run HTTP edge E2E tests
|
||||
- `pnpm e2e-mcp` - Run MCP edge E2E tests
|
||||
|
||||
### Key Database Models
|
||||
|
||||
|
@ -51,7 +53,7 @@ The system uses Drizzle ORM with PostgreSQL. Core entities:
|
|||
- **User** - Platform users
|
||||
- **Team** - Organizations with members and billing
|
||||
- **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
|
||||
|
||||
### Agentic Configuration
|
||||
|
@ -69,19 +71,23 @@ The platform supports both MCP servers and OpenAPI specifications as origin adap
|
|||
### Gateway Request Flow
|
||||
|
||||
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
|
||||
4. Response is processed and returned with appropriate headers
|
||||
5. Usage is tracked for billing and analytics
|
||||
|
||||
### Environment Setup
|
||||
|
||||
Both `apps/api` and `apps/gateway` require environment variables for:
|
||||
All apps require environment variables for:
|
||||
|
||||
- Database connections (`DATABASE_URL`)
|
||||
- External services (Stripe, GitHub, Resend, Sentry)
|
||||
- Internal services (API, gateway, etc)
|
||||
- Authentication secrets
|
||||
- Stripe secrets
|
||||
- Admin API keys
|
||||
- Sentry DSN
|
||||
- etc
|
||||
|
||||
## Coding Conventions
|
||||
|
||||
|
@ -105,7 +111,7 @@ Both `apps/api` and `apps/gateway` require environment variables for:
|
|||
- `import { Foo } from './foo.js'`
|
||||
- `import { type Route } from './types/root.js'`
|
||||
- `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
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export function MarketplaceProjectIndex({
|
|||
const checkout = searchParams.get('checkout')
|
||||
const plan = searchParams.get('plan')
|
||||
|
||||
// Load the public project.
|
||||
// Load the public project
|
||||
const {
|
||||
data: project,
|
||||
isLoading,
|
||||
|
@ -36,10 +36,10 @@ export function MarketplaceProjectIndex({
|
|||
})
|
||||
|
||||
// If the user is authenticated, check if they have an active subscription to
|
||||
// this project.
|
||||
// this project
|
||||
const {
|
||||
data: consumer
|
||||
// isLoading: isConsumerLoading,
|
||||
data: consumer,
|
||||
isLoading: isConsumerLoading
|
||||
// isError: isConsumerError
|
||||
} = useQuery({
|
||||
queryKey: [
|
||||
|
@ -104,24 +104,29 @@ export function MarketplaceProjectIndex({
|
|||
checkout === 'true' &&
|
||||
plan &&
|
||||
project &&
|
||||
!isConsumerLoading &&
|
||||
!hasInitializedCheckoutFromSearchParams.current
|
||||
) {
|
||||
hasInitializedCheckoutFromSearchParams.current = true
|
||||
|
||||
// Start checkout flow if search params have `?checkout=true&plan={plan}`
|
||||
// This is to allow unauthenticated users to subscribe to a plan by first
|
||||
// visiting `/login` or `/signup` and then being redirected to this page
|
||||
// with the target checkout search params already pre-filled.
|
||||
// Another use case for this functionality is providing a single link to
|
||||
// subscribe to a specific project and pricing plan – with the checkout
|
||||
// details pre-filled.
|
||||
void onSubscribe(checkout)
|
||||
if (consumer?.plan !== plan) {
|
||||
// Start checkout flow if search params have `?checkout=true&plan={plan}`
|
||||
// This is to allow unauthenticated users to subscribe to a plan by first
|
||||
// visiting `/login` or `/signup` and then being redirected to this page
|
||||
// with the target checkout search params already pre-filled.
|
||||
// Another use case for this functionality is providing a single link to
|
||||
// subscribe to a specific project and pricing plan – with the checkout
|
||||
// details pre-filled.
|
||||
void onSubscribe(checkout)
|
||||
}
|
||||
}
|
||||
}, [
|
||||
checkout,
|
||||
plan,
|
||||
ctx,
|
||||
project,
|
||||
isConsumerLoading,
|
||||
consumer,
|
||||
onSubscribe,
|
||||
hasInitializedCheckoutFromSearchParams
|
||||
])
|
||||
|
|
|
@ -5,11 +5,12 @@ export default function IndexPage() {
|
|||
<>
|
||||
<section>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<HeroButton>Get Started</HeroButton>
|
||||
|
|
|
@ -17,6 +17,10 @@ export function Header() {
|
|||
</ActiveLink>
|
||||
|
||||
<div className='flex justify-end items-center h-full gap-4'>
|
||||
<ActiveLink href='/marketplace' className='link'>
|
||||
Marketplace
|
||||
</ActiveLink>
|
||||
|
||||
<ActiveLink href='/about' className='link'>
|
||||
About
|
||||
</ActiveLink>
|
||||
|
|
15
readme.md
15
readme.md
|
@ -17,15 +17,19 @@
|
|||
- webapp
|
||||
- consider a PrettyJson component which displays json but links to resources
|
||||
- stripe
|
||||
- if user is subscribed to a plan, show that plan as selected
|
||||
- stripe checkout
|
||||
- stripe checkout for changing plans? (need to at least be able to upgrade)
|
||||
- stripe billing portal
|
||||
- should we bypass stripe for `free` plans to increase conversions?
|
||||
- **API gateway**
|
||||
- oauth flow
|
||||
- https://docs.scalekit.com/guides/mcp/oauth
|
||||
- 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?
|
||||
- **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
|
||||
- main readme
|
||||
- sub readmes
|
||||
|
@ -86,8 +90,9 @@
|
|||
- how to guarantee that the request is coming from agentic?
|
||||
- `_meta` for tool calls
|
||||
- _still need a way of doing this for initial connection requests_
|
||||
- _=> ask in the official mcp developers discord_
|
||||
- mcp auth provider support
|
||||
- binary bodies / responses?
|
||||
- test binary bodies / responses / mcp resources
|
||||
- resources
|
||||
- prompts
|
||||
- other MCP features?
|
||||
|
@ -100,7 +105,7 @@
|
|||
- support multiple rate-limits by slug
|
||||
- RateLimit-Policy: "burst";q=100;w=60,"daily";q=1000;w=86400
|
||||
- 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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue