Welcome to this example project demonstrating how to set up and deploy a Model Context Protocol (MCP) server and client using SvelteKit, running on Vercel.
This starter aims to provide a clear, minimal foundation for SvelteKit enthusiasts looking to integrate powerful AI tool-calling capabilities into their applications.
This project was born out of a personal interest in exploring MCP integration with SvelteKit. The recent release of the @vercel/mcp-adapter
by Vercel significantly lowered the barrier to entry, making this exploration much more approachable – a big thanks to the Vercel team for this!
One of the exciting aspects of this implementation is demonstrating that MCP can be successfully integrated with SvelteKit, even though much of the initial documentation and examples leaned towards Next.js. The adaptation for SvelteKit is quite minimal, showcasing the flexibility of the underlying technologies.
While this example utilizes Vercel's adapter and deployment platform for convenience, it's important to note that the core concepts rely on standard web technologies (HTTP, Server-Sent Events). This means that with some adjustments, similar setups should be achievable on other hosting platforms that support Node.js environments.
This starter aims to be a non-intimidating, minimal example to get you started.
@vercel/mcp-adapter
: Leveraging Vercel's package for simplified MCP server creation.Note: Client and Server don't have to be on the same project.
Follow these steps to get the project up and running on your local machine.
@vercel/mcp-adapter
for certain transports (like SSE) that manage state. Services like Upstash offer free tiers. As of @vercel/[email protected]
, the Redis URL is no longer needed when using streamableHTTP..env.example
file to .env
and fill in your keys:cp .env.example .env
Clone the repository and install the dependencies:
pnpm install
Start the development server:
pnpm run dev
Your application should now be running on http://localhost:5173
(or the next available port).
StreamableHTTPClientTransport
. The @vercel/mcp-adapter
also supports SSE."@modelcontextprotocol/sdk": "1.10.2"
due to a previous issue with tool arguments in later versions (see Issue #467). Always check for the latest stable versions and adapt as needed.This project is intended as a minimal starting point. There are several ways it could be improved or expanded:
Maintenance Status: This repository was created to share a working example. While I'll do my best to address critical issues if they arise, I may not be actively maintaining or developing it long-term.
Contributions are highly welcome! If you have improvements, bug fixes, or new features, please feel free to open an issue or submit a pull request.
@vercel/mcp-adapter
: GitHub Vercel monorepoHappy coding, and we hope this starter helps you build amazing AI-powered SvelteKit applications!