cortex
cortex-docs · cortex-docs/cortex
Cortex tạo tài liệu API tương tác, SDK đã được định kiểu và máy chủ MCP từ nhiều thông số kỹ thuật API và tệp Markdown.
Cortex - Tạo tài liệu API tương tác, SDK có kiểu dữ liệu (typed SDK) và máy chủ MCP từ OpenAPI, AsyncAPI, GraphQL, gRPC, OpenRPC và Markdown.
Xem kết quả thực tế
Ảnh từ README của tác giả cortex-docs ·Nguồn
Bạn có thể làm gì với nó
- Xuất bản tài liệu API tương tác cho một API công khai.
- Tạo SDK đã được định kiểu cho nhiều ngôn ngữ lập trình từ thông số kỹ thuật OpenAPI.
- Cung cấp cho các tác nhân AI tài liệu API phong phú ngữ cảnh thông qua máy chủ MCP.
Kiểm tra an toàn
Không thấy dấu hiệu rủi ro trong các file đã quét.
Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.
Trích từ README
Every developer. Every agent.
Cortex turns API specifications and Markdown into typed SDKs, interactive documentation, and an MCP server from one project configuration.
OpenAPI · AsyncAPI · GraphQL · gRPC · OpenRPC · Markdown
Documentation · Live demo · Website · Changelog
Cortex combines OpenAPI, AsyncAPI, GraphQL, Protocol Buffer, OpenRPC, and Markdown sources. Developers get interactive documentation, applications get typed SDKs, and AI agents get an MCP server with project context.
If Cortex helps your team, star this repository to support its development.
Try Cortex in 60 seconds
Start a local demo:
mkdir petstore
cd petstore
npm install --global @cortex-docs/cli
cortex init petstore
cortex docs serve
Open http://localhost:3012. Press Ctrl+C to stop the server.
We love open source
Keep your Markdown in Git. Add cortex.config.yml to the default branch of your public GitHub repository, then run:
npx -y @cortex-docs/cli deploy https://github.com/OWNER/REPO
npx -y @cortex-docs/cli mcp-serve https://github.com/OWNER/REPO
The first command publishes a free documentation site at PROJECT.cortexdocs.dev. The second connects AI clients to current documentation through local MCP.
Deploy requires repository write access. MCP works with public read access and checks for changes before each request.
See the open source hosting guide for configuration, custom domains, automatic updates, and limits.
Features
- Generate SDKs for TypeScript, Python, Go, Java, Kotlin, Ruby, PHP, C#, Rust, C++, and C.
- Combine multiple specification files in one generated SDK.
- Generate HTTP, WebSocket, GraphQL, gRPC, and JSON-RPC clients.
- Build static HTML documentation with interactive API reference pages.
- Generate an MCP server with typed tools, embedded specifications, SDK guides, and project documentation for AI agents.
- Add Markdown pages, SDK guides, and all API specifications to the MCP server.
- Customize generated output with sparse Eta template overrides.
- Publish generated packages and MCP servers to language registries and GitHub repositories.
Unlimited specs. Multiple ways to use it.
Generate interactive docs for exploration, typed SDKs for integration, and MCP servers for AI agents.
| Task | Split toolchain | Cortex Docs |
|---|---|---|
| Configuration | Configure SDK, documentation, and MCP generators | Declare all API sources in one project configuration |
| Generation | Coordinate separate commands and output directories | Generate all configured outputs with one command |
| Customization | Maintain templates for each generator | Override only the required Eta templates |
| Publishing | Maintain a release process for each package | Review one publish plan for registries and GitHub |
| Developer interface | Keep guides separate from API references | Combine Markdown, API references, and SDK guides |
| Agent interface | Maintain MCP servers and context separately | Generate MCP servers with specifications, SDK guides, and project documentation |
Requirements
- Node.js 20 or later
- npm 10 or later
Some generated SDKs require the normal compiler or package manager for their target language.
Configuration
cortex init creates cortex.config.yml. Relative paths start from the directory that contains this file.
project: my-api
title: My API Docs
logo: ./assets/logo.svg
theme: system
primaryColor: '#ffffff'
custom_head_html: |-
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="/assets/custom.css">
sources:
- title: REST API
type: openapi-spec
spec: ./specs/openapi.yaml
intro: ./docs/rest.md
languages:
- language: typescript
package_name: '@my-org/my-api'
- language: python
package_name: my-api
- title: Realtime API
type: asyncapi-spec
spec: ./specs/asyncapi.yaml
languages:
- language: typescript
package_name: '@my-org/my-api'
- title: GraphQL API
type: graphql-spec
spec: ./specs/schema.graphql
endpoint: https://api.example.com/graphql
languages:
- language: typescript
package_name: '@my-org/my-api'
output:
base_dir: ./generated
docs:
- section: Get started
sources:
- title: Quickstart
document: ./docs/quickstart.md
mcp:
package_name: '@my-org/my-api-mcp'
primaryColor sets the documentation accent color as a six-digit hex value.
custom_head_html adds trusted HTML to every documentation page. This field supports metadata, stylesheets, and analytics scripts.
Store local head resources in the project assets directory. Cortex serves these files from /assets/*.
Cortex does not sanitize this value. Add only HTML that you trust.
Add ?appearance=dark or ?appearance=light to any documentation URL to select its initial appearance. The parameter takes priority over the project theme and the visitor's stored preference.
For example, /docs/quickstart?appearance=dark opens the quickstart in dark mode. The theme button can change the appearance after the page loads.
Sources that use the same language and package_name are merged into one SDK. Cortex rejects duplicate operation and type names that would make a merge ambiguous.
See th
