MCPcopy Index your code
hub / github.com/deepnote/deepnote / createServer

Function createServer

packages/mcp/src/server.ts:33–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31const workspaceRoot = process.env.DEEPNOTE_WORKSPACE || process.cwd()
32
33export function createServer(): Server {
34 const server = new Server(
35 {
36 name: 'deepnote',
37 version: '0.1.0',
38 },
39 {
40 capabilities: {
41 tools: {},
42 prompts: {},
43 resources: {},
44 },
45 instructions: serverInstructions,
46 }
47 )
48
49 // Register tool listing handler
50 server.setRequestHandler(ListToolsRequestSchema, async () => {
51 return { tools: allTools }
52 })
53
54 // Register prompt listing handler
55 server.setRequestHandler(ListPromptsRequestSchema, async () => {
56 return { prompts }
57 })
58
59 // Register prompt get handler
60 server.setRequestHandler(GetPromptRequestSchema, async request => {
61 const { name, arguments: args } = request.params
62 try {
63 if (!isPromptName(name)) {
64 throw new Error(`Unknown prompt: ${name}`)
65 }
66 return getPrompt(name, args)
67 } catch (error) {
68 const message = error instanceof Error ? error.message : String(error)
69 throw new Error(message)
70 }
71 })
72
73 // Register resource listing handler
74 server.setRequestHandler(ListResourcesRequestSchema, async () => {
75 const resources = await listResources(workspaceRoot)
76 return { resources }
77 })
78
79 // Register resource reading handler
80 server.setRequestHandler(ReadResourceRequestSchema, async request => {
81 const { uri } = request.params
82 const contents = await readResource(uri, workspaceRoot)
83 return { contents }
84 })
85
86 // Register tool execution handler
87 server.setRequestHandler(CallToolRequestSchema, async request => {
88 const { name, arguments: args } = request.params
89
90 try {

Callers 1

startServerFunction · 0.85

Calls 9

isPromptNameFunction · 0.90
getPromptFunction · 0.90
listResourcesFunction · 0.90
readResourceFunction · 0.90
handleReadingToolFunction · 0.90
handleWritingToolFunction · 0.90
handleConversionToolFunction · 0.90
handleExecutionToolFunction · 0.90
handleSnapshotToolFunction · 0.90

Tested by

no test coverage detected