@mcpjam/sdk 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -9
- package/dist/chunk-6XEFXCUG.js +836 -0
- package/dist/chunk-6XEFXCUG.js.map +1 -0
- package/dist/index.cjs +583 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -464
- package/dist/index.js.map +1 -1
- package/dist/mcp-client-manager/index.cjs +96 -8
- package/dist/mcp-client-manager/index.cjs.map +1 -1
- package/dist/mcp-client-manager/index.d.cts +124 -171
- package/dist/mcp-client-manager/index.d.ts +124 -171
- package/dist/mcp-client-manager/index.js +2 -733
- package/dist/mcp-client-manager/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/chunk-PZ5AY32C.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,27 +1,124 @@
|
|
|
1
1
|
# @mcpjam/sdk
|
|
2
2
|
|
|
3
|
-
The MCPJam SDK
|
|
3
|
+
The official MCPJam SDK provides utilities for building, testing, and developing MCP clients and servers. Built on top of the [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk), it offers high-level abstractions and tools to accelerate MCP development.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@mcpjam/sdk)
|
|
6
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
+
|
|
8
|
+
# Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
8
|
-
npm install @mcpjam/sdk
|
|
11
|
+
npm install @mcpjam/sdk
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
# Key Features
|
|
15
|
+
|
|
16
|
+
## MCPClientManager
|
|
17
|
+
|
|
18
|
+
The primary utility in the SDK is `MCPClientManager`, a powerful client manager for connecting to and interacting with MCP servers:
|
|
19
|
+
|
|
20
|
+
- **Multi-server support** - Manage multiple MCP server connections simultaneously
|
|
21
|
+
- **All transports** - STDIO, HTTP/SSE, and Streamable HTTP support
|
|
22
|
+
- **Lifecycle management** - Automatic connection handling and cleanup
|
|
23
|
+
- **Tools, resources, prompts** - Full MCP protocol support including elicitation
|
|
24
|
+
- **Agent framework integration** - Built-in adapters for Vercel AI SDK and other popular libraries
|
|
25
|
+
- **OAuth & authentication** - Bearer token and custom header support
|
|
26
|
+
|
|
27
|
+
### Use Cases
|
|
28
|
+
|
|
29
|
+
The SDK is designed for:
|
|
30
|
+
|
|
31
|
+
- **Building AI agents** - Connect agents to MCP servers for tool access
|
|
32
|
+
- **Creating MCP clients** - Build custom clients with full protocol support
|
|
33
|
+
- **Testing MCP servers** - Write unit tests and E2E tests for your servers
|
|
34
|
+
- **LLM applications** - Add MCP support to chat applications and AI workflows
|
|
35
|
+
|
|
36
|
+
### Quick Start
|
|
12
37
|
|
|
13
38
|
```ts
|
|
14
39
|
import { MCPClientManager } from "@mcpjam/sdk";
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
|
|
41
|
+
// Initialize with server configurations
|
|
42
|
+
const manager = new MCPClientManager({
|
|
43
|
+
// STDIO server
|
|
44
|
+
filesystem: {
|
|
45
|
+
command: "npx",
|
|
46
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
|
|
47
|
+
},
|
|
48
|
+
// HTTP/SSE server with authentication
|
|
49
|
+
asana: {
|
|
50
|
+
url: new URL("https://mcp.asana.com/sse"),
|
|
51
|
+
requestInit: {
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: "Bearer YOUR_TOKEN",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// List and execute tools
|
|
60
|
+
const tools = await manager.getTools(["filesystem"]);
|
|
61
|
+
const result = await manager.executeTool("filesystem", "read_file", {
|
|
62
|
+
path: "/tmp/example.txt",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Integrate with Vercel AI SDK
|
|
66
|
+
import { generateText } from "ai";
|
|
67
|
+
import { openai } from "@ai-sdk/openai";
|
|
68
|
+
|
|
69
|
+
const response = await generateText({
|
|
70
|
+
model: openai("gpt-4o-mini"),
|
|
71
|
+
tools: manager.getToolsForAiSdk(),
|
|
72
|
+
messages: [{ role: "user", content: "List files in /tmp" }],
|
|
73
|
+
});
|
|
17
74
|
```
|
|
18
75
|
|
|
19
|
-
##
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
For detailed documentation on `MCPClientManager` including:
|
|
79
|
+
|
|
80
|
+
- Connection configuration (STDIO, HTTP/SSE)
|
|
81
|
+
- Tool execution and resource management
|
|
82
|
+
- Elicitation handling
|
|
83
|
+
- Agent framework integrations
|
|
84
|
+
- API reference
|
|
85
|
+
|
|
86
|
+
See the [MCPClientManager README](./mcp-client-manager/README.md).
|
|
20
87
|
|
|
21
|
-
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
### Building Locally
|
|
91
|
+
|
|
92
|
+
Build the entire SDK workspace:
|
|
22
93
|
|
|
23
94
|
```bash
|
|
24
95
|
npm run build
|
|
25
96
|
```
|
|
26
97
|
|
|
27
|
-
This
|
|
98
|
+
This compiles all sub-packages including `mcp-client-manager` and generates distributable bundles.
|
|
99
|
+
|
|
100
|
+
### Development Mode
|
|
101
|
+
|
|
102
|
+
Watch for changes and rebuild automatically:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm run dev
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Resources
|
|
109
|
+
|
|
110
|
+
- **💬 Discord**: [Join the MCPJam Community](https://discord.gg/JEnDtz8X6z)
|
|
111
|
+
- **📖 MCP Protocol**: [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
112
|
+
- **🔧 GitHub**: [MCPJam Inspector Repository](https://github.com/MCPJam/inspector)
|
|
113
|
+
|
|
114
|
+
## Contributing
|
|
115
|
+
|
|
116
|
+
We welcome contributions! The SDK is part of the [MCPJam Inspector monorepo](https://github.com/MCPJam/inspector). Please see the main [CONTRIBUTING.md](../CONTRIBUTING.md) for guidelines.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
Apache License 2.0 - see the [LICENSE](../LICENSE) file for details.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
**Built with ❤️ for the MCP community** • [🌐 MCPJam.com](https://mcpjam.com)
|