-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First Class MCP Agents and Tools #71
Comments
A couple of early pieces of feedback:
The
It does! You should try it!
I don’t quite get that in this RFC. Can you show a more complete example of the following? Specifically taking into account:
What’s in here right now isn’t really fleshed out and I would suggest prototyping something to test it out. Start narrow! |
I'll get to prototyping it for more real code examples @elithrar But it would be helpful, as a project, to align on the vision of how MCPs or even functionality should exist. For example, in the roadmap we have email, and we already have things like schedules baked into the agent. I would imagine those as MCPs / Tools themselves and my interests is most definitely helping create an OSS serverless tool catalog as things continue to move forward. Next steps for me would be:
|
Context
Agent SDK is leveraging AI SDK’s Tools to enable LLMs to do custom tasks or operations. The Model Context Protocol (MCPs) is becoming a standard for how LLMs can communicate with each other for the same use cases that tools enable LLMs to discover functionality that it can invoke. We should consider enabling Agents created with the Agent SDK to both:
Definition of a tool in MCP
Definition of an Tools using AI SDK
Standard Server Sent Events MCP Example
We already have a solution from cloudflare with Workers MCP which allows servers to serve API endpoints as standard MCP Servers via JSDdoc standard which makes it intuitive for users to not have to handle bootstrapping MCP Servers.
Problem
Agent SDK needs a way to bootstrap itself as an MCP Server and easily depend on existing MCP Servers as Tools to perform its desired functionality. This will enable Cloudflare Agents to participate in the growing MCP standard, decouple reusable Agent Tools that can be reused across multiple agents, help support multi-tenancy and the separation/security of state.
Coupling agents with mandatory tools, such as Email or Scheduling, may increase the complexity of each feature to consider a stateful component and multi-tenancy. Additionally, these features may not need to be used at all and we should consider how we want optional tools to be considered, configured and leveraged in the ecosystem of Cloudflare AI Agents. Cloudflare Agent developers should be able to easily configure what functionality is needed by registering and configuring MCPs as Tools. Contributors to this project should have a clear pathway on how to contribute custom functionality for the ecosytem.
Possible solutions
The following options are unbiased in their order of importance and represent potential solutions that may help solve the above problem.
MCP Server Bootstrapping
Leveraging the available tools array created from the server and setup a Stdio and/or SSE Transport service to accept incoming messages and their responses.
Assuming MCP typescript-sdk potentially can work on Cloudflare Workers, a standard service can iterate through the given tools of the Agent and register them as follows:
MCP Client Bootstrapping
Create a standard Tool that takes a live MCP Server SSE Endpoint for indexing and generating its available commands. MCP servers are providing three different types of potential endpoints to help understand how to use it:
Due to AI SDK that we're using today does not supporting Prompts and Resources, we can convert Prompts to help enrich descriptions for the Tools and Resources. The Resources can be applied as Tools in the AI SDK standard, and Tools will convert seamlessly since they share the same schema today.
Optimizing the description size is debatable to save costs and adhere to context windows.
Configuration Option A: Config File
Create a configuration file that gets parsed that includes a list of MCP servers
Example mcpconfig.json:
Configuration Option B: Environment Variables
To keep things simple and use existing wrangler and .env files, we could consider a comma separated array for a list of MCP servers to bootstrap.
Example .env file:
Configuration Option C: Statically Typed
You can consider statically registering MCP Servers in Typescript. This may make it harder to quickly update
Summary
Allowing MCP servers to enable the flexibility of potentially stateless agents and decoupling state for multi-tenancy. Users or folks who leverage Cloudflare Platform for Platforms can consider deploying individually configured and contextually bound agents per tenant which improves overall security and potentially even optimizes LLMs to perform better for their owner’s needs. D1, Vectorize, KV and other serverless cloud native primitives that Cloudflare provides us allows this solution to scale cost effectively versus having to consider optimizing tenants and states within single stores or instances.
Thoughts?
All is welcomed!
The text was updated successfully, but these errors were encountered: