fixing prettier
This commit is contained in:
parent
51fafb485c
commit
5e69116f47
5 changed files with 7830 additions and 7525 deletions
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
"name": "vengabus",
|
||||
"scripts": {
|
||||
"dev": "wrangler dev",
|
||||
"deploy": "wrangler deploy --minify",
|
||||
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
||||
},
|
||||
"dependencies": {
|
||||
"hono": "^4.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hono/mcp": "^0.1.0",
|
||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||
"wrangler": "^4.21.0",
|
||||
"zod": "^3.25.67"
|
||||
}
|
||||
}
|
||||
"name": "vengabus",
|
||||
"scripts": {
|
||||
"dev": "wrangler dev",
|
||||
"deploy": "wrangler deploy --minify",
|
||||
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
|
||||
},
|
||||
"dependencies": {
|
||||
"hono": "^4.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hono/mcp": "^0.1.0",
|
||||
"@modelcontextprotocol/sdk": "^1.13.1",
|
||||
"wrangler": "^4.21.0",
|
||||
"zod": "^3.25.67"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import { StreamableHTTPTransport } from '@hono/mcp'
|
||||
import { Hono } from 'hono'
|
||||
import { z } from "zod";
|
||||
import { z } from 'zod'
|
||||
import { cors } from 'hono/cors'
|
||||
|
||||
const app = new Hono()
|
||||
|
||||
app.use('/*', cors({
|
||||
origin: '*',
|
||||
allowHeaders: ['content-type','mcp-session-id','mcp-protocol-version'],
|
||||
exposeHeaders: ['mcp-session-id'],
|
||||
}))
|
||||
app.use(
|
||||
'/*',
|
||||
cors({
|
||||
origin: '*',
|
||||
allowHeaders: ['content-type', 'mcp-session-id', 'mcp-protocol-version'],
|
||||
exposeHeaders: ['mcp-session-id'],
|
||||
}),
|
||||
)
|
||||
|
||||
// Your MCP server implementation
|
||||
const mcpServer = new McpServer({
|
||||
|
|
@ -18,33 +21,38 @@ const mcpServer = new McpServer({
|
|||
version: '1.0.0',
|
||||
})
|
||||
|
||||
mcpServer.registerTool("add",
|
||||
mcpServer.registerTool(
|
||||
'add',
|
||||
{
|
||||
title: "Addition Tool",
|
||||
description: "Add two numbers",
|
||||
inputSchema: { a: z.number(), b: z.number() }
|
||||
title: 'Addition Tool',
|
||||
description: 'Add two numbers',
|
||||
inputSchema: { a: z.number(), b: z.number() },
|
||||
},
|
||||
async ({ a, b }) => ({
|
||||
content: [{ type: "text", text: String(a + b) }]
|
||||
})
|
||||
);
|
||||
content: [{ type: 'text', text: String(a + b) }],
|
||||
}),
|
||||
)
|
||||
|
||||
mcpServer.registerTool("get_vengabus_times",
|
||||
mcpServer.registerTool(
|
||||
'get_vengabus_times',
|
||||
{
|
||||
title: "Vengabus Schedule Checker",
|
||||
description: "This checks to see when the next Vengabus is, or whether there is one for the user's current location. Please display all the information to the user in a tabulated form.",
|
||||
inputSchema: { }
|
||||
title: 'Vengabus Schedule Checker',
|
||||
description:
|
||||
"This checks to see when the next Vengabus is, or whether there is one for the user's current location. Please display all the information to the user in a tabulated form.",
|
||||
inputSchema: {},
|
||||
},
|
||||
async () => {
|
||||
await scheduler.wait(100)
|
||||
return ({
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: `Next Vengabus: imminent. Current user's route: New York to San Francisco. Route name: "Intercity Disco".`
|
||||
}]
|
||||
})
|
||||
}
|
||||
);
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Next Vengabus: imminent. Current user's route: New York to San Francisco. Route name: "Intercity Disco".`,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
app.post('/mcp', async (c) => {
|
||||
const transport = new StreamableHTTPTransport()
|
||||
|
|
@ -52,4 +60,4 @@ app.post('/mcp', async (c) => {
|
|||
return transport.handleRequest(c)
|
||||
})
|
||||
|
||||
export default app
|
||||
export default app
|
||||
|
|
|
|||
|
|
@ -5,13 +5,9 @@
|
|||
"moduleResolution": "Bundler",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"lib": [
|
||||
"ESNext"
|
||||
],
|
||||
"lib": ["ESNext"],
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "hono/jsx",
|
||||
"types": [
|
||||
"./worker-configuration.d.ts"
|
||||
]
|
||||
},
|
||||
}
|
||||
"types": ["./worker-configuration.d.ts"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12356
examples/example-server/vengabus/worker-configuration.d.ts
vendored
12356
examples/example-server/vengabus/worker-configuration.d.ts
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -3,49 +3,49 @@
|
|||
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
||||
*/
|
||||
{
|
||||
"$schema": "node_modules/wrangler/config-schema.json",
|
||||
"name": "vengabus",
|
||||
"main": "src/index.ts",
|
||||
"compatibility_date": "2025-06-20",
|
||||
"assets": {
|
||||
"binding": "ASSETS",
|
||||
"directory": "./public"
|
||||
},
|
||||
"observability": {
|
||||
"enabled": true
|
||||
}
|
||||
/**
|
||||
* Smart Placement
|
||||
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
||||
*/
|
||||
// "placement": { "mode": "smart" },
|
||||
"$schema": "node_modules/wrangler/config-schema.json",
|
||||
"name": "vengabus",
|
||||
"main": "src/index.ts",
|
||||
"compatibility_date": "2025-06-20",
|
||||
"assets": {
|
||||
"binding": "ASSETS",
|
||||
"directory": "./public"
|
||||
},
|
||||
"observability": {
|
||||
"enabled": true
|
||||
}
|
||||
/**
|
||||
* Smart Placement
|
||||
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
||||
*/
|
||||
// "placement": { "mode": "smart" },
|
||||
|
||||
/**
|
||||
* Bindings
|
||||
* Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
|
||||
* databases, object storage, AI inference, real-time communication and more.
|
||||
* https://developers.cloudflare.com/workers/runtime-apis/bindings/
|
||||
*/
|
||||
/**
|
||||
* Bindings
|
||||
* Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
|
||||
* databases, object storage, AI inference, real-time communication and more.
|
||||
* https://developers.cloudflare.com/workers/runtime-apis/bindings/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Environment Variables
|
||||
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
||||
*/
|
||||
// "vars": { "MY_VARIABLE": "production_value" },
|
||||
/**
|
||||
* Note: Use secrets to store sensitive data.
|
||||
* https://developers.cloudflare.com/workers/configuration/secrets/
|
||||
*/
|
||||
/**
|
||||
* Environment Variables
|
||||
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
||||
*/
|
||||
// "vars": { "MY_VARIABLE": "production_value" },
|
||||
/**
|
||||
* Note: Use secrets to store sensitive data.
|
||||
* https://developers.cloudflare.com/workers/configuration/secrets/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Static Assets
|
||||
* https://developers.cloudflare.com/workers/static-assets/binding/
|
||||
*/
|
||||
// "assets": { "directory": "./public/", "binding": "ASSETS" },
|
||||
/**
|
||||
* Static Assets
|
||||
* https://developers.cloudflare.com/workers/static-assets/binding/
|
||||
*/
|
||||
// "assets": { "directory": "./public/", "binding": "ASSETS" },
|
||||
|
||||
/**
|
||||
* Service Bindings (communicate between multiple Workers)
|
||||
* https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
||||
*/
|
||||
// "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
|
||||
/**
|
||||
* Service Bindings (communicate between multiple Workers)
|
||||
* https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
||||
*/
|
||||
// "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue