chore: fix prettier formatting and update example server dependencies

- Fix formatting issues in cf-agents, hono-mcp, and test files
- Update dependencies in example servers

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jem 2025-07-02 17:59:24 -07:00
commit e0743c35e4
3 changed files with 329 additions and 32 deletions

View file

@ -10,7 +10,7 @@
},
"devDependencies": {
"@hono/mcp": "^0.1.0",
"@modelcontextprotocol/sdk": "^1.13.1",
"@modelcontextprotocol/sdk": "^1.13.3",
"wrangler": "^4.21.0",
"zod": "^3.25.67"
}

View file

@ -14,10 +14,10 @@ importers:
devDependencies:
'@hono/mcp':
specifier: ^0.1.0
version: 0.1.0(@modelcontextprotocol/sdk@1.13.1)(hono@4.8.2)
version: 0.1.0(@modelcontextprotocol/sdk@1.13.3)(hono@4.8.2)
'@modelcontextprotocol/sdk':
specifier: ^1.13.1
version: 1.13.1
specifier: ^1.13.3
version: 1.13.3
wrangler:
specifier: ^4.21.0
version: 4.21.0
@ -352,8 +352,8 @@ packages:
'@jridgewell/trace-mapping@0.3.9':
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
'@modelcontextprotocol/sdk@1.13.1':
resolution: {integrity: sha512-8q6+9aF0yA39/qWT/uaIj6zTpC+Qu07DnN/lb9mjoquCJsAh6l3HyYqc9O3t2j7GilseOQOQimLg7W3By6jqvg==}
'@modelcontextprotocol/sdk@1.13.3':
resolution: {integrity: sha512-bGwA78F/U5G2jrnsdRkPY3IwIwZeWUEfb5o764b79lb0rJmMT76TLwKhdNZOWakOQtedYefwIR4emisEMvInKA==}
engines: {node: '>=18'}
accepts@2.0.0:
@ -972,9 +972,9 @@ snapshots:
'@fastify/busboy@2.1.1': {}
'@hono/mcp@0.1.0(@modelcontextprotocol/sdk@1.13.1)(hono@4.8.2)':
'@hono/mcp@0.1.0(@modelcontextprotocol/sdk@1.13.3)(hono@4.8.2)':
dependencies:
'@modelcontextprotocol/sdk': 1.13.1
'@modelcontextprotocol/sdk': 1.13.3
hono: 4.8.2
'@img/sharp-darwin-arm64@0.33.5':
@ -1061,13 +1061,14 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@modelcontextprotocol/sdk@1.13.1':
'@modelcontextprotocol/sdk@1.13.3':
dependencies:
ajv: 6.12.6
content-type: 1.0.5
cors: 2.8.5
cross-spawn: 7.0.6
eventsource: 3.0.7
eventsource-parser: 3.0.2
express: 5.1.0
express-rate-limit: 7.5.1(express@5.1.0)
pkce-challenge: 5.0.0

View file

@ -1,4 +1,4 @@
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import { McpServer, type ReadResourceTemplateCallback, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
import { StreamableHTTPTransport } from '@hono/mcp'
import { Hono } from 'hono'
import { z } from 'zod'
@ -42,7 +42,8 @@ mcpServer.registerTool(
inputSchema: {},
},
async () => {
await scheduler.wait(100 + Math.random() * 100)
// Simulate some async work
await new Promise((resolve) => setTimeout(resolve, 100 + Math.random() * 100))
return {
content: [
{
@ -54,6 +55,139 @@ mcpServer.registerTool(
},
)
// Register sample resources
mcpServer.registerResource(
'config',
'config://app',
{
title: 'Application Configuration',
description: 'Current application configuration settings',
mimeType: 'application/json',
},
async (uri: URL) => ({
contents: [
{
uri: uri.href,
mimeType: 'application/json',
text: JSON.stringify(
{
version: '1.0.0',
environment: 'test',
features: {
vengabus: true,
calculator: true,
},
},
null,
2,
),
},
],
}),
)
mcpServer.registerResource(
'readme',
'file://readme.md',
{
title: 'README',
description: 'Server documentation',
mimeType: 'text/markdown',
},
async (uri: URL) => ({
contents: [
{
uri: uri.href,
mimeType: 'text/markdown',
text: '# Test MCP Server\n\nThis is a test server for the use-mcp integration tests.\n\n## Features\n- Addition tool\n- Vengabus schedule checker\n- Sample resources\n- Sample prompts',
},
],
}),
)
// Register a resource template
mcpServer.registerResource(
'stats',
new ResourceTemplate('data://stats/{type}', { list: undefined }),
{
title: 'Statistics Data',
description: 'Get statistics for different types',
mimeType: 'application/json',
},
// @ts-expect-error - type is missing in the callback
async (uri: URL, { type }) => ({
contents: [
{
uri: uri.href,
mimeType: 'application/json',
text: JSON.stringify(
{
type: type,
count: Math.floor(Math.random() * 100),
lastUpdated: new Date().toISOString(),
},
null,
2,
),
},
],
}),
)
// Register sample prompts
mcpServer.registerPrompt(
'greeting',
{
title: 'Generate Greeting',
description: 'Generate a greeting message',
argsSchema: {
name: z.string().describe('Name of the person to greet'),
style: z.string().optional().describe('Style of greeting (formal/casual)'),
},
},
({ name, style }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Generate a ${style || 'casual'} greeting for ${name}`,
},
},
{
role: 'assistant',
content: {
type: 'text',
text: style === 'formal' ? `Good day, ${name}. I hope this message finds you well.` : `Hey ${name}! How's it going?`,
},
},
],
}),
)
mcpServer.registerPrompt(
'code_review',
{
title: 'Code Review Template',
description: 'Template for code review requests',
argsSchema: {
language: z.string().describe('Programming language'),
focus: z.string().optional().describe('What to focus on (performance/security/style)'),
},
},
({ language, focus }) => ({
messages: [
{
role: 'user',
content: {
type: 'text',
text: `Please review the following ${language} code${focus ? ` with a focus on ${focus}` : ''}:`,
},
},
],
}),
)
app.post('/mcp', async (c) => {
const transport = new StreamableHTTPTransport()
await mcpServer.connect(transport)