usepaso 0.1.0 → 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 +128 -0
- package/dist/cli.js +13 -116
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +84 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +43 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/serve.d.ts +3 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +57 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/shared.d.ts +4 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +51 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/test.d.ts +3 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +92 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +22 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/executor.d.ts +28 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +144 -0
- package/dist/executor.js.map +1 -0
- package/dist/generators/mcp.d.ts +4 -2
- package/dist/generators/mcp.d.ts.map +1 -1
- package/dist/generators/mcp.js +24 -109
- package/dist/generators/mcp.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +12 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +441 -0
- package/dist/openapi.js.map +1 -0
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +1 -1
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +41 -11
- package/dist/validator.js.map +1 -1
- package/package.json +43 -5
- package/src/cli.ts +0 -132
- package/src/generators/mcp.ts +0 -229
- package/src/index.ts +0 -14
- package/src/parser.ts +0 -23
- package/src/types.ts +0 -67
- package/src/validator.ts +0 -188
- package/tests/mcp.test.ts +0 -119
- package/tests/parser.test.ts +0 -67
- package/tests/validator.test.ts +0 -133
- package/tsconfig.json +0 -19
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# UsePaso
|
|
2
|
+
|
|
3
|
+
[](https://github.com/5h1vmani/usepaso/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/usepaso)
|
|
5
|
+
[](https://github.com/5h1vmani/usepaso/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
**Make your API agent-ready in minutes.** One YAML declaration, every agent protocol.
|
|
8
|
+
|
|
9
|
+
UsePaso lets any service declare what AI agents can do with their API. Write a `usepaso.yaml`, and UsePaso generates a working MCP server. No protocol expertise required.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install usepaso
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Scaffold a declaration
|
|
21
|
+
npx usepaso init --name "MyService"
|
|
22
|
+
|
|
23
|
+
# Or generate from an existing OpenAPI spec
|
|
24
|
+
npx usepaso init --from-openapi ./openapi.json
|
|
25
|
+
|
|
26
|
+
# Validate
|
|
27
|
+
npx usepaso validate
|
|
28
|
+
|
|
29
|
+
# Preview what MCP tools will be generated
|
|
30
|
+
npx usepaso inspect
|
|
31
|
+
|
|
32
|
+
# Test a capability
|
|
33
|
+
npx usepaso test list_issues -p org=acme -p project=web --dry-run
|
|
34
|
+
|
|
35
|
+
# Start the MCP server
|
|
36
|
+
npx usepaso serve
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What You Write
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
# usepaso.yaml
|
|
43
|
+
version: "1.0"
|
|
44
|
+
|
|
45
|
+
service:
|
|
46
|
+
name: MyService
|
|
47
|
+
description: My API service
|
|
48
|
+
base_url: https://api.example.com
|
|
49
|
+
auth:
|
|
50
|
+
type: bearer
|
|
51
|
+
|
|
52
|
+
capabilities:
|
|
53
|
+
- name: list_items
|
|
54
|
+
description: List all items
|
|
55
|
+
method: GET
|
|
56
|
+
path: /items
|
|
57
|
+
permission: read
|
|
58
|
+
|
|
59
|
+
- name: create_item
|
|
60
|
+
description: Create a new item
|
|
61
|
+
method: POST
|
|
62
|
+
path: /items
|
|
63
|
+
permission: write
|
|
64
|
+
consent_required: true
|
|
65
|
+
inputs:
|
|
66
|
+
name:
|
|
67
|
+
type: string
|
|
68
|
+
required: true
|
|
69
|
+
description: Item name
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## What UsePaso Does With It
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
usepaso.yaml → MCP server (Claude, Cursor, any MCP client)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Each capability becomes an MCP tool. When an agent calls a tool, UsePaso makes the real HTTP request to your API with proper auth, parameters, and error handling.
|
|
79
|
+
|
|
80
|
+
## CLI Commands
|
|
81
|
+
|
|
82
|
+
| Command | What it does |
|
|
83
|
+
|---------|-------------|
|
|
84
|
+
| `usepaso init` | Scaffold a `usepaso.yaml` template |
|
|
85
|
+
| `usepaso init --from-openapi` | Generate from OpenAPI spec (file or URL) |
|
|
86
|
+
| `usepaso validate` | Check your declaration for errors |
|
|
87
|
+
| `usepaso inspect` | Preview MCP tools that will be generated |
|
|
88
|
+
| `usepaso test <capability>` | Test a capability with a real HTTP request |
|
|
89
|
+
| `usepaso test <cap> --dry-run` | Preview the HTTP request without executing |
|
|
90
|
+
| `usepaso serve` | Start an MCP server (stdio transport) |
|
|
91
|
+
| `usepaso serve --verbose` | Serve with request logging |
|
|
92
|
+
|
|
93
|
+
## Programmatic Usage
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { parseFile, validate, generateMcpServer } from 'usepaso';
|
|
97
|
+
|
|
98
|
+
const decl = parseFile('usepaso.yaml');
|
|
99
|
+
const errors = validate(decl);
|
|
100
|
+
const server = generateMcpServer(decl);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Connect to MCP Clients
|
|
104
|
+
|
|
105
|
+
### Claude Desktop
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"my-service": {
|
|
111
|
+
"command": "npx",
|
|
112
|
+
"args": ["usepaso", "serve", "-f", "/path/to/usepaso.yaml"],
|
|
113
|
+
"env": { "USEPASO_AUTH_TOKEN": "your-token" }
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Links
|
|
120
|
+
|
|
121
|
+
- [Full documentation](https://github.com/5h1vmani/usepaso)
|
|
122
|
+
- [Spec reference](https://github.com/5h1vmani/usepaso/blob/main/spec/usepaso-spec.md)
|
|
123
|
+
- [Examples](https://github.com/5h1vmani/usepaso/tree/main/examples)
|
|
124
|
+
- [Python SDK](https://pypi.org/project/usepaso/)
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
Apache 2.0
|
package/dist/cli.js
CHANGED
|
@@ -2,122 +2,19 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
5
|
+
const init_1 = require("./commands/init");
|
|
6
|
+
const validate_1 = require("./commands/validate");
|
|
7
|
+
const inspect_1 = require("./commands/inspect");
|
|
8
|
+
const test_1 = require("./commands/test");
|
|
9
|
+
const serve_1 = require("./commands/serve");
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
11
|
+
const { version } = require('../package.json');
|
|
10
12
|
const program = new commander_1.Command();
|
|
11
|
-
program
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
program
|
|
16
|
-
|
|
17
|
-
.description('Create a paso.yaml template in the current directory')
|
|
18
|
-
.option('-n, --name <name>', 'Service name')
|
|
19
|
-
.action((opts) => {
|
|
20
|
-
const outPath = (0, path_1.resolve)('paso.yaml');
|
|
21
|
-
if ((0, fs_1.existsSync)(outPath)) {
|
|
22
|
-
console.error('paso.yaml already exists in this directory.');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
const name = opts.name || 'MyService';
|
|
26
|
-
const template = `version: "1.0"
|
|
27
|
-
|
|
28
|
-
service:
|
|
29
|
-
name: ${name}
|
|
30
|
-
description: TODO — describe what your service does
|
|
31
|
-
base_url: https://api.example.com
|
|
32
|
-
auth:
|
|
33
|
-
type: bearer
|
|
34
|
-
|
|
35
|
-
capabilities:
|
|
36
|
-
- name: example_action
|
|
37
|
-
description: TODO — describe what this action does
|
|
38
|
-
method: GET
|
|
39
|
-
path: /example
|
|
40
|
-
permission: read
|
|
41
|
-
inputs:
|
|
42
|
-
id:
|
|
43
|
-
type: string
|
|
44
|
-
required: true
|
|
45
|
-
description: TODO — describe this parameter
|
|
46
|
-
in: query
|
|
47
|
-
output:
|
|
48
|
-
result:
|
|
49
|
-
type: string
|
|
50
|
-
description: TODO — describe the output
|
|
51
|
-
|
|
52
|
-
permissions:
|
|
53
|
-
read:
|
|
54
|
-
- example_action
|
|
55
|
-
`;
|
|
56
|
-
(0, fs_1.writeFileSync)(outPath, template, 'utf-8');
|
|
57
|
-
console.log(`Created paso.yaml for "${name}"`);
|
|
58
|
-
console.log('Edit the file to declare your API capabilities, then run: usepaso serve');
|
|
59
|
-
});
|
|
60
|
-
program
|
|
61
|
-
.command('validate')
|
|
62
|
-
.description('Validate a paso.yaml file')
|
|
63
|
-
.option('-f, --file <path>', 'Path to paso.yaml', 'paso.yaml')
|
|
64
|
-
.action((opts) => {
|
|
65
|
-
const filePath = (0, path_1.resolve)(opts.file);
|
|
66
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
67
|
-
console.error(`File not found: ${filePath}`);
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const decl = (0, parser_1.parseFile)(filePath);
|
|
72
|
-
const errors = (0, validator_1.validate)(decl);
|
|
73
|
-
if (errors.length === 0) {
|
|
74
|
-
console.log(`${filePath} is valid.`);
|
|
75
|
-
console.log(`Service: ${decl.service.name}`);
|
|
76
|
-
console.log(`Capabilities: ${decl.capabilities.length}`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
console.error(`Found ${errors.length} error(s):`);
|
|
80
|
-
for (const err of errors) {
|
|
81
|
-
console.error(` ${err.path}: ${err.message}`);
|
|
82
|
-
}
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
console.error(`Failed to parse: ${err instanceof Error ? err.message : err}`);
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
program
|
|
92
|
-
.command('serve')
|
|
93
|
-
.description('Start an MCP server from a paso.yaml declaration')
|
|
94
|
-
.option('-f, --file <path>', 'Path to paso.yaml', 'paso.yaml')
|
|
95
|
-
.action(async (opts) => {
|
|
96
|
-
const filePath = (0, path_1.resolve)(opts.file);
|
|
97
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
98
|
-
console.error(`File not found: ${filePath}`);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const decl = (0, parser_1.parseFile)(filePath);
|
|
103
|
-
const errors = (0, validator_1.validate)(decl);
|
|
104
|
-
if (errors.length > 0) {
|
|
105
|
-
console.error(`Validation failed with ${errors.length} error(s):`);
|
|
106
|
-
for (const err of errors) {
|
|
107
|
-
console.error(` ${err.path}: ${err.message}`);
|
|
108
|
-
}
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
console.error(`Paso MCP server starting for "${decl.service.name}"...`);
|
|
112
|
-
console.error(`Capabilities: ${decl.capabilities.length}`);
|
|
113
|
-
console.error('Transport: stdio');
|
|
114
|
-
console.error('Waiting for MCP client connection...');
|
|
115
|
-
await (0, mcp_1.serveMcp)(decl);
|
|
116
|
-
}
|
|
117
|
-
catch (err) {
|
|
118
|
-
console.error(`Failed to start: ${err instanceof Error ? err.message : err}`);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
13
|
+
program.name('usepaso').description('Make your API agent-ready in minutes').version(version);
|
|
14
|
+
(0, init_1.registerInit)(program);
|
|
15
|
+
(0, validate_1.registerValidate)(program);
|
|
16
|
+
(0, inspect_1.registerInspect)(program);
|
|
17
|
+
(0, test_1.registerTest)(program);
|
|
18
|
+
(0, serve_1.registerServe)(program);
|
|
122
19
|
program.parse();
|
|
123
20
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,0CAA+C;AAC/C,kDAAuD;AACvD,gDAAqD;AACrD,0CAA+C;AAC/C,4CAAiD;AAEjD,iEAAiE;AACjE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7F,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,2BAAgB,EAAC,OAAO,CAAC,CAAC;AAC1B,IAAA,yBAAe,EAAC,OAAO,CAAC,CAAC;AACzB,IAAA,mBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwEnD"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerInit = registerInit;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const openapi_1 = require("../openapi");
|
|
7
|
+
const yaml_1 = require("yaml");
|
|
8
|
+
const FALLBACK_TEMPLATE = `version: "1.0"\n\nservice:\n name: __SERVICE_NAME__\n description: TODO — describe what your service does\n base_url: https://api.example.com\n auth:\n type: bearer\n\ncapabilities:\n - name: example_action\n description: TODO — describe what this action does\n method: GET\n path: /example\n permission: read\n inputs:\n id:\n type: string\n required: true\n description: TODO — describe this parameter\n in: query\n output:\n result:\n type: string\n description: TODO — describe the output\n\npermissions:\n read:\n - example_action\n`;
|
|
9
|
+
function loadTemplate() {
|
|
10
|
+
const candidates = [
|
|
11
|
+
(0, path_1.join)(__dirname, '..', '..', '..', '..', 'examples', 'template', 'usepaso.yaml'),
|
|
12
|
+
(0, path_1.join)(__dirname, '..', '..', '..', 'examples', 'template', 'usepaso.yaml'),
|
|
13
|
+
];
|
|
14
|
+
for (const tp of candidates) {
|
|
15
|
+
if ((0, fs_1.existsSync)(tp)) {
|
|
16
|
+
return (0, fs_1.readFileSync)(tp, 'utf-8');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return FALLBACK_TEMPLATE;
|
|
20
|
+
}
|
|
21
|
+
function registerInit(program) {
|
|
22
|
+
program
|
|
23
|
+
.command('init')
|
|
24
|
+
.description('Create a usepaso.yaml template in the current directory')
|
|
25
|
+
.option('-n, --name <name>', 'Service name')
|
|
26
|
+
.option('--from-openapi <path>', 'Generate from an OpenAPI 3.x spec (JSON, YAML, or URL)')
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
const outPath = (0, path_1.resolve)('usepaso.yaml');
|
|
29
|
+
if ((0, fs_1.existsSync)(outPath)) {
|
|
30
|
+
console.error('usepaso.yaml already exists in this directory.');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
if (opts.fromOpenapi) {
|
|
34
|
+
const source = opts.fromOpenapi;
|
|
35
|
+
try {
|
|
36
|
+
let specContent;
|
|
37
|
+
if (source.startsWith('http://') || source.startsWith('https://')) {
|
|
38
|
+
const res = await fetch(source);
|
|
39
|
+
if (!res.ok) {
|
|
40
|
+
console.error(`Failed to fetch OpenAPI spec: ${res.status} ${res.statusText}`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
specContent = await res.text();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const specPath = (0, path_1.resolve)(source);
|
|
47
|
+
if (!(0, fs_1.existsSync)(specPath)) {
|
|
48
|
+
console.error(`OpenAPI spec not found: ${specPath}`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
specContent = (0, fs_1.readFileSync)(specPath, 'utf-8');
|
|
52
|
+
}
|
|
53
|
+
let spec;
|
|
54
|
+
try {
|
|
55
|
+
spec = JSON.parse(specContent);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
spec = (0, yaml_1.parse)(specContent);
|
|
59
|
+
}
|
|
60
|
+
const result = (0, openapi_1.generateFromOpenApi)(spec);
|
|
61
|
+
(0, fs_1.writeFileSync)(outPath, result.yaml, 'utf-8');
|
|
62
|
+
console.log(`Generated usepaso.yaml from ${source}`);
|
|
63
|
+
console.log(` Service: ${result.serviceName}`);
|
|
64
|
+
console.log(` Capabilities: ${result.generatedCount} (${result.readCount} read, ${result.writeCount} write, ${result.adminCount} admin)`);
|
|
65
|
+
console.log(` Auth: ${result.authType}`);
|
|
66
|
+
if (result.totalOperations > result.generatedCount) {
|
|
67
|
+
console.log(` Note: ${result.totalOperations} operations found, capped at ${result.generatedCount}. Edit usepaso.yaml to add more.`);
|
|
68
|
+
}
|
|
69
|
+
console.log('Review the file, then run: usepaso validate');
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
console.error(`Failed to convert OpenAPI spec: ${err instanceof Error ? err.message : err}`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const name = opts.name || 'MyService';
|
|
78
|
+
const template = loadTemplate().replace('__SERVICE_NAME__', name);
|
|
79
|
+
(0, fs_1.writeFileSync)(outPath, template, 'utf-8');
|
|
80
|
+
console.log(`Created usepaso.yaml for "${name}"`);
|
|
81
|
+
console.log('Edit the file to declare your API capabilities, then run: usepaso serve');
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;AAqBA,oCAwEC;AA5FD,+BAAqC;AACrC,2BAA6D;AAC7D,wCAAiD;AACjD,+BAA0C;AAE1C,MAAM,iBAAiB,GAAG,6mBAA6mB,CAAC;AAExoB,SAAS,YAAY;IACnB,MAAM,UAAU,GAAG;QACjB,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAA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,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAClD,IAAI,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;oBACnD,OAAO,CAAC,GAAG,CACT,WAAW,MAAM,CAAC,eAAe,gCAAgC,MAAM,CAAC,cAAc,kCAAkC,CACzH,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CACX,mCAAmC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAC9E,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,WAAW,CAAC;QACtC,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QAClE,IAAA,kBAAa,EAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,GAAG,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuCtD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerInspect = registerInspect;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
function registerInspect(program) {
|
|
7
|
+
program
|
|
8
|
+
.command('inspect')
|
|
9
|
+
.description('Show what MCP tools would be generated (dry run)')
|
|
10
|
+
.option('-f, --file <path>', 'Path to usepaso.yaml', 'usepaso.yaml')
|
|
11
|
+
.action((opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const decl = (0, shared_1.loadAndValidate)((0, path_1.resolve)(opts.file));
|
|
14
|
+
const forbidden = new Set(decl.permissions?.forbidden || []);
|
|
15
|
+
const tools = decl.capabilities.filter((c) => !forbidden.has(c.name));
|
|
16
|
+
console.log(`Service: ${decl.service.name}`);
|
|
17
|
+
console.log(`Tools: ${tools.length}`);
|
|
18
|
+
console.log(`Auth: ${decl.service.auth?.type || 'none'}`);
|
|
19
|
+
console.log('');
|
|
20
|
+
for (const tool of tools) {
|
|
21
|
+
const badge = tool.consent_required ? ' [consent required]' : '';
|
|
22
|
+
console.log(` ${tool.name} (${tool.permission})${badge}`);
|
|
23
|
+
console.log(` ${tool.method} ${tool.path}`);
|
|
24
|
+
console.log(` ${tool.description}`);
|
|
25
|
+
if (tool.inputs) {
|
|
26
|
+
const params = Object.entries(tool.inputs)
|
|
27
|
+
.map(([k, v]) => `${k}${v.required ? '*' : ''}: ${v.type}`)
|
|
28
|
+
.join(', ');
|
|
29
|
+
console.log(` params: ${params}`);
|
|
30
|
+
}
|
|
31
|
+
console.log('');
|
|
32
|
+
}
|
|
33
|
+
if (decl.permissions?.forbidden?.length) {
|
|
34
|
+
console.log(`Forbidden: ${decl.permissions.forbidden.join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.error(`Failed: ${err instanceof Error ? err.message : err}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +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ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqEpD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerServe = registerServe;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
const mcp_1 = require("../generators/mcp");
|
|
8
|
+
function registerServe(program) {
|
|
9
|
+
program
|
|
10
|
+
.command('serve')
|
|
11
|
+
.description('Start an MCP server from a usepaso.yaml declaration')
|
|
12
|
+
.option('-f, --file <path>', 'Path to usepaso.yaml', 'usepaso.yaml')
|
|
13
|
+
.option('-v, --verbose', 'Log all requests to stderr')
|
|
14
|
+
.option('-w, --watch', 'Notify when usepaso.yaml changes (requires manual restart)')
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
const filePath = (0, path_1.resolve)(opts.file);
|
|
17
|
+
try {
|
|
18
|
+
const decl = (0, shared_1.loadAndValidate)(filePath);
|
|
19
|
+
// Auth warning
|
|
20
|
+
if (decl.service.auth &&
|
|
21
|
+
decl.service.auth.type !== 'none' &&
|
|
22
|
+
!process.env.USEPASO_AUTH_TOKEN) {
|
|
23
|
+
console.error(`Warning: auth type "${decl.service.auth.type}" is configured but USEPASO_AUTH_TOKEN is not set. API requests will likely fail with 401.`);
|
|
24
|
+
}
|
|
25
|
+
console.error(`usepaso serving "${decl.service.name}" (${decl.capabilities.length} capabilities)`);
|
|
26
|
+
console.error('Transport: stdio — waiting for MCP client...');
|
|
27
|
+
// Show MCP config snippet
|
|
28
|
+
console.error((0, shared_1.mcpConfigSnippet)(filePath, decl.service.name));
|
|
29
|
+
console.error('');
|
|
30
|
+
// Verbose logging callback
|
|
31
|
+
const onLog = opts.verbose
|
|
32
|
+
? (capName, result) => {
|
|
33
|
+
const now = new Date().toISOString().slice(11, 19);
|
|
34
|
+
if (result.error) {
|
|
35
|
+
console.error(`[${now}] ${capName} → ERROR: ${result.error}`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.error(`[${now}] ${capName} → ${result.request.method} ${result.request.url} ← ${result.status} (${result.durationMs}ms)`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
: undefined;
|
|
42
|
+
// Watch mode
|
|
43
|
+
if (opts.watch) {
|
|
44
|
+
console.error(`Watching ${filePath} for changes...`);
|
|
45
|
+
(0, fs_1.watchFile)(filePath, { interval: 1000 }, () => {
|
|
46
|
+
console.error(`\nFile changed. Restart the server to pick up changes.`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
await (0, mcp_1.serveMcp)(decl, onLog);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
console.error(`Failed to start: ${err instanceof Error ? err.message : err}`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":";;AAMA,sCAqEC;AA1ED,+BAA+B;AAC/B,2BAA+B;AAC/B,qCAA6D;AAC7D,2CAA6C;AAE7C,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,EAAE,cAAc,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,4BAA4B,CAAC;SACrD,MAAM,CAAC,aAAa,EAAE,4DAA4D,CAAC;SACnF,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM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AC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,KAAK,CACnH,CAAC;oBACJ,CAAC;gBACH,CAAC;gBACH,CAAC,CAAC,SAAS,CAAC;YAEd,aAAa;YACb,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,YAAY,QAAQ,iBAAiB,CAAC,CAAC;gBACrD,IAAA,cAAS,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;oBAC3C,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;gBAC1E,CAAC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,IAAA,cAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAejE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAyB9E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadAndValidate = loadAndValidate;
|
|
4
|
+
exports.mcpConfigSnippet = mcpConfigSnippet;
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const parser_1 = require("../parser");
|
|
8
|
+
const validator_1 = require("../validator");
|
|
9
|
+
function loadAndValidate(filePath) {
|
|
10
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
11
|
+
console.error(`File not found: ${filePath}`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const decl = (0, parser_1.parseFile)(filePath);
|
|
15
|
+
const errors = (0, validator_1.validate)(decl);
|
|
16
|
+
if (errors.length > 0) {
|
|
17
|
+
console.error(`Validation failed with ${errors.length} error(s):`);
|
|
18
|
+
for (const err of errors) {
|
|
19
|
+
console.error(` ${err.path}: ${err.message}`);
|
|
20
|
+
}
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
return decl;
|
|
24
|
+
}
|
|
25
|
+
function mcpConfigSnippet(filePath, serviceName) {
|
|
26
|
+
const absPath = (0, path_1.resolve)(filePath);
|
|
27
|
+
const slug = serviceName.toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
28
|
+
return `
|
|
29
|
+
Add this to your MCP client config:
|
|
30
|
+
|
|
31
|
+
Claude Desktop (claude_desktop_config.json):
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"${slug}": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["usepaso", "serve", "-f", "${absPath}"],
|
|
37
|
+
"env": { "USEPASO_AUTH_TOKEN": "your-token" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Cursor (.cursor/mcp.json):
|
|
43
|
+
{
|
|
44
|
+
"${slug}": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["usepaso", "serve", "-f", "${absPath}"],
|
|
47
|
+
"env": { "USEPASO_AUTH_TOKEN": "your-token" }
|
|
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