Repository navigation
Update GenHTTP to 11.2, and serve MCP with its module - #125
Merged
Merged
Conversation
The MCP endpoint is GenHTTP's MCP module: the tools are methods of McpTools marked [Tool], described by [Summary], with typed parameters whose fixed limits are attributes the module advertises and checks. The hand-written protocol (McpHandler, McpProtocol, the JSON catalogue) is gone; a refusal of the platform is answered as an error in a sentence. The admin token's concern now describes itself in the OpenAPI document (the adminToken security scheme). Lambdas may use the MCP module, and the documentation attributes are imported for them; demo-crud offers its tasks as tools and describes its API, demo-registration reads its session WithCookie. The guide, README and CLAUDE.md say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates GenHTTP to 11.2 and moves the platform onto what 11.2 brings rather than keeping its own versions beside it.
The MCP endpoint is GenHTTP's MCP module
/mcpwas a hand-written JSON-RPC server (McpHandler,McpProtocol, a 400-line catalogue of JSON schemas and a dispatch switch inMcpTools). It is nowGenHTTP.Modules.Mcp:McpEndpointbuilds it withDependentTools.Create(), the server's identity, the instructions (unchanged) andMcpTools, taken from the container per call.McpToolsmarked[Tool], described by[Summary], their typed parameters the arguments. The names, titles, hints, descriptions and answers are the same as before; each declaration forwards to the implementation that was there.[MaxLength]on a feature's name, a showcase entry and a license's author,[Range]on the rows and lines read,[AllowedValues]on a kind of data and a log level, and an enum for the editor view. An argument that does not fit is refused before the tool runs rather than read leniently: a limit above its maximum is no longer clamped, and a kind of data or a view has to be spelled as the schema says. File encodings are still checked by the rule the API uses (LambdaSource.Validate), and the log level still takeswarninganddebug.LambdaException) is answered as an error that says why in a sentence (Refusing), and so is an argument that does not fit. A failed deployment or merge is still an error carrying its diagnostics as structured content. The build agent's runner (builder.mjs) now takes the sentence of such an error as the step's problem, for the platform's own tools only.LAMBDA_MCP_ORIGINSkeeps working as it is configured: a host stands for its HTTPS origin, and an entry with a scheme is taken as the origin it names. The module compares whole origins, port included, where the old code compared hosts only. An entry the module could not read would keep the server from starting, so it is left out with a warning instead.Program), so the log keeps one line per operation in the platform's words; a tool that crashes is still logged as an error.platform_guideundershowcase, and the demo ids are inlist_demos. The fixed numbers are written out, as the API description does (a test holds the license list toSourceLicenses).OpenAPI: the admin token describes itself
11.2's API key concern declares its security scheme and its 401 and 403 answers. The admin routes no longer carry a hand-written header and refusals:
AdminAuthenticationnames the schemeadminToken, and Scalar asks for the token once. A test checks that the panel's operations require it and that no other operation names a scheme.Lambdas can offer tools to agents and describe their API
GenHTTP.Api.Content.Documentation([Summary],[Remarks],[Tag],[Response]) joins the implicit imports, in the export too. I checked by reflection that neither brings a type name that clashes with one already imported.demo-crudshows both: its routes and its input are described with[Summary]/[Remarks], andTools.csoffers the same tasks to an agent atmcp(list_tasks,add_task,complete_task,remove_task), over the same store and validation as the API. Its docs, test table and smoke script say so.demo-registrationreads its session with 11.2'sWithCookieinstead of an extractor of its own.platform_guidehastoolsForAgentsanddescribingAnApi, and the README and CLAUDE.md say the same. CLAUDE.md also records the decision behind this PR: use what the framework offers as it is meant to be used.Breaking, in the framework
11.2 moved the documentation attributes from
GenHTTP.Api.Content.ServicestoGenHTTP.Api.Content.Documentation. That namespace only existed in 11.1, and the owner accepted the break: a lambda that imports the old namespace no longer compiles. Since the new namespace is now imported implicitly, such a lambda only needs thatusingline removed.Tests
DescriptionTests(a lambda serving MCP tools; a lambda describing its API in its own words),AnAgentKeepsTheSameTasksWithToolsOfItsOwn,OnlyABrowserOnAHostTheOperatorNamedMayUseIt, the admin security scheme, the license list.main(11.1) as well, a full run here ends in request timeouts and a crashed test host, so CI is the judge of the whole.Flagged for GenHTTP (not worked around beyond what the platform needs)
ProviderExceptionas a tool error and treats anything else as a crash, logged as an error with its stack trace.ProviderExceptionis sealed, so a domain exception such asLambdaExceptioncannot become one: every tool has to catch it (Refusing). Something like the webservices'IErrorMapperfor tools would remove that.[AllowedValues("a", "b")] string? x = nullrefuses a call that leavesxout, becausenullis checked against the list (MethodToolInvoker.InvokeAsync:argument.Validator?.Validate(value, …)runs afterReadreturned the default)."type": "string": the schema is made from the parameter's type alone). Together with 2., listingnullgives"type": "string", "enum": ["a", "b", null], a schema that contradicts itself. The tools here avoid both: the log level has a default value instead ofnull.IEnumerable<T>parameters would be injected rather than read (GenHTTP.Modules.DependencyInjection, found by reading the source, not reproduced).DependencyInjector.SupportsasksIServiceProviderIsService.IsService, which Microsoft's container answers with yes for every closedIEnumerable<T>. So a tool or webservice parameterIEnumerable<string> tagswould be handed an empty sequence from the container instead of the client's value.McpToolstakesList<T>, and is not affected.🤖 Generated with Claude Code