Skip to content

Instantly share code, notes, and snippets.

@zackify
Created June 20, 2025 22:45
Show Gist options
  • Select an option

  • Save zackify/c7d2c8c63f527be57f24194ebc48b12f to your computer and use it in GitHub Desktop.

Select an option

Save zackify/c7d2c8c63f527be57f24194ebc48b12f to your computer and use it in GitHub Desktop.
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