Repository navigation
Conversation
|
|
||
| `forge <spec> --target mcp --out <dir>` generates a Model Context Protocol (MCP) runtime (`mcp.ts` and `_/mcp.ts`) layered on top of the generated TypeScript SDK (`--target ts`). | ||
|
|
||
| Instead of emitting one MCP tool per OpenAPI operation or requiring the model to filter raw OpenAPI JSON in JavaScript, the server exposes the generated TypeScript SDK through two MCP tools (`search` and `execute`) and browsable MCP resources (`resources/list`, `resources/templates/list`, `resources/read`). |
There was a problem hiding this comment.
we will need both options here. Code mode native clients need direct tools, naive clients benefit from codemode tools.
|
|
||
| Large OpenAPI descriptions (thousands of operations and models) break standard MCP tool generation in two ways: | ||
|
|
||
| 1. **One tool per operation overflows context.** Emitting 3,000+ tool schemas produces megabytes of `tools/list` JSON, exceeding client tool limits and degrading tool selection accuracy. |
There was a problem hiding this comment.
not entirely true anymore with tool search and client codemode. This is a client/agent implementation detail now.
| Large OpenAPI descriptions (thousands of operations and models) break standard MCP tool generation in two ways: | ||
|
|
||
| 1. **One tool per operation overflows context.** Emitting 3,000+ tool schemas produces megabytes of `tools/list` JSON, exceeding client tool limits and degrading tool selection accuracy. | ||
| 2. **Raw OpenAPI `search` + `execute` is brittle.** Exposing `search` and `execute` over raw `spec.paths` forces the model to write custom JavaScript filters against deeply nested OpenAPI JSON and hand-craft `fetch(path, body)` calls without static type checking. A single `snake_case` vs `camelCase` mistake or nested field error causes a live HTTP `400`/`404` round-trip. |
There was a problem hiding this comment.
also maybe not true. I would love to validate that the models are better at using a generated sdk they have never seen before rather than a hierarchical open api spec which can be easily expressed in types (in training data)
| └── Valid ──► Calls Forge TS Transport | ||
| ``` | ||
|
|
||
| 1. **Resources (`forge://sdk`)** expose the SDK group tree (`resources/list`) and a URI template (`forge://sdk/{query}`) so MCP clients can browse groups, methods, and models directly. |
There was a problem hiding this comment.
This is a very weird use of resources. There is a draft for something called MCP groups which sounds like what you are looking for.
| ``` | ||
|
|
||
| 1. **Resources (`forge://sdk`)** expose the SDK group tree (`resources/list`) and a URI template (`forge://sdk/{query}`) so MCP clients can browse groups, methods, and models directly. | ||
| 2. **`search({ query? })`** inspects a 1-level `.d.ts` TypeScript declaration for any SDK group, method, or model, or searches across all SDK paths, HTTP routes, summaries, and descriptions. |
There was a problem hiding this comment.
how would this search work. IMO we should just get the model to write code. I made the original server this way after spending literally years evaling recommendation/search systems. I didnt want to do that here. Interested if you have a different opinion.
|
|
||
| 1. **Resources (`forge://sdk`)** expose the SDK group tree (`resources/list`) and a URI template (`forge://sdk/{query}`) so MCP clients can browse groups, methods, and models directly. | ||
| 2. **`search({ query? })`** inspects a 1-level `.d.ts` TypeScript declaration for any SDK group, method, or model, or searches across all SDK paths, HTTP routes, summaries, and descriptions. | ||
| 3. **`execute({ code, params? })`** runs JavaScript/TypeScript against the wrapped `client`. Returning an uninvoked namespace or method inspects its `.d.ts`; calling `await client.<group>.<method>(...)` validates arguments before making an HTTP request. |
There was a problem hiding this comment.
validation on the server is not that interesting imo. I played with this but it added latency when actually it is normally solved when the model just calls the api.
Adds
rfcs/mcp.mdspecifying the Progressive Type-Feedback MCP target (--target mcp) — exposing the generated TypeScript SDK viasearchandexecuteMCP tools,forge://sdkresources, and pre-flight compiler diagnostics with 1-level.d.tsdefinitions.