Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.504] - 2026-06-19

### Added

- **MCP In-Process Invocation**: `InvocationMode::InProcess` / `Auto` on `McpConfig`. When a `McpServer` is created via `from_rustapi`, tool calls can execute directly through the `Router` + `LayerStack` + interceptors with no network hop. `RustApi::request_dispatcher()` and internal `RequestInvoker` / `RequestDispatcher`.
- Typical result: ~28 µs per call (in-process) vs ~1.3 ms (proxy via live localhost HTTP) for 1000 sequential calls — ~45-50× speedup.
- **`cargo rustapi mcp generate`**: Turn any OpenAPI 3.x spec (FastAPI, Express, Go, etc.) into a running MCP server. Supports `--spec`, `--url`, `--api`, `--target`, tag/path filtering, and `--stdio`.
- **MCP stdio transport**: `--stdio` flag for desktop AI clients (Claude Desktop, etc.).
- New cookbook recipes: In-Process Invocation, OpenAPI→MCP CLI, and stdio transport. Updated main MCP recipe and README.

### Changed

- OpenAPI deserialization in `rustapi-openapi` is now significantly more tolerant of real-world/partial specs (added `#[serde(default)]` on maps and optional fields) so the CLI works reliably with external APIs.
- `Router` now derives `Clone` (aids in-process sharing patterns).
- `McpConfig` gained `invocation_mode(...)`.

### Documentation

- Major updates to MCP coverage in README, cookbook, and plan documents (`in_process_mcp_invocation.md`, `openapi_to_mcp_cli.md`).

## [0.1.410] - 2026-03-09

### Added
Expand Down
28 changes: 15 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ members = [
]

[workspace.package]
version = "0.1.501"
version = "0.1.504"
edition = "2021"
authors = ["RustAPI Contributors, Tuntii"]
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -150,3 +150,4 @@ strip = false




13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Meta features: `core` (default), `protocol-all`, `extras-all`, `full`.

- **Crate consolidation (13 → 9):** `rustapi-testing`, `rustapi-jobs`, `rustapi-view`, and `rustapi-toon` merged into `rustapi-core` and `rustapi-extras` as feature-gated modules.
- **Embedded Isometric System Dashboard:** Live `/dashboard` with bento-grid layout, execution-flow visualization, and time-travel replay browser.
- **Native MCP progress:** Cookbook recipe, `mcp_tools` runnable example, and end-to-end tests for tool discovery + real proxied invocation.
- **Native MCP (full featured):** In-process invocation (~28µs per call), `cargo rustapi mcp generate` for any OpenAPI spec, stdio transport, and improved cookbook coverage.
- Dual-stack runtime: simultaneous HTTP/1.1 (TCP) and HTTP/3 (QUIC/UDP)
- WebSocket permessage-deflate compression
- `rustapi-grpc` crate: optional Tonic/Prost-based gRPC alongside HTTP (`run_rustapi_and_grpc`)
Expand All @@ -266,11 +266,12 @@ Meta features: `core` (default), `protocol-all`, `extras-all`, `full`.
- Live architectural view of request routing across the **Ultra Fast**, **Fast**, and **Full** execution paths.
- Interactive endpoint visualization for topology inspection, route grouping, and runtime status awareness.
- Time-travel replay UI for browsing recorded HTTP traffic, selecting a historical request, and inspecting replay state directly from the dashboard.
- [~] Native MCP (Model Context Protocol) Orchestration
- Embedded MCP server that exposes RustAPI endpoints as discoverable tools for LLMs and external AI agents.
- Automatic capability discovery and direct tool-style invocation for compatible clients such as Claude and other multi-agent runtimes.
- Framework-level orchestration layer for agent-to-endpoint communication (core + examples + cookbook + e2e tests done: discovery + proxied invocation through full pipeline + sidecar runner + runnable `mcp_tools` example).
- Remaining polish: admin token enforcement in transport, optional zero-copy in-process invoker (current design uses correct localhost proxy), more client conformance tests.
- [x] Native MCP (Model Context Protocol) Orchestration
- Embedded MCP server + `rustapi mcp generate` CLI turns any OpenAPI 3.x spec into agent tools.
- In-process invocation path: ~28 µs per call (vs ~1.3 ms for localhost proxy with live server) for 1000 sequential calls.
- stdio transport for desktop clients (Claude Desktop etc.).
- Tag/path-prefix filtering, full pipeline respect (or zero-copy in-process when co-located).
- Cookbook recipes for native use, CLI generator, in-process mode, and stdio.


