[WIP] Refactor everything server to be more modular and use recommended APIs.

* Updated architecture.md

* Refactor/renamed resources/dynamic.ts to resources/template.ts
  - refactor/renamed registerDynamicResources to registerResourceTemplates
    - this highlights the more salient fact that we are demonstrating registration of resource templates in this example.
  - exposed the ability to dynamically create the text resources from elsewhere (namely the resource-prompt example

* Added prompts/resource.ts
  - in registerEmbeddedResourcePrompt()
    - register a prompt that takes a resourceId and returns the prompt with the corresponding dynamically created resource embedded
This commit is contained in:
cliffhall
2025-12-06 12:50:09 -05:00
parent 743529180e
commit 0aeb8a794d
5 changed files with 115 additions and 62 deletions

View File

@@ -2,6 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { registerSimplePrompt } from "./simple.js";
import { registerComplexPrompt } from "./complex.js";
import { registerPromptWithCompletions } from "./completions.js";
import { registerEmbeddedResourcePrompt } from "./resource.js"
/**
* Register the prompts with the MCP server.
@@ -11,4 +12,5 @@ export const registerPrompts = (server: McpServer) => {
registerSimplePrompt(server);
registerComplexPrompt(server);
registerPromptWithCompletions(server);
registerEmbeddedResourcePrompt(server);
};