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
29 lines (25 loc) · 779 Bytes
/
Copy patharktypeExample.ts
File metadata and controls
29 lines (25 loc) · 779 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
29
#!/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 } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
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);