MCP Perl SDK
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Model Context Protocol support for Perl and the
Mojolicious real-time web framework.
Features
Please be aware that this module is still in development and will be changing rapidly. Additionally the MCP
specification is getting regular updates which we will implement. Breaking changes are very likely. The protocol
revision currently implemented is 2026-07-28.
* Tool calling, prompts and resources
* Streamable HTTP and Stdio transports
* Stateless protocol, with no handshake and no session to keep alive
* Routing header validation, so gateways and servers can never disagree about what was called
* JSON Schema 2020-12 validation of tool arguments
* Progress and log notifications on the response stream of the request they belong to
* Cancellation as a first-class signal, so long-running tools can stop early
* Multi-round tool requests with integrity-protected request state
* Cache hints for discovery, list and read results
* Notifications for list changes (tools, prompts, resources)
* OAuth scopes for tools, prompts and resources
* Scalable with pre-forking web server and async tools using promises
* HTTP client for testing
* Can be embedded in Mojolicious web apps
Not supported yet: pagination, resource templates, completion, tasks, MCP Apps, and resource subscriptions. The
roots, sampling and logging client features are deprecated in this revision and are not implemented. New OAuth
clients should use client ID metadata documents, since dynamic client registration is deprecated as well.
Installation
All you need is Perl 5.20 or newer. Just install from CPAN.
$ cpanm -n MCP
We recommend the use of a Perlbrew environment.
Then follow the tutorial, which builds a real server one feature at a
time.
Streamable HTTP Transport
Use the to_action method to add an MCP endpoint to any Mojolicious application.
Authentication can be added by the web application, just like for any other route. OAuth scopes can be enforced per
tool, prompt and resource.
Notifications
Notifications that belong to a request, such as progress reports, are delivered on the response stream of that very
request, which is upgraded from a plain JSON response to SSE whenever there is something to deliver. No extra
configuration is required, and it works under a pre-forking web server.
Notifications that do not belong to a request, such as list_changed, need a long-lived stream, which clients open