mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 00:54:03 +02:00
[WIP] Refactor everything server to be more modular and use recommended APIs.
* Adding dynamic resources
* Add server/index.js
- import registerResources from resources/index.js
- in createServer()
- call registerResources, passing server
* Add resources/dynamic.ts
- in addDynamicResources()
- define formatGmtTimestamp to create a time stamp to include in the resource text or encoded blob
- define parseIndex to ensure the index variable of the URI is a number
* Add resources/index.ts
- import addDynamicResources
- export registerResources function
- in registerResources()
- call addDynamicResources
* In package.json
- update the start commands to launch each of the transports properly
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
"build": "tsc && shx cp instructions.md dist/ && shx chmod +x dist/*.js",
|
||||
"prepare": "npm run build",
|
||||
"watch": "tsc --watch",
|
||||
"start": "node dist/index.js",
|
||||
"start:sse": "node dist/sse.js",
|
||||
"start:streamableHttp": "node dist/streamableHttp.js"
|
||||
"start:stdio": "node dist/index.js stdio",
|
||||
"start:sse": "node dist/index.js sse",
|
||||
"start:streamableHttp": "node dist/index.js streamableHttp"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.24.0",
|
||||
|
||||
Reference in New Issue
Block a user