Created
June 20, 2025 22:45
-
-
Save zackify/c7d2c8c63f527be57f24194ebc48b12f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; | |
| import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; | |
| const server = new McpServer( | |
| { | |
| name: "My MCP", | |
| version: "1.0.0", | |
| }, | |
| { | |
| capabilities: { | |
| sampling: {}, | |
| }, | |
| } | |
| ); | |
| const transport = new StdioServerTransport(); | |
| server.connect(transport); | |
| const test = await server.server.createMessage({ | |
| messages: [ | |
| { | |
| role: "user", | |
| content: { | |
| type: "text", | |
| text: "What is the capital of France?", | |
| }, | |
| }, | |
| ], | |
| modelPreferences: { | |
| hints: [ | |
| { | |
| name: "claude-3-sonnet", | |
| }, | |
| ], | |
| intelligencePriority: 0.8, | |
| speedPriority: 0.5, | |
| }, | |
| systemPrompt: "You are a helpful assistant.", | |
| maxTokens: 100, | |
| }); | |
| const result = await server.server.elicitInput({ | |
| message: `No tables available. Would you like to check alternative dates?`, | |
| requestedSchema: { | |
| type: "object", | |
| properties: { | |
| checkAlternatives: { | |
| type: "boolean", | |
| title: "Check alternative dates", | |
| description: "Would you like me to check other dates?", | |
| }, | |
| flexibleDates: { | |
| type: "string", | |
| title: "Date flexibility", | |
| description: "How flexible are your dates?", | |
| enum: ["next_day", "same_week", "next_week"], | |
| enumNames: ["Next day", "Same week", "Next week"], | |
| }, | |
| }, | |
| required: ["checkAlternatives"], | |
| }, | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment