Choosing Between FastMCP and EdgeFastMCP
| Use Case | Class | Import |
|---|---|---|
| Node.js, Express, Bun | FastMCP | import { FastMCP } from "fastmcp" |
| Cloudflare Workers, Deno Deploy | EdgeFastMCP | import { EdgeFastMCP } from "fastmcp/edge" |
Feature Comparison
| Feature | FastMCP | EdgeFastMCP |
|---|---|---|
| Runtime | Node.js | Edge (V8 isolates) |
| Start method | server.start({ port }) | export default server |
| Transport | stdio, httpStream, SSE | HTTP Streamable only |
| Sessions | Stateful or stateless | Stateless only |
| File system | Yes | No |
| OAuth/Authentication | Built-in authenticate option | Use Hono middleware (built-in planned) |
| Custom routes | server.getApp() | server.getApp() |
Built-in authentication for EdgeFastMCP is planned for a future release. Both FastMCP and EdgeFastMCP use Hono internally, so there’s no technical barrier—EdgeFastMCP was simply written before OAuth was added to FastMCP.In the meantime, use Hono middleware:
Quick Start
1. Install Dependencies
2. Create Your Server
src/index.ts
3. Configure Wrangler
wrangler.toml
4. Deploy
Edge Runtime Differences
When running on edge runtimes:Stateless by Default
Each request is handled independently. Use external storage (KV, D1, R2) for persistence.
Complete Example
Here’s a complete example from the FastMCP repository:src/examples/edge-cloudflare-worker.ts
Custom Routes on Edge
You can access the underlying Hono app to add custom HTTP routes:Using Cloudflare Bindings
Access Cloudflare Workers bindings (KV, D1, R2) in your tools:- KV Storage
- D1 Database
- R2 Storage
Local Development
Test your edge server locally with Wrangler:Deployment Best Practices
Monitor Performance
Use Cloudflare Analytics to monitor:
- Request rates
- CPU time
- Response times
- Error rates
Limitations
Next Steps
Custom Routes
Learn how to add custom HTTP routes to your edge server
Streaming
Implement streaming responses in your tools