truss-api-mcp 1.0.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/code-generator.d.ts +6 -0
- package/dist/lib/code-generator.d.ts.map +1 -0
- package/dist/lib/code-generator.js +890 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/http-client.d.ts +6 -0
- package/dist/lib/http-client.d.ts.map +1 -0
- package/dist/lib/http-client.js +76 -0
- package/dist/lib/http-client.js.map +1 -0
- package/dist/lib/license.d.ts +4 -0
- package/dist/lib/license.d.ts.map +1 -0
- package/dist/lib/license.js +97 -0
- package/dist/lib/license.js.map +1 -0
- package/dist/lib/openapi-parser.d.ts +11 -0
- package/dist/lib/openapi-parser.d.ts.map +1 -0
- package/dist/lib/openapi-parser.js +390 -0
- package/dist/lib/openapi-parser.js.map +1 -0
- package/dist/lib/schema-validator.d.ts +15 -0
- package/dist/lib/schema-validator.d.ts.map +1 -0
- package/dist/lib/schema-validator.js +206 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/tools/compare-specs.d.ts +3 -0
- package/dist/tools/compare-specs.d.ts.map +1 -0
- package/dist/tools/compare-specs.js +59 -0
- package/dist/tools/compare-specs.js.map +1 -0
- package/dist/tools/generate-client.d.ts +3 -0
- package/dist/tools/generate-client.d.ts.map +1 -0
- package/dist/tools/generate-client.js +65 -0
- package/dist/tools/generate-client.js.map +1 -0
- package/dist/tools/generate-openapi.d.ts +3 -0
- package/dist/tools/generate-openapi.d.ts.map +1 -0
- package/dist/tools/generate-openapi.js +57 -0
- package/dist/tools/generate-openapi.js.map +1 -0
- package/dist/tools/generate-tests.d.ts +3 -0
- package/dist/tools/generate-tests.d.ts.map +1 -0
- package/dist/tools/generate-tests.js +59 -0
- package/dist/tools/generate-tests.js.map +1 -0
- package/dist/tools/mock-server.d.ts +3 -0
- package/dist/tools/mock-server.d.ts.map +1 -0
- package/dist/tools/mock-server.js +60 -0
- package/dist/tools/mock-server.js.map +1 -0
- package/dist/tools/parse-openapi.d.ts +3 -0
- package/dist/tools/parse-openapi.d.ts.map +1 -0
- package/dist/tools/parse-openapi.js +48 -0
- package/dist/tools/parse-openapi.js.map +1 -0
- package/dist/tools/test-endpoint.d.ts +3 -0
- package/dist/tools/test-endpoint.d.ts.map +1 -0
- package/dist/tools/test-endpoint.js +66 -0
- package/dist/tools/test-endpoint.js.map +1 -0
- package/dist/tools/validate-response.d.ts +3 -0
- package/dist/tools/validate-response.d.ts.map +1 -0
- package/dist/tools/validate-response.js +44 -0
- package/dist/tools/validate-response.js.map +1 -0
- package/dist/types.d.ts +121 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/evals/eval-http.ts +163 -0
- package/evals/eval-openapi.ts +506 -0
- package/evals/run-evals.ts +29 -0
- package/glama.json +4 -0
- package/package.json +37 -0
- package/smithery.yaml +9 -0
- package/src/index.ts +110 -0
- package/src/lib/code-generator.ts +1045 -0
- package/src/lib/http-client.ts +87 -0
- package/src/lib/license.ts +121 -0
- package/src/lib/openapi-parser.ts +456 -0
- package/src/lib/schema-validator.ts +234 -0
- package/src/tools/compare-specs.ts +67 -0
- package/src/tools/generate-client.ts +75 -0
- package/src/tools/generate-openapi.ts +67 -0
- package/src/tools/generate-tests.ts +69 -0
- package/src/tools/mock-server.ts +68 -0
- package/src/tools/parse-openapi.ts +54 -0
- package/src/tools/test-endpoint.ts +71 -0
- package/src/tools/validate-response.ts +54 -0
- package/src/types.ts +156 -0
- package/tsconfig.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TRUSS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# TRUSS API Testing MCP
|
|
2
|
+
|
|
3
|
+
API testing and documentation tools for Claude Code. Test endpoints, parse OpenAPI specs, validate responses, generate clients, and more — all from your AI assistant.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
### Free Tier
|
|
8
|
+
| Tool | Description |
|
|
9
|
+
|------|-------------|
|
|
10
|
+
| `test_endpoint` | Send HTTP request and get structured response (status, headers, body, timing, size) |
|
|
11
|
+
| `parse_openapi` | Parse an OpenAPI 3.x or Swagger 2.0 spec and list all endpoints |
|
|
12
|
+
| `validate_response` | Validate API response against expected status and JSON Schema |
|
|
13
|
+
|
|
14
|
+
### Pro Tier ($25/mo)
|
|
15
|
+
| Tool | Description |
|
|
16
|
+
|------|-------------|
|
|
17
|
+
| `generate_openapi` | Auto-generate OpenAPI spec from example requests/responses |
|
|
18
|
+
| `generate_tests` | Generate API test suite (Jest, Vitest, or Pytest) |
|
|
19
|
+
| `mock_server` | Generate mock server config from OpenAPI spec |
|
|
20
|
+
| `compare_specs` | Diff two specs and find breaking changes |
|
|
21
|
+
| `generate_client` | Generate typed API client (TypeScript, Python, Go) |
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Claude Desktop / Claude Code
|
|
26
|
+
|
|
27
|
+
Add to your MCP configuration:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"truss-api-testing": {
|
|
33
|
+
"command": "npx",
|
|
34
|
+
"args": ["-y", "truss-api-mcp"],
|
|
35
|
+
"env": {
|
|
36
|
+
"TRUSS_LICENSE_KEY": "your-key-here"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From Source
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/claw-factory/truss-api-mcp.git
|
|
47
|
+
cd truss-api-mcp
|
|
48
|
+
npm install
|
|
49
|
+
npm run build
|
|
50
|
+
npm start
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage Examples
|
|
54
|
+
|
|
55
|
+
### Test an endpoint
|
|
56
|
+
```
|
|
57
|
+
Use test_endpoint to send a GET request to https://api.example.com/users
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Parse an OpenAPI spec
|
|
61
|
+
```
|
|
62
|
+
Use parse_openapi to analyze this spec: <paste your spec>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Generate a TypeScript client
|
|
66
|
+
```
|
|
67
|
+
Use generate_client with this OpenAPI spec to create a TypeScript fetch client
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Compare API versions
|
|
71
|
+
```
|
|
72
|
+
Use compare_specs with the old and new OpenAPI specs to find breaking changes
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Environment Variables
|
|
76
|
+
|
|
77
|
+
| Variable | Required | Description |
|
|
78
|
+
|----------|----------|-------------|
|
|
79
|
+
| `TRUSS_LICENSE_KEY` | No | Pro license key for premium features |
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
// Tool registrations
|
|
5
|
+
import { registerTestEndpoint } from './tools/test-endpoint.js';
|
|
6
|
+
import { registerParseOpenApi } from './tools/parse-openapi.js';
|
|
7
|
+
import { registerValidateResponse } from './tools/validate-response.js';
|
|
8
|
+
import { registerGenerateOpenApi } from './tools/generate-openapi.js';
|
|
9
|
+
import { registerGenerateTests } from './tools/generate-tests.js';
|
|
10
|
+
import { registerMockServer } from './tools/mock-server.js';
|
|
11
|
+
import { registerCompareSpecs } from './tools/compare-specs.js';
|
|
12
|
+
import { registerGenerateClient } from './tools/generate-client.js';
|
|
13
|
+
// License
|
|
14
|
+
import { getLicenseStatus } from './lib/license.js';
|
|
15
|
+
const server = new McpServer({
|
|
16
|
+
name: '@truss-dev/api-testing-mcp',
|
|
17
|
+
version: '1.0.0',
|
|
18
|
+
});
|
|
19
|
+
// ── Status Tool ─────────────────────────────────────────────────────
|
|
20
|
+
server.tool('check_api_status', 'Check TRUSS API Testing MCP license status and available tools.', {}, async () => {
|
|
21
|
+
const license = await getLicenseStatus();
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: JSON.stringify({
|
|
27
|
+
server: '@truss-dev/api-testing-mcp',
|
|
28
|
+
version: '1.0.0',
|
|
29
|
+
license: {
|
|
30
|
+
tier: license.tier,
|
|
31
|
+
valid: license.valid,
|
|
32
|
+
expires_at: license.expiresAt,
|
|
33
|
+
},
|
|
34
|
+
tools: {
|
|
35
|
+
free: [
|
|
36
|
+
{ name: 'test_endpoint', description: 'Send HTTP request and get structured response' },
|
|
37
|
+
{ name: 'parse_openapi', description: 'Parse OpenAPI/Swagger spec and list endpoints' },
|
|
38
|
+
{ name: 'validate_response', description: 'Validate API response against expected schema' },
|
|
39
|
+
],
|
|
40
|
+
pro: [
|
|
41
|
+
{ name: 'generate_openapi', description: 'Auto-generate OpenAPI spec from examples' },
|
|
42
|
+
{ name: 'generate_tests', description: 'Generate API test suite (Jest/Vitest/Pytest)' },
|
|
43
|
+
{ name: 'mock_server', description: 'Generate mock server config from spec' },
|
|
44
|
+
{ name: 'compare_specs', description: 'Diff two specs and find breaking changes' },
|
|
45
|
+
{ name: 'generate_client', description: 'Generate typed API client (TS/Python/Go)' },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
...(license.tier === 'free'
|
|
49
|
+
? {
|
|
50
|
+
upgrade_info: {
|
|
51
|
+
url: 'https://truss.dev/pricing',
|
|
52
|
+
price: '$25/mo',
|
|
53
|
+
features: [
|
|
54
|
+
'Auto-generate OpenAPI specs from examples',
|
|
55
|
+
'Generate API test suites (Jest, Vitest, Pytest)',
|
|
56
|
+
'Mock server generation from specs',
|
|
57
|
+
'Breaking change detection between spec versions',
|
|
58
|
+
'Multi-language client code generation (TS, Python, Go)',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
}, null, 2),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// ── Register Free Tier Tools ────────────────────────────────────────
|
|
69
|
+
registerTestEndpoint(server);
|
|
70
|
+
registerParseOpenApi(server);
|
|
71
|
+
registerValidateResponse(server);
|
|
72
|
+
// ── Register Pro Tier Tools ─────────────────────────────────────────
|
|
73
|
+
registerGenerateOpenApi(server);
|
|
74
|
+
registerGenerateTests(server);
|
|
75
|
+
registerMockServer(server);
|
|
76
|
+
registerCompareSpecs(server);
|
|
77
|
+
registerGenerateClient(server);
|
|
78
|
+
// ── Start Server ────────────────────────────────────────────────────
|
|
79
|
+
async function main() {
|
|
80
|
+
const transport = new StdioServerTransport();
|
|
81
|
+
process.on('SIGINT', () => process.exit(0));
|
|
82
|
+
process.on('SIGTERM', () => process.exit(0));
|
|
83
|
+
await server.connect(transport);
|
|
84
|
+
}
|
|
85
|
+
main().catch((err) => {
|
|
86
|
+
console.error('Fatal error starting MCP server:', err);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,qBAAqB;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0B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,kCAAkC,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParsedOpenApiSpec, CodeLanguage, HttpStyle, TestFramework, SpecComparison, MockServerConfig } from '../types.js';
|
|
2
|
+
export declare function generateClient(spec: ParsedOpenApiSpec, language: CodeLanguage, style?: HttpStyle): string;
|
|
3
|
+
export declare function generateTests(spec: ParsedOpenApiSpec, baseUrl: string, framework?: TestFramework): string;
|
|
4
|
+
export declare function generateMockServer(spec: ParsedOpenApiSpec): MockServerConfig;
|
|
5
|
+
export declare function compareSpecs(oldSpec: ParsedOpenApiSpec, newSpec: ParsedOpenApiSpec): SpecComparison;
|
|
6
|
+
//# sourceMappingURL=code-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-generator.d.ts","sourceRoot":"","sources":["../../src/lib/code-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGjB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EAEd,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAIrB,wBAAgB,cAAc,CAC5B,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,YAAY,EACtB,KAAK,GAAE,SAAmB,GACzB,MAAM,CASR;AAohBD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,aAAwB,GAClC,MAAM,CAQR;AAyKD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,CA4C5E;AAoCD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,GACzB,cAAc,CA4IhB"}
|