@mcphero/core 1.1.6 → 1.3.0
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/.turbo/turbo-build.log +17 -18
- package/.turbo/turbo-check.log +4 -9
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-prepack.log +4 -4
- package/README.md +89 -0
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DTS Build
|
|
17
|
-
DTS
|
|
18
|
-
DTS build/index.d.ts 2.50 KB
|
|
1
|
+
|
|
2
|
+
> @mcphero/core@1.2.0 build /Users/atomic/projects/ai/mcphero/packages/core
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v8.5.1
|
|
8
|
+
CLI Using tsup config: /Users/atomic/projects/ai/mcphero/packages/core/tsup.config.ts
|
|
9
|
+
CLI Target: node18
|
|
10
|
+
CLI Cleaning output folder
|
|
11
|
+
ESM Build start
|
|
12
|
+
ESM build/index.js 2.88 KB
|
|
13
|
+
ESM build/index.js.map 7.15 KB
|
|
14
|
+
ESM ⚡️ Build success in 7ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
DTS ⚡️ Build success in 638ms
|
|
17
|
+
DTS build/index.d.ts 2.50 KB
|
package/.turbo/turbo-check.log
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
> @mcphero/core@1.
|
|
2
|
+
> @mcphero/core@1.2.0 check /Users/atomic/projects/ai/mcphero/packages/core
|
|
3
3
|
> pnpm lint && pnpm typecheck
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @mcphero/core@1.
|
|
6
|
+
> @mcphero/core@1.2.0 lint /Users/atomic/projects/ai/mcphero/packages/core
|
|
7
7
|
> eslint
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
/Users/atomic/projects/ai/mcphero/packages/core
|
|
11
|
-
|
|
10
|
+
> @mcphero/core@1.2.0 typecheck /Users/atomic/projects/ai/mcphero/packages/core
|
|
11
|
+
> tsc --noEmit
|
|
12
12
|
|
|
13
|
-
✖ 1 problem (1 error, 0 warnings)
|
|
14
|
-
1 error and 0 warnings potentially fixable with the `--fix` option.
|
|
15
|
-
|
|
16
|
-
ELIFECYCLE Command failed with exit code 1.
|
|
17
|
-
ELIFECYCLE Command failed with exit code 1.
|
package/.turbo/turbo-lint.log
CHANGED
package/.turbo/turbo-prepack.log
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @mcphero/core@1.
|
|
3
|
+
> @mcphero/core@1.2.0 prepack /Users/atomic/projects/ai/mcphero/packages/core
|
|
4
4
|
> pnpm clean && pnpm build
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @mcphero/core@1.
|
|
7
|
+
> @mcphero/core@1.2.0 clean /Users/atomic/projects/ai/mcphero/packages/core
|
|
8
8
|
> rimraf build
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
> @mcphero/core@1.
|
|
11
|
+
> @mcphero/core@1.2.0 build /Users/atomic/projects/ai/mcphero/packages/core
|
|
12
12
|
> tsup
|
|
13
13
|
|
|
14
14
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
[32mESM[39m [1mbuild/index.js.map [22m[32m7.15 KB[39m
|
|
23
23
|
[32mESM[39m ⚡️ Build success in 6ms
|
|
24
24
|
DTS Build start
|
|
25
|
-
DTS ⚡️ Build success in
|
|
25
|
+
DTS ⚡️ Build success in 605ms
|
|
26
26
|
DTS build/index.d.ts 2.50 KB
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @mcphero/core
|
|
2
|
+
|
|
3
|
+
Core library for [MCPHero](https://github.com/atomicbi/mcphero) — the TypeScript toolkit for building MCP servers and CLI tools from a single set of Actions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @mcphero/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's Inside
|
|
12
|
+
|
|
13
|
+
This package provides the foundational building blocks that all MCPHero adapters depend on:
|
|
14
|
+
|
|
15
|
+
- **`mcphero()`** — Fluent builder to wire up adapters and actions
|
|
16
|
+
- **`createAction()`** — Define transport-agnostic actions with Zod input schemas
|
|
17
|
+
- **Adapter types** — `Adapter`, `AdapterGenerator`, `AdapterFactory` interfaces for building custom adapters
|
|
18
|
+
- **Context** — `MCPHeroContext` key-value store with `fork()` for per-adapter/per-request isolation
|
|
19
|
+
- **MCP utilities** — `toolResponse()`, `parseToolResponse()` for MCP response formatting
|
|
20
|
+
- **Sideload resources** — `createSideloadResource()` for binary resource handling
|
|
21
|
+
- **Zod utilities** — `unwrap()` to recursively unwrap Zod wrapper types
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { mcphero, createAction } from '@mcphero/core'
|
|
27
|
+
import z from 'zod'
|
|
28
|
+
|
|
29
|
+
const GreetAction = createAction({
|
|
30
|
+
name: 'greet',
|
|
31
|
+
description: 'Greet someone by name',
|
|
32
|
+
input: z.object({
|
|
33
|
+
name: z.string().describe('Name to greet')
|
|
34
|
+
}),
|
|
35
|
+
run: async ({ name }, context) => {
|
|
36
|
+
return { message: `Hello, ${name}!` }
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Wire up with any adapter
|
|
41
|
+
await mcphero({ name: 'my-app', description: 'My App', version: '1.0.0' })
|
|
42
|
+
.adapter(someAdapter)
|
|
43
|
+
.action(GreetAction)
|
|
44
|
+
.start()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### `mcphero(options): MCPHero`
|
|
50
|
+
|
|
51
|
+
| Option | Type | Description |
|
|
52
|
+
|--------|------|-------------|
|
|
53
|
+
| `name` | `string` | Server/app name |
|
|
54
|
+
| `description` | `string` | Human-readable description |
|
|
55
|
+
| `version` | `string` | Semantic version |
|
|
56
|
+
|
|
57
|
+
Returns a builder with `.adapter()`, `.action()`, `.actions()`, `.set()`, and `.start()`.
|
|
58
|
+
|
|
59
|
+
### `createAction(action): Action`
|
|
60
|
+
|
|
61
|
+
| Field | Type | Description |
|
|
62
|
+
|-------|------|-------------|
|
|
63
|
+
| `name` | `string` | Unique action identifier |
|
|
64
|
+
| `description` | `string` | Human-readable description |
|
|
65
|
+
| `input` | `z.ZodObject` | Zod schema for input validation |
|
|
66
|
+
| `args` | `(keyof I)[]` | Fields to expose as CLI positional arguments |
|
|
67
|
+
| `isEnabled` | `(context) => boolean` | Gate action availability per adapter |
|
|
68
|
+
| `run` | `(input, context) => Promise<O>` | The action implementation |
|
|
69
|
+
|
|
70
|
+
### Adapter Interfaces
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
interface Adapter {
|
|
74
|
+
context: MCPHeroContext
|
|
75
|
+
start(actions: Action[]): Promise<void>
|
|
76
|
+
stop(): Promise<void>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type AdapterGenerator = (options: MCPHeroOptions, baseContext: MCPHeroContext) => Adapter
|
|
80
|
+
type AdapterFactory<T = void> = (options: T) => AdapterGenerator
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## See Also
|
|
84
|
+
|
|
85
|
+
- [MCPHero README](https://github.com/atomicbi/mcphero) — Full documentation
|
|
86
|
+
- [`@mcphero/mcp`](https://www.npmjs.com/package/@mcphero/mcp) — MCP stdio and HTTP adapters
|
|
87
|
+
- [`@mcphero/fastify`](https://www.npmjs.com/package/@mcphero/fastify) — Fastify REST adapter
|
|
88
|
+
- [`@mcphero/cli`](https://www.npmjs.com/package/@mcphero/cli) — CLI adapter
|
|
89
|
+
- [`@mcphero/vercel`](https://www.npmjs.com/package/@mcphero/vercel) — Vercel serverless adapter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcphero/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "MCP Hero Core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@mcphero/logger": "1.
|
|
16
|
+
"@mcphero/logger": "1.3.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@eslint/js": "^10.0.1",
|