mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-20 00:53:24 +02:00
[WIP] Refactor everything server to be more modular and use recommended APIs.
* Updated architecture.md * Refactor / renamed uris from test://X/resource/Y to demo://resource/X/Y
This commit is contained in:
@@ -13,13 +13,13 @@ import {
|
||||
* - Both blob and text resources:
|
||||
* - have content that is dynamically generated, including a timestamp
|
||||
* - have different template URIs
|
||||
* - Blob: "test://dynamic/resource/blob/{index}"
|
||||
* - Text: "test://dynamic/resource/text/{index}"
|
||||
* - Blob: "demo://resource/dynamic/blob/{index}"
|
||||
* - Text: "demo://resource/dynamic/text/{index}"
|
||||
*
|
||||
* @param server
|
||||
*/
|
||||
export const registerDynamicResources = (server: McpServer) => {
|
||||
const uriBase: string = "test://dynamic/resource";
|
||||
const uriBase: string = "demo://resource/dynamic";
|
||||
const textUriBase: string = `${uriBase}/text`;
|
||||
const blobUriBase: string = `${uriBase}/blob`;
|
||||
const textUriTemplate: string = `${textUriBase}/{index}`;
|
||||
|
||||
@@ -10,7 +10,7 @@ const __dirname = dirname(__filename);
|
||||
* Register static resources for each file in the docs folder.
|
||||
*
|
||||
* - Each file in src/everything/docs is exposed as an individual static resource
|
||||
* - URIs follow the pattern: "test://static/docs/<filename>"
|
||||
* - URIs follow the pattern: "demo://static/docs/<filename>"
|
||||
* - Markdown files are served as text/markdown; others as text/plain
|
||||
*
|
||||
* @param server
|
||||
@@ -35,10 +35,10 @@ export const registerStaticResources = (server: McpServer) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const uri = `test://static/docs/${encodeURIComponent(name)}`;
|
||||
const uri = `demo://resource/static/document/${encodeURIComponent(name)}`;
|
||||
const mimeType = getMimeType(name);
|
||||
const displayName = `Docs: ${name}`;
|
||||
const description = `Static documentation file exposed from /docs: ${name}`;
|
||||
const description = `Static document file exposed from /docs: ${name}`;
|
||||
|
||||
server.registerResource(
|
||||
displayName,
|
||||
|
||||
Reference in New Issue
Block a user