## Documentation
Expand Down
9 changes: 7 additions & 2 deletions crates/cargo-rustapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ notify = { version = "8.0", optional = true }
notify-debouncer-mini = { version = "0.7", optional = true }

# Async
tokio = { workspace = true, features = ["process", "fs", "macros", "rt-multi-thread", "time", "signal", "sync"] }
tokio = { workspace = true, features = ["process", "fs", "macros", "rt-multi-thread", "time", "signal", "sync", "io-std"] }

# Serialization
serde = { workspace = true }
Expand All @@ -40,6 +40,10 @@ toml = "1.1"
# HTTP client for fetching remote specs
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false, optional = true }

# MCP support (OpenAPI → MCP server generator)
rustapi-mcp = { workspace = true, optional = true }
rustapi-openapi = { workspace = true, optional = true }

# Utilities
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
Expand All @@ -51,7 +55,8 @@ assert_cmd = "2.2"
predicates = "3.1"

[features]
default = ["remote-spec", "replay"]
default = ["remote-spec", "replay", "mcp"]
native-watch = ["dep:notify", "dep:notify-debouncer-mini"]
remote-spec = ["dep:reqwest"]
replay = ["dep:reqwest"]
mcp = ["dep:rustapi-mcp", "dep:rustapi-openapi", "remote-spec"]
1 change: 1 addition & 0 deletions crates/cargo-rustapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cargo install cargo-rustapi
| `cargo rustapi new <name> --preset <preset>` | Start from opinionated `prod-api`, `ai-api`, or `realtime-api` feature bundles |
| `cargo rustapi generate resource <name>` | Scaffold a new API resource (Model + Handlers + Tests) |
| `cargo rustapi client --spec <path> --language <lang>` | Generate a client library (Rust, TS, Python) from OpenAPI spec |
| `cargo rustapi mcp generate --spec <file|url> --target <backend>` | Turn ANY OpenAPI spec into a live MCP server for AI agents (FastAPI, Go, etc.) |
| `cargo rustapi deploy <platform>` | Generate deployment configs for Docker, Fly.io, Railway, or Shuttle |
| `cargo rustapi migrate <action>` | Database migration commands (create, run, revert, status, reset) |
| `cargo rustapi replay <subcommand>` | Work with time-travel replay entries from a running RustAPI service |
Expand Down
21 changes: 21 additions & 0 deletions crates/cargo-rustapi/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use crate::commands::{
self, AddArgs, BenchArgs, ClientArgs, DeployArgs, DoctorArgs, GenerateArgs, MigrateArgs,
NewArgs, ObservabilityArgs, RunArgs, WatchArgs,
};

#[cfg(feature = "mcp")]
use crate::commands::McpGenerateArgs;
use clap::{Parser, Subcommand};

/// The official CLI tool for the RustAPI framework. Scaffold new projects, run development servers, and manage database migrations.
Expand Down Expand Up @@ -62,6 +65,11 @@ enum Commands {
/// Generate API client from OpenAPI spec
Client(ClientArgs),

/// MCP tools — turn any OpenAPI spec into an MCP server for agents
#[cfg(feature = "mcp")]
#[command(subcommand)]
Mcp(McpCommands),

/// Deploy to various platforms
#[command(subcommand)]
Deploy(DeployArgs),
Expand All @@ -87,9 +95,22 @@ impl Cli {
Commands::Migrate(args) => commands::migrate(args).await,
Commands::Docs { port } => commands::open_docs(port).await,
Commands::Client(args) => commands::client(args).await,
#[cfg(feature = "mcp")]
Commands::Mcp(McpCommands::Generate(args)) => commands::mcp_generate(args).await,
Commands::Deploy(args) => commands::deploy(args).await,
#[cfg(feature = "replay")]
Commands::Replay(args) => commands::replay(args).await,
}
}
}

#[cfg(feature = "mcp")]
#[derive(clap::Subcommand, Debug)]
enum McpCommands {
/// Generate a running MCP server from an OpenAPI specification.
///
/// Works with FastAPI, Express, Go, Spring, or any other API that
/// publishes an OpenAPI 3.x document. All tool calls are forwarded
/// (proxied) to the real backend.
Generate(McpGenerateArgs),
}
Loading
Loading