MCP Resources
In addition to invokable tools, the MCP server can expose resources (static or generated data identified by a URI) and prompts (reusable prompt templates).
Listing resources
Section titled “Listing resources”import { McpClient } from "@divinci-ai/mcp";
const client = new McpClient({ serverUrl: "https://mcp.divinci.app",});
await client.connect();
const resources = await client.listResources();for (const resource of resources) { console.log(`${resource.uri} — ${resource.name}`);}Reading a resource
Section titled “Reading a resource”const { contents } = await client.readResource("divinci://workspace/ws_abc123/runbook.md");
for (const part of contents) { if (part.text) { console.log(part.text); }}Resource shape
Section titled “Resource shape”| Field | Type | Description |
|---|---|---|
uri | string | Unique resource URI |
name | string | Human-readable name |
description | string? | Optional description |
mimeType | string? | Optional MIME type |
Prompts
Section titled “Prompts”Prompts are reusable templates the server publishes. List and fetch them with listPrompts() and getPrompt():
const prompts = await client.listPrompts();
const filled = await client.getPrompt("summarize_thread", { thread_id: "thr_abc123", style: "executive",});
for (const message of filled.messages) { console.log(message.role, message.content);}Reacting to changes
Section titled “Reacting to changes”The server pushes a notifications/resources/list_changed event when its resource catalog changes. Subscribe via the onResourcesChanged event to refresh your local list automatically.