Skip to content

Commit b4aaf35

Browse files
committed
Remove over complex logic from SDK
1 parent d6b5432 commit b4aaf35

File tree

5 files changed

+68
-1853
lines changed

5 files changed

+68
-1853
lines changed

README.md

Lines changed: 3 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ This SDK provides high-level and dynamic access to those tools, making it easy t
99
## Features
1010

1111
- Discover and list available `mcpd` hosted MCP servers
12-
- Retrieve tool definitions and schemas for one or all servers
12+
- Retrieve tool, prompt, and resource definitions from individual servers
1313
- Dynamically invoke any tool using a clean, attribute-based syntax
14-
- Unified AI framework integration - works directly with LangChain JS and Vercel AI SDK
14+
- Unified AI framework integration - works directly with LangChain JS and Vercel AI SDK via `getAgentTools()`
1515
- Generate self-contained, framework-compatible tool functions without conversion layers
1616
- Multiple output formats (`'array'`, `'object'`, `'map'`) for different framework needs
1717
- Full TypeScript support with comprehensive type definitions and overloads
1818
- Minimal dependencies (`lru-cache` for caching, `zod` for schema validation)
1919
- Works in both Node.js and browser environments
20+
- Clean API wrapper over mcpd HTTP endpoints - no opinionated aggregation logic
2021

2122
## Installation
2223

@@ -122,31 +123,6 @@ const servers = await client.listServers();
122123
// Returns: ['time', 'fetch', 'git']
123124
```
124125

125-
#### `client.getTools(options?)`
126-
127-
Returns tool schemas from all (or specific) servers with names transformed to `serverName__toolName` format.
128-
129-
**IMPORTANT**: Tool names are automatically transformed to prevent naming clashes and identify server origin. Original tool name `get_current_time` on server `time` becomes `time__get_current_time`.
130-
131-
This is useful for:
132-
133-
- MCP servers aggregating and re-exposing tools from multiple upstream servers
134-
- Tool inspection and discovery across all servers
135-
- Custom tooling that needs raw MCP tool schemas with unique names
136-
137-
```typescript
138-
// Get all tools from all servers
139-
const allTools = await client.getTools();
140-
// Returns: [
141-
// { name: "time__get_current_time", description: "...", inputSchema: {...} },
142-
// { name: "fetch__fetch_url", description: "...", inputSchema: {...} },
143-
// { name: "git__commit", description: "...", inputSchema: {...} }
144-
// ]
145-
146-
// Get tools from specific servers only
147-
const someTools = await client.getTools({ servers: ["time", "fetch"] });
148-
```
149-
150126
#### `client.servers.<server>.getTools()`
151127

152128
Returns tool schemas for a specific server.
@@ -228,30 +204,6 @@ if (await client.servers[serverName].hasTool("get_current_time")) {
228204
}
229205
```
230206

231-
#### `client.getPrompts(options?)`
232-
233-
Returns prompt schemas from all (or specific) servers with names transformed to `serverName__promptName` format.
234-
235-
**IMPORTANT**: Prompt names are automatically transformed to prevent naming clashes and identify server origin. Original prompt name `create_pr` on server `github` becomes `github__create_pr`.
236-
237-
This is useful for:
238-
239-
- Aggregating prompts from multiple servers
240-
- Prompt inspection and discovery across all servers
241-
- Custom tooling that needs raw MCP prompt schemas with unique names
242-
243-
```typescript
244-
// Get all prompts from all servers
245-
const allPrompts = await client.getPrompts();
246-
// Returns: [
247-
// { name: "github__create_pr", description: "...", arguments: [...] },
248-
// { name: "slack__post_message", description: "...", arguments: [...] }
249-
// ]
250-
251-
// Get prompts from specific servers only
252-
const somePrompts = await client.getPrompts({ servers: ["github"] });
253-
```
254-
255207
#### `client.generatePrompt(namespacedName, args?)`
256208

257209
Generate a prompt by its namespaced name (in `serverName__promptName` format).
@@ -330,83 +282,6 @@ if (await client.servers[serverName].hasPrompt("create_pr")) {
330282
}
331283
```
332284

333-
#### `client.getResources(options?)`
334-
335-
Returns resource schemas from all (or specific) servers with names transformed to `serverName__resourceName` format.
336-
337-
**IMPORTANT**: Resource names are automatically transformed to prevent naming clashes and identify server origin. Original resource name `readme` on server `github` becomes `github__readme`.
338-
339-
This is useful for:
340-
341-
- Aggregating resources from multiple servers
342-
- Resource inspection and discovery across all servers
343-
- Custom tooling that needs raw MCP resource schemas with unique names
344-
345-
```typescript
346-
// Get all resources from all servers
347-
const allResources = await client.getResources();
348-
// Returns: [
349-
// { name: "github__readme", uri: "file:///repo/README.md", _serverName: "github", ... },
350-
// { name: "slack__channels", uri: "slack://channels", _serverName: "slack", ... }
351-
// ]
352-
353-
// Get resources from specific servers only
354-
const someResources = await client.getResources({ servers: ["github"] });
355-
```
356-
357-
#### `client.getResourceTemplates(options?)`
358-
359-
Returns resource template schemas from all (or specific) servers with names transformed to `serverName__templateName` format.
360-
361-
**IMPORTANT**: Template names are automatically transformed to prevent naming clashes and identify server origin. Original template name `file` on server `github` becomes `github__file`.
362-
363-
This is useful for:
364-
365-
- Aggregating resource templates from multiple servers
366-
- Template inspection and discovery across all servers
367-
- Understanding what parameterized resources are available
368-
369-
```typescript
370-
// Get all resource templates from all servers
371-
const allTemplates = await client.getResourceTemplates();
372-
// Returns: [
373-
// { name: "github__file", uriTemplate: "file:///{path}", _serverName: "github", ... }
374-
// ]
375-
376-
// Get templates from specific servers only
377-
const someTemplates = await client.getResourceTemplates({
378-
servers: ["github"],
379-
});
380-
```
381-
382-
#### `client.readResource(namespacedName)`
383-
384-
Read resource content by its namespaced name (in `serverName__resourceName` format).
385-
386-
The SDK automatically populates an internal cache on first use. For better performance when reading multiple resources, you can optionally pre-populate the cache by calling `getResources()` first.
387-
388-
```typescript
389-
// Read content by namespaced name - cache populated automatically if needed
390-
const contents = await client.readResource("github__readme");
391-
// Returns: [{ uri: "...", text: "# README\n...", mimeType: "text/markdown" }]
392-
393-
for (const content of contents) {
394-
if (content.text) {
395-
console.log("Text content:", content.text);
396-
} else if (content.blob) {
397-
console.log(
398-
"Binary content (base64):",
399-
content.blob.substring(0, 50) + "...",
400-
);
401-
}
402-
}
403-
404-
// For better performance when reading multiple resources, pre-populate the cache
405-
await client.getResources();
406-
const readme = await client.readResource("github__readme");
407-
const changelog = await client.readResource("github__changelog");
408-
```
409-
410285
#### `client.servers.<server>.getResources()`
411286

412287
Returns resource schemas for a specific server.

0 commit comments

Comments
 (0)