Open
Conversation
Agentlang apps can now act as MCP servers, allowing LLM clients to discover and invoke tools/resources over Streamable HTTP transport. - Extract shared API handlers (handlers.ts) from http.ts for reuse by both HTTP and MCP layers (evaluateEvent, queryEntity, createEntity, updateEntity, deleteEntity, verifyAuth, normalizedResult) - Add MCP server module (mcp.ts) with tool registration from public events, resource registration from entities, per-session transport management, and JSON Schema conversion from RecordSchema - Add MCP config section to ConfigSchema (enabled, path, name, version) - Add setMcpEndpointsUpdater for dynamic tool/resource updates - Wire authentication through MCP transport via req.auth -> extra.authInfo with per-tool and per-resource auth checks using shared verifyAuth
- Add resource templates (ListResourceTemplates handler) so clients can
fetch individual entities by ID via {scheme}://{module}/{entity}/{id}
- Extend ReadResource to parse template URIs and query single entities
- Replace hardcoded agentlang:// scheme with configurable uriScheme
(defaults to app name)
- Add TTL-based stale session cleanup with configurable sessionTtl
(default 30 min), skipped in stateless mode
- Declare listChanged capability for tools and resources
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.
Summary
verifyAuth.evaluateEvent,queryEntity,createEntity,updateEntity,deleteEntity,normalizedResult,verifyAuth) fromhttp.tsintohandlers.tsfor reuse by both the HTTP and MCP layers.instructions,stateless,enableJsonResponse,uriScheme, andsessionTtlconfiguration. Resource templates let clients fetch individual entities by ID via{scheme}://{module}/{entity}/{id}.listChangedcapability for tools and resources.Test plan
test/runtime/mcpserver.test.ts) covering tool invocation, resource reads, resource templates, auth, and session management