@mcpc-tech/core 0.2.2 → 0.2.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
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# @mcpc/core
|
|
2
|
+
|
|
3
|
+
**Build agentic MCP servers by composing existing MCP tools.**
|
|
4
|
+
|
|
5
|
+
The core SDK for creating agentic Model Context Protocol (MCP) servers. Compose
|
|
6
|
+
existing MCP tools into powerful AI agents with simple descriptions and tool
|
|
7
|
+
references.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# npm (from npm registry)
|
|
13
|
+
npm install @mcpc-tech/core
|
|
14
|
+
|
|
15
|
+
# npm (from jsr)
|
|
16
|
+
npx jsr add @mcpc/core
|
|
17
|
+
|
|
18
|
+
# deno
|
|
19
|
+
deno add jsr:@mcpc/core
|
|
20
|
+
|
|
21
|
+
# pnpm (from npm registry)
|
|
22
|
+
pnpm add @mcpc-tech/core
|
|
23
|
+
|
|
24
|
+
# pnpm (from jsr)
|
|
25
|
+
pnpm add jsr:@mcpc/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { mcpc } from "@mcpc/core";
|
|
32
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
33
|
+
|
|
34
|
+
// Create an agentic MCP server
|
|
35
|
+
const server = await mcpc(
|
|
36
|
+
[
|
|
37
|
+
{ name: "my-agent", version: "1.0.0" },
|
|
38
|
+
{ capabilities: { tools: {}, sampling: {} } },
|
|
39
|
+
],
|
|
40
|
+
[{
|
|
41
|
+
name: "my-agent",
|
|
42
|
+
description: `
|
|
43
|
+
I am a coding assistant that can read files and run terminal commands.
|
|
44
|
+
|
|
45
|
+
Available tools:
|
|
46
|
+
<tool name="desktop-commander.read_file"/>
|
|
47
|
+
<tool name="desktop-commander.execute_command"/>
|
|
48
|
+
`,
|
|
49
|
+
deps: {
|
|
50
|
+
mcpServers: {
|
|
51
|
+
"desktop-commander": {
|
|
52
|
+
command: "npx",
|
|
53
|
+
args: ["-y", "@wonderwhy-er/desktop-commander@latest"],
|
|
54
|
+
transportType: "stdio",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
options: { mode: "agentic" },
|
|
59
|
+
}],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Connect to stdio transport
|
|
63
|
+
await server.connect(new StdioServerTransport());
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Key Concepts
|
|
67
|
+
|
|
68
|
+
### Tool References
|
|
69
|
+
|
|
70
|
+
Reference tools in your agent description using XML-like syntax:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
description: `
|
|
74
|
+
Available tools:
|
|
75
|
+
<tool name="server.tool"/> // Basic reference
|
|
76
|
+
<tool name="server.__ALL__"/> // All tools from server
|
|
77
|
+
<tool name="tool" maxResultLength="2000"/> // Limit result size
|
|
78
|
+
<tool name="tool" hide/> // Hide from public interface
|
|
79
|
+
<tool name="tool" global/> // Expose at global scope
|
|
80
|
+
`;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### MCP Server Dependencies
|
|
84
|
+
|
|
85
|
+
Support all MCP transport types:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
deps: {
|
|
89
|
+
mcpServers: {
|
|
90
|
+
"stdio-server": {
|
|
91
|
+
command: "npx",
|
|
92
|
+
args: ["-y", "some-mcp-server"],
|
|
93
|
+
transportType: "stdio"
|
|
94
|
+
},
|
|
95
|
+
"http-server": {
|
|
96
|
+
transportType: "streamable-http",
|
|
97
|
+
url: "https://api.example.com/mcp/",
|
|
98
|
+
headers: { "Authorization": "Bearer ${TOKEN}" }
|
|
99
|
+
},
|
|
100
|
+
"sse-server": {
|
|
101
|
+
transportType: "sse",
|
|
102
|
+
url: "https://api.example.com/sse/"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Execution Modes
|
|
109
|
+
|
|
110
|
+
- **`agentic`** (default): Fully autonomous agent without structured workflow
|
|
111
|
+
- **`agentic_workflow`**: Structured workflow with predefined or
|
|
112
|
+
runtime-generated steps
|
|
113
|
+
|
|
114
|
+
### Plugins
|
|
115
|
+
|
|
116
|
+
Extend functionality with plugins:
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { createLargeResultPlugin } from "@mcpc/core/plugins";
|
|
120
|
+
|
|
121
|
+
{
|
|
122
|
+
plugins: [
|
|
123
|
+
createLargeResultPlugin({ maxSize: 8000 }),
|
|
124
|
+
"./plugins/custom.ts?param=value",
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## API Reference
|
|
130
|
+
|
|
131
|
+
### `mcpc(serverConf, composeConf?, setupCallback?)`
|
|
132
|
+
|
|
133
|
+
Main entry point for creating agentic MCP servers.
|
|
134
|
+
|
|
135
|
+
**Parameters:**
|
|
136
|
+
|
|
137
|
+
- `serverConf` - Server metadata and capabilities
|
|
138
|
+
- `composeConf` - Array of agent composition definitions (optional)
|
|
139
|
+
- `setupCallback` - Callback for custom setup before composition (optional)
|
|
140
|
+
|
|
141
|
+
**Returns:** `Promise<ComposableMCPServer>`
|
|
142
|
+
|
|
143
|
+
See [full documentation](../../docs/README.md) for detailed usage.
|
|
144
|
+
|
|
145
|
+
## Examples
|
|
146
|
+
|
|
147
|
+
Find complete examples in the [`examples/`](./examples/) directory:
|
|
148
|
+
|
|
149
|
+
- `01-basic-composition.ts` - Basic agent composition
|
|
150
|
+
- `02-plugin-usage.ts` - Using plugins
|
|
151
|
+
- `03-agentic-workflow.ts` - Workflow mode with steps
|
|
152
|
+
- `04-sampling-mode.ts` - Autonomous execution with sampling
|
|
153
|
+
|
|
154
|
+
## Documentation
|
|
155
|
+
|
|
156
|
+
- [Full Documentation](../../docs/README.md)
|
|
157
|
+
- [Plugin System Guide](../../docs/plugins.md)
|
|
158
|
+
- [Creating Your First Agentic MCP](../../docs/quickstart/create-your-first-agentic-mcp.md)
|
|
159
|
+
- [FAQ](../../docs/faq.md)
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT
|
package/package.json
CHANGED
|
@@ -64,5 +64,67 @@ export interface ComposibleMCPConfig {
|
|
|
64
64
|
[key: string]: ComposeDefinition[];
|
|
65
65
|
}
|
|
66
66
|
export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDefinition[];
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Create and configure an agentic MCP server with composed tools.
|
|
69
|
+
*
|
|
70
|
+
* This is the main entry point for building agentic MCP servers. It allows you to:
|
|
71
|
+
* - Reuse existing MCP tools from the community by selecting and composing them
|
|
72
|
+
* - Create powerful agentic tools by describing them in natural language with tool references
|
|
73
|
+
* - Fine-tune tool descriptions and parameters to fit your specific use cases
|
|
74
|
+
* - Build multi-agent systems where each agent is itself an MCP tool
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const server = await mcpc(
|
|
79
|
+
* [
|
|
80
|
+
* { name: "coding-agent", version: "1.0.0" },
|
|
81
|
+
* { capabilities: { tools: {}, sampling: {} } }
|
|
82
|
+
* ],
|
|
83
|
+
* [{
|
|
84
|
+
* name: "codex-fork",
|
|
85
|
+
* description: `A coding agent that can read files, search code, and create PRs.
|
|
86
|
+
* Available tools:
|
|
87
|
+
* <tool name="desktop-commander.read_file"/>
|
|
88
|
+
* <tool name="github.create_pull_request"/>`,
|
|
89
|
+
* deps: {
|
|
90
|
+
* mcpServers: {
|
|
91
|
+
* "desktop-commander": {
|
|
92
|
+
* command: "npx",
|
|
93
|
+
* args: ["-y", "@wonderwhy-er/desktop-commander@latest"],
|
|
94
|
+
* transportType: "stdio"
|
|
95
|
+
* },
|
|
96
|
+
* "github": {
|
|
97
|
+
* transportType: "streamable-http",
|
|
98
|
+
* url: "https://api.githubcopilot.com/mcp/",
|
|
99
|
+
* headers: { "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` }
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* },
|
|
103
|
+
* plugins: [createLargeResultPlugin({ maxSize: 8000 })],
|
|
104
|
+
* options: { mode: "agentic", sampling: true }
|
|
105
|
+
* }]
|
|
106
|
+
* );
|
|
107
|
+
* await server.connect(new StdioServerTransport());
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param serverConf - MCP server initialization parameters including name, version, and capabilities
|
|
111
|
+
* - First element: Server metadata (name, version)
|
|
112
|
+
* - Second element: Server capabilities (tools, sampling, etc.)
|
|
113
|
+
*
|
|
114
|
+
* @param composeConf - Array of agent composition definitions. Each definition includes:
|
|
115
|
+
* - name: Agent name (set to null for composition-only mode)
|
|
116
|
+
* - description: Agent purpose with XML-like tool references (e.g., `<tool name="server.tool"/>`)
|
|
117
|
+
* - deps: MCP server dependencies with transport configurations (stdio, sse, streamable-http)
|
|
118
|
+
* - plugins: Global plugins to transform/extend tool behavior (objects or file paths)
|
|
119
|
+
* - options: Execution mode settings (agentic, agentic_workflow, sampling)
|
|
120
|
+
*
|
|
121
|
+
* @param setupCallback - Optional callback to register custom tools or perform additional setup
|
|
122
|
+
* before composition. Useful for adding internal tools or custom configurations.
|
|
123
|
+
*
|
|
124
|
+
* @returns A configured MCP Server instance ready to connect to a transport
|
|
125
|
+
*
|
|
126
|
+
* @see {@link ComposeDefinition} for detailed composition configuration options
|
|
127
|
+
* @see {@link ToolPlugin} for plugin development guide
|
|
128
|
+
* @see https://github.com/mcpc-tech/mcpc/tree/main/docs for complete documentation
|
|
129
|
+
*/ export declare function mcpc(serverConf: ConstructorParameters<typeof ComposableMCPServer>, composeConf?: ComposeDefinition[], setupCallback?: (server: ComposableMCPServer) => void | Promise<void>): Promise<InstanceType<typeof ComposableMCPServer>>;
|
|
68
130
|
//# sourceMappingURL=set-up-mcp-compose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-up-mcp-compose.d.ts","sources":["../../src/set-up-mcp-compose.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAEhD,cAAc,QAAQ,2BAA2B;AACjD,cAAc,UAAU,6BAA6B;AACrD,cAAc,cAAc,qBAAqB;AACjD,cAAc,UAAU,4BAA4B;AACpD,cAAc,UAAU,qBAAqB;AAE7C,iBAAiB;EACf;;;GAGC,GACD,MAAM,MAAM,GAAG,IAAI;EACnB;;GAEC,GACD,cAAc,MAAM;EACpB,OAAO;EAEP;;;;;;;;;;;GAWC,GACD,WAAW,aAAa,MAAM;EAE9B;IACE;;;;;KAKC,GACD,OAAO,YAAY;IAEnB;;;;KAIC,GACD,WAAW,OAAO,GAAG;IAErB;;;;;KAKC,GACD,QAAQ;IAER;;;;;KAKC,GACD,oBAAoB,MAAM;IAE1B;;;;;KAKC,GACD;;;KAGC,GACD,OAAO,MAAM;;;AAMjB,iBAAiB;GACd,KAAK,MAAM,GAAG;;AAGjB,OAAO,iBAAS,iBACd,OAAO,mBAAmB,GACzB;AAuBH,OAAO,iBAAe,KACpB,YAAY,6BAA6B,oBAAoB,EAC7D,cAAc,mBAAmB,EACjC,iBAAiB,QAAQ,wBAAwB,IAAI,GAAG,QAAQ,IAAI,CAAC,GACpE,QAAQ,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"set-up-mcp-compose.d.ts","sources":["../../src/set-up-mcp-compose.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAEhD,cAAc,QAAQ,2BAA2B;AACjD,cAAc,UAAU,6BAA6B;AACrD,cAAc,cAAc,qBAAqB;AACjD,cAAc,UAAU,4BAA4B;AACpD,cAAc,UAAU,qBAAqB;AAE7C,iBAAiB;EACf;;;GAGC,GACD,MAAM,MAAM,GAAG,IAAI;EACnB;;GAEC,GACD,cAAc,MAAM;EACpB,OAAO;EAEP;;;;;;;;;;;GAWC,GACD,WAAW,aAAa,MAAM;EAE9B;IACE;;;;;KAKC,GACD,OAAO,YAAY;IAEnB;;;;KAIC,GACD,WAAW,OAAO,GAAG;IAErB;;;;;KAKC,GACD,QAAQ;IAER;;;;;KAKC,GACD,oBAAoB,MAAM;IAE1B;;;;;KAKC,GACD;;;KAGC,GACD,OAAO,MAAM;;;AAMjB,iBAAiB;GACd,KAAK,MAAM,GAAG;;AAGjB,OAAO,iBAAS,iBACd,OAAO,mBAAmB,GACzB;AAuBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DC,GACD,OAAO,iBAAe,KACpB,YAAY,6BAA6B,oBAAoB,EAC7D,cAAc,mBAAmB,EACjC,iBAAiB,QAAQ,wBAAwB,IAAI,GAAG,QAAQ,IAAI,CAAC,GACpE,QAAQ,oBAAoB"}
|