crowvault 2.0.0__py3-none-any.whl
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.
- crowvault/__init__.py +9 -0
- crowvault/client.py +212 -0
- crowvault-2.0.0.dist-info/METADATA +195 -0
- crowvault-2.0.0.dist-info/RECORD +6 -0
- crowvault-2.0.0.dist-info/WHEEL +5 -0
- crowvault-2.0.0.dist-info/top_level.txt +1 -0
crowvault/__init__.py
ADDED
crowvault/client.py
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Copyright (c) 2026 TechSynergy Corp. All rights reserved.
|
|
2
|
+
# https://crowvault.ai
|
|
3
|
+
|
|
4
|
+
"""CrowVault API client — zero external dependencies (uses urllib)."""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import urllib.request
|
|
9
|
+
import urllib.error
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CrowVaultError(Exception):
|
|
14
|
+
"""Raised when the CrowVault API returns an error."""
|
|
15
|
+
|
|
16
|
+
def __init__(self, message: str, status: int = 0, meta: dict | None = None):
|
|
17
|
+
super().__init__(message)
|
|
18
|
+
self.status = status
|
|
19
|
+
self.meta = meta or {}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CrowVaultClient:
|
|
23
|
+
"""Client for the CrowVault API.
|
|
24
|
+
|
|
25
|
+
Usage:
|
|
26
|
+
from crowvault import CrowVaultClient
|
|
27
|
+
|
|
28
|
+
client = CrowVaultClient(api_key="cv_...")
|
|
29
|
+
result = client.call("database-mcp", "design_schema", aggregate="Order", database="postgresql")
|
|
30
|
+
print(result.text)
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
DEFAULT_URL = "https://api.crowvault.ai"
|
|
34
|
+
TIMEOUT = 60
|
|
35
|
+
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
api_key: str | None = None,
|
|
39
|
+
api_url: str | None = None,
|
|
40
|
+
timeout: int | None = None,
|
|
41
|
+
):
|
|
42
|
+
self.api_key = api_key or os.environ.get("CROWVAULT_API_KEY", "")
|
|
43
|
+
self.api_url = (api_url or os.environ.get("CROWVAULT_API_URL", self.DEFAULT_URL)).rstrip("/")
|
|
44
|
+
self.timeout = timeout or self.TIMEOUT
|
|
45
|
+
|
|
46
|
+
if not self.api_key:
|
|
47
|
+
raise CrowVaultError("API key required. Pass api_key or set CROWVAULT_API_KEY env var.")
|
|
48
|
+
|
|
49
|
+
def _request(self, method: str, path: str, body: dict | None = None) -> dict:
|
|
50
|
+
url = f"{self.api_url}{path}"
|
|
51
|
+
headers = {
|
|
52
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
"User-Agent": "crowvault-python/2.0.0",
|
|
55
|
+
}
|
|
56
|
+
data = json.dumps(body).encode() if body else None
|
|
57
|
+
req = urllib.request.Request(url, data=data, headers=headers, method=method)
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as resp:
|
|
61
|
+
return json.loads(resp.read().decode())
|
|
62
|
+
except urllib.error.HTTPError as e:
|
|
63
|
+
try:
|
|
64
|
+
err_body = json.loads(e.read().decode())
|
|
65
|
+
msg = err_body.get("error", f"HTTP {e.code}")
|
|
66
|
+
except Exception:
|
|
67
|
+
msg = f"HTTP {e.code}"
|
|
68
|
+
raise CrowVaultError(msg, status=e.code) from None
|
|
69
|
+
except urllib.error.URLError as e:
|
|
70
|
+
raise CrowVaultError(f"Connection error: {e.reason}") from None
|
|
71
|
+
|
|
72
|
+
# ── Servers & Tools ──────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
def servers(self) -> list[dict]:
|
|
75
|
+
"""List all MCP servers with tool counts."""
|
|
76
|
+
data = self._request("GET", "/v1/servers")
|
|
77
|
+
return data.get("servers", [])
|
|
78
|
+
|
|
79
|
+
def tools(self, server: str | None = None, search: str | None = None) -> list[dict]:
|
|
80
|
+
"""List tools, optionally filtered by server or search query."""
|
|
81
|
+
params = []
|
|
82
|
+
if server:
|
|
83
|
+
params.append(f"server={server}")
|
|
84
|
+
if search:
|
|
85
|
+
params.append(f"search={urllib.request.quote(search)}")
|
|
86
|
+
qs = f"?{'&'.join(params)}" if params else ""
|
|
87
|
+
data = self._request("GET", f"/v1/tools{qs}")
|
|
88
|
+
return data.get("tools", [])
|
|
89
|
+
|
|
90
|
+
# ── Tool Execution ───────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
def call(self, server: str, tool: str, **args: Any) -> "ToolResult":
|
|
93
|
+
"""Call a single tool.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
server: Server ID (e.g., "database-mcp")
|
|
97
|
+
tool: Tool name (e.g., "design_schema")
|
|
98
|
+
**args: Tool arguments as keyword args
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
ToolResult with .text, .success, .meta
|
|
102
|
+
|
|
103
|
+
Example:
|
|
104
|
+
result = client.call("database-mcp", "design_schema",
|
|
105
|
+
aggregate="Order", database="postgresql")
|
|
106
|
+
"""
|
|
107
|
+
data = self._request("POST", "/v1/tools/call", {
|
|
108
|
+
"server": server, "tool": tool, "args": args,
|
|
109
|
+
})
|
|
110
|
+
return ToolResult(data)
|
|
111
|
+
|
|
112
|
+
def call_raw(self, server: str, tool: str, args: dict | None = None) -> "ToolResult":
|
|
113
|
+
"""Call a single tool with a dict of args (instead of kwargs).
|
|
114
|
+
|
|
115
|
+
Useful when arg names conflict with Python keywords.
|
|
116
|
+
"""
|
|
117
|
+
data = self._request("POST", "/v1/tools/call", {
|
|
118
|
+
"server": server, "tool": tool, "args": args or {},
|
|
119
|
+
})
|
|
120
|
+
return ToolResult(data)
|
|
121
|
+
|
|
122
|
+
def batch(self, requests: list[dict]) -> "BatchResult":
|
|
123
|
+
"""Execute multiple tools in parallel (max 10).
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
requests: List of {"server": str, "tool": str, "args": dict}
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
BatchResult with .results, .succeeded, .failed
|
|
130
|
+
"""
|
|
131
|
+
if len(requests) > 10:
|
|
132
|
+
raise CrowVaultError("Maximum 10 requests per batch")
|
|
133
|
+
data = self._request("POST", "/v1/tools/batch", {"requests": requests})
|
|
134
|
+
return BatchResult(data)
|
|
135
|
+
|
|
136
|
+
# ── Workflows ────────────────────────────────────────────────────────
|
|
137
|
+
|
|
138
|
+
def workflows(self) -> list[dict]:
|
|
139
|
+
"""List available workflows."""
|
|
140
|
+
data = self._request("GET", "/v1/workflows")
|
|
141
|
+
return data.get("workflows", [])
|
|
142
|
+
|
|
143
|
+
def run_workflow(self, workflow: str, **args: Any) -> "WorkflowResult":
|
|
144
|
+
"""Execute a multi-step workflow.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
workflow: Workflow ID (e.g., "microservice-scaffold")
|
|
148
|
+
**args: Input arguments as keyword args
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
WorkflowResult with .success, .results, .total_duration_ms
|
|
152
|
+
"""
|
|
153
|
+
data = self._request("POST", "/v1/workflows/execute", {
|
|
154
|
+
"workflow": workflow, "args": args,
|
|
155
|
+
})
|
|
156
|
+
return WorkflowResult(data)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class ToolResult:
|
|
160
|
+
"""Result from a single tool call."""
|
|
161
|
+
|
|
162
|
+
def __init__(self, data: dict):
|
|
163
|
+
self._data = data
|
|
164
|
+
self.success = data.get("success", not data.get("error"))
|
|
165
|
+
self.text = data.get("result", data.get("text", ""))
|
|
166
|
+
self.error = data.get("error")
|
|
167
|
+
self.meta = data.get("meta", {})
|
|
168
|
+
|
|
169
|
+
def __str__(self) -> str:
|
|
170
|
+
return self.text if self.success else f"Error: {self.error}"
|
|
171
|
+
|
|
172
|
+
def __repr__(self) -> str:
|
|
173
|
+
return f"ToolResult(success={self.success}, length={len(self.text)})"
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class BatchResult:
|
|
177
|
+
"""Result from a batch execution."""
|
|
178
|
+
|
|
179
|
+
def __init__(self, data: dict):
|
|
180
|
+
self._data = data
|
|
181
|
+
self.results = [ToolResult(r) for r in data.get("results", [])]
|
|
182
|
+
self.meta = data.get("meta", {})
|
|
183
|
+
self.succeeded = self.meta.get("succeeded", 0)
|
|
184
|
+
self.failed = self.meta.get("failed", 0)
|
|
185
|
+
self.total_duration_ms = self.meta.get("totalDurationMs", 0)
|
|
186
|
+
|
|
187
|
+
def __repr__(self) -> str:
|
|
188
|
+
return f"BatchResult(succeeded={self.succeeded}, failed={self.failed})"
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class WorkflowResult:
|
|
192
|
+
"""Result from a workflow execution."""
|
|
193
|
+
|
|
194
|
+
def __init__(self, data: dict):
|
|
195
|
+
self._data = data
|
|
196
|
+
self.success = data.get("success", False)
|
|
197
|
+
self.workflow = data.get("workflow", "")
|
|
198
|
+
self.failed_step = data.get("failedStep")
|
|
199
|
+
self.total_duration_ms = data.get("totalDurationMs", 0)
|
|
200
|
+
self.results = data.get("results", [])
|
|
201
|
+
|
|
202
|
+
def __repr__(self) -> str:
|
|
203
|
+
steps = len(self.results)
|
|
204
|
+
return f"WorkflowResult(success={self.success}, steps={steps}, duration={self.total_duration_ms}ms)"
|
|
205
|
+
|
|
206
|
+
def __str__(self) -> str:
|
|
207
|
+
lines = []
|
|
208
|
+
for i, r in enumerate(self.results):
|
|
209
|
+
icon = "+" if r.get("success") else "x"
|
|
210
|
+
lines.append(f" [{icon}] {i+1}. {r.get('tool', '?')} — {r.get('durationMs', 0)}ms")
|
|
211
|
+
status = "OK" if self.success else f"FAILED at {self.failed_step}"
|
|
212
|
+
return f"Workflow: {self.workflow} ({status}, {self.total_duration_ms}ms)\n" + "\n".join(lines)
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crowvault
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: CrowVault Python SDK — 325 AI-powered dev tools via one API. Zero dependencies.
|
|
5
|
+
Author-email: "TechSynergy Corp." <hello@crowvault.ai>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://crowvault.ai
|
|
8
|
+
Project-URL: Documentation, https://crowvault.ai/docs
|
|
9
|
+
Project-URL: Pricing, https://crowvault.ai/pricing
|
|
10
|
+
Project-URL: Contact, https://crowvault.ai/contact
|
|
11
|
+
Keywords: crowvault,mcp,ai,dev-tools,code-generation,schema,terraform,openapi,kubernetes,dockerfile,ddd,workflow,devops
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# crowvault
|
|
27
|
+
|
|
28
|
+
Python SDK for [CrowVault](https://crowvault.ai) — 325 AI-powered dev tools via one API. Zero dependencies.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install crowvault
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from crowvault import CrowVaultClient
|
|
40
|
+
|
|
41
|
+
client = CrowVaultClient(api_key="cv_your_key_here")
|
|
42
|
+
|
|
43
|
+
# Generate a database schema
|
|
44
|
+
result = client.call("database-mcp", "design_schema",
|
|
45
|
+
aggregate="Order", database="postgresql")
|
|
46
|
+
print(result.text)
|
|
47
|
+
|
|
48
|
+
# Generate a Dockerfile
|
|
49
|
+
result = client.call("devops-mcp", "generate_dockerfile",
|
|
50
|
+
runtime="node", version="20")
|
|
51
|
+
print(result.text)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Authentication
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# Option 1: Pass directly
|
|
58
|
+
client = CrowVaultClient(api_key="cv_...")
|
|
59
|
+
|
|
60
|
+
# Option 2: Environment variable
|
|
61
|
+
# export CROWVAULT_API_KEY=cv_...
|
|
62
|
+
client = CrowVaultClient()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### Call a Tool
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
result = client.call("database-mcp", "design_schema",
|
|
71
|
+
aggregate="Order",
|
|
72
|
+
database="postgresql",
|
|
73
|
+
outputFormat="prisma")
|
|
74
|
+
|
|
75
|
+
print(result.text) # Generated code
|
|
76
|
+
print(result.success) # True/False
|
|
77
|
+
print(result.meta) # {server, tool, durationMs, ...}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Call with Dict Args
|
|
81
|
+
|
|
82
|
+
Use `call_raw()` when arg names conflict with Python keywords:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
result = client.call_raw("api-mcp", "generate_openapi_spec", {
|
|
86
|
+
"service": "users",
|
|
87
|
+
"version": "v1",
|
|
88
|
+
"format": "yaml", # "format" is a Python builtin
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### List Servers & Tools
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# All servers
|
|
96
|
+
servers = client.servers()
|
|
97
|
+
for s in servers:
|
|
98
|
+
print(f"{s['name']} — {s['toolCount']} tools")
|
|
99
|
+
|
|
100
|
+
# All tools (or filter)
|
|
101
|
+
tools = client.tools(server="database-mcp")
|
|
102
|
+
tools = client.tools(search="schema")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Batch Execution
|
|
106
|
+
|
|
107
|
+
Execute up to 10 tools in parallel:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
result = client.batch([
|
|
111
|
+
{"server": "database-mcp", "tool": "design_schema",
|
|
112
|
+
"args": {"aggregate": "Order", "database": "postgresql"}},
|
|
113
|
+
{"server": "devops-mcp", "tool": "generate_dockerfile",
|
|
114
|
+
"args": {"runtime": "node", "version": "20"}},
|
|
115
|
+
{"server": "devops-mcp", "tool": "generate_k8s_deployment",
|
|
116
|
+
"args": {"name": "order-service"}},
|
|
117
|
+
])
|
|
118
|
+
|
|
119
|
+
print(f"{result.succeeded}/{len(result.results)} succeeded")
|
|
120
|
+
for r in result.results:
|
|
121
|
+
print(r.text[:100])
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Workflows
|
|
125
|
+
|
|
126
|
+
Run multi-step pipelines that chain tools together:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# List available workflows
|
|
130
|
+
workflows = client.workflows()
|
|
131
|
+
for wf in workflows:
|
|
132
|
+
print(f"{wf['id']} — {wf['stepCount']} steps")
|
|
133
|
+
|
|
134
|
+
# Run a workflow
|
|
135
|
+
result = client.run_workflow("microservice-scaffold",
|
|
136
|
+
name="orders",
|
|
137
|
+
language="node",
|
|
138
|
+
database="postgresql")
|
|
139
|
+
|
|
140
|
+
print(result) # Step-by-step summary
|
|
141
|
+
print(result.success)
|
|
142
|
+
print(result.total_duration_ms)
|
|
143
|
+
|
|
144
|
+
for step in result.results:
|
|
145
|
+
print(f"{step['tool']} — {step['durationMs']}ms")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Available workflows:**
|
|
149
|
+
- `microservice-scaffold` — Microservice + schema + migration + Docker + K8s (5 steps)
|
|
150
|
+
- `api-full-stack` — OpenAPI + endpoint + tests + contracts (4 steps)
|
|
151
|
+
- `ddd-complete` — Bounded context + model + aggregate + entity + repo + schema (6 steps)
|
|
152
|
+
- `event-driven` — Kafka + event handler + DLQ (3 steps)
|
|
153
|
+
- `deploy-stack` — Dockerfile + Compose + K8s + Helm (4 steps)
|
|
154
|
+
- `database-setup` — Schema + ORM + migration + seed (4 steps)
|
|
155
|
+
|
|
156
|
+
## 9 Servers, 325 Tools
|
|
157
|
+
|
|
158
|
+
| Server | Tools | Coverage |
|
|
159
|
+
|--------|-------|----------|
|
|
160
|
+
| AWS | 53 | EC2, S3, Lambda, RDS, ECS, CloudFormation, IAM |
|
|
161
|
+
| GCP | 41 | Compute, GKE, Cloud Run, BigQuery, Pub/Sub |
|
|
162
|
+
| Full Stack | 38 | Express, NestJS, React, Vue, Next.js, FastAPI |
|
|
163
|
+
| Frontend | 36 | Components, state, routing, forms, accessibility |
|
|
164
|
+
| Database | 34 | PostgreSQL, MySQL, MongoDB, Prisma, migrations |
|
|
165
|
+
| Testing | 31 | Jest, Vitest, Cypress, load tests, mocks |
|
|
166
|
+
| Security | 31 | Auth, RBAC, encryption, OWASP, scanning |
|
|
167
|
+
| DevOps | 31 | Docker, K8s, Terraform, Helm, CI/CD, Prometheus |
|
|
168
|
+
| API | 30 | OpenAPI, GraphQL, gRPC, Kafka, webhooks, OAuth |
|
|
169
|
+
|
|
170
|
+
## Error Handling
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from crowvault import CrowVaultClient
|
|
174
|
+
from crowvault.client import CrowVaultError
|
|
175
|
+
|
|
176
|
+
client = CrowVaultClient()
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
result = client.call("database-mcp", "design_schema",
|
|
180
|
+
aggregate="Order", database="postgresql")
|
|
181
|
+
print(result.text)
|
|
182
|
+
except CrowVaultError as e:
|
|
183
|
+
print(f"Error: {e} (HTTP {e.status})")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Pricing
|
|
187
|
+
|
|
188
|
+
- **Free**: 50 calls/month, 2 API keys — [Sign up free](https://crowvault.ai/register?plan=free)
|
|
189
|
+
- **Developer**: $49/month, 1,000 calls, 5 keys
|
|
190
|
+
- **Team**: $199/month, 10,000 calls, 10 keys
|
|
191
|
+
- **Enterprise**: Custom
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT. Copyright TechSynergy Corp.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
crowvault/__init__.py,sha256=K9PCFHjrsoCXukqtvwVUvHNQh4cXHKcKcHgv-RMjPa4,252
|
|
2
|
+
crowvault/client.py,sha256=T6SsmW-IxI8hp82sUfqxUtG5PzU8RyzEpCFDSRbty0k,7955
|
|
3
|
+
crowvault-2.0.0.dist-info/METADATA,sha256=Lj8Kh8ZxWmm13JuvuScDHruMzMUtYN4S4IhA2etKuIU,5822
|
|
4
|
+
crowvault-2.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
crowvault-2.0.0.dist-info/top_level.txt,sha256=oFh-8IAh1EAwtMxWhF2hpdOvtZnZIcqN8AbZGrjPDdY,10
|
|
6
|
+
crowvault-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
crowvault
|