forked from modelcontextprotocol/typescript-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharktypeExample.ts
More file actions
28 lines (24 loc) · 726 Bytes
/
arktypeExample.ts
File metadata and controls
28 lines (24 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env node
/**
* Minimal MCP server using ArkType for schema validation.
* ArkType implements the Standard Schema spec with built-in JSON Schema conversion.
*/
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
import { type } from 'arktype';
const server = new McpServer({
name: 'arktype-example',
version: '1.0.0'
});
// Register a tool with ArkType schema
server.registerTool(
'greet',
{
description: 'Generate a greeting',
inputSchema: type({ name: 'string' })
},
async ({ name }) => ({
content: [{ type: 'text', text: `Hello, ${name}!` }]
})
);
const transport = new StdioServerTransport();
await server.connect(transport);