-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs:(start): add start mcp example #4837
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
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit b305cbf
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build && tsc --noEmit", | ||
"start": "vite start" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vite start
wont work I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied from the start-counter
example but I haven't tried before. I did now and... yeah vite start
doesn't seem to work.
Should we replace all vite start
with node .output/server/index.mjs
in the examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it depends on the deployment target. by default, it's using node, so yes it would work. if someone changes to e.g. bun, the start command would need to be different ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it something related to this PR (adding the new mcp example) only or is it a global decision for all start
commands in all examples/docs?
I'd say as long as we explain in the docs how to run in all environments should be fine that we show one in the feature-related examples
export async function handleMcpRequest(request: Request, server: McpServer) { | ||
const body = await request.json() | ||
const event = getEvent() | ||
const res = event.node.res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will only work in node then.... how about other runtimes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Bun looks like it's working. After all it's the official mcp sdk having a hard dependency on that, I don't think we can be much more flexible until they open their implementation a bit more
A working example integrating the official
@modelcontextprotocol/sdk
to create a stateless http server on a start route.The server is exposed on
http://localhost:3000/api
and has a resource (tells the counter value, from the counter example) and a tool (sums two numbers).