Skip to content

Commit bb623f6

Browse files
committed
sdk working
1 parent 89bc115 commit bb623f6

File tree

11 files changed

+64
-374
lines changed

11 files changed

+64
-374
lines changed

README.md

Lines changed: 4 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ The Tadata Python SDK provides an easy-to-use interface for deploying Model Cont
55
## Installation
66

77
```bash
8-
# Install with pip
9-
pip install tadata-sdk
8+
# With uv (recommended)
9+
uv add tadata-sdk
1010

11-
# Or with uv (recommended)
12-
uv pip install tadata-sdk
11+
# With pip
12+
pip install tadata-sdk
1313
```
1414

1515
## Quickstart
@@ -34,119 +34,3 @@ result = deploy(
3434
print(f"Deployed MCP server: {result.id}")
3535
print(f"Created at: {result.created_at}")
3636
```
37-
38-
## OpenAPI Specification Sources
39-
40-
The SDK supports multiple ways to provide your OpenAPI specification:
41-
42-
```python
43-
# From a file (JSON or YAML)
44-
result = deploy(
45-
openapi_spec_path="./openapi.json", # or .yaml
46-
api_key="your-tadata-api-key",
47-
)
48-
49-
# From a URL
50-
result = deploy(
51-
openapi_spec_url="https://example.com/openapi.json", # or .yaml
52-
api_key="your-tadata-api-key",
53-
)
54-
55-
# From a dictionary
56-
result = deploy(
57-
openapi_spec={
58-
"openapi": "3.0.0",
59-
"info": {"title": "My API", "version": "1.0.0"},
60-
"paths": {"/hello": {"get": {"responses": {"200": {"description": "OK"}}}}},
61-
},
62-
api_key="your-tadata-api-key",
63-
)
64-
65-
# From an OpenAPISpec object
66-
spec = OpenAPISpec.from_file("./openapi.json")
67-
result = deploy(
68-
openapi_spec=spec,
69-
api_key="your-tadata-api-key",
70-
)
71-
```
72-
73-
## Authentication Handling
74-
75-
You can configure how authentication is handled between the MCP server and your API:
76-
77-
```python
78-
result = deploy(
79-
openapi_spec_path="./openapi.json",
80-
api_key="your-tadata-api-key",
81-
auth_config={
82-
"pass_headers": ["authorization", "x-api-key"], # Headers to pass through
83-
"pass_query_params": ["api_key"], # Query parameters to pass through
84-
"pass_json_body_params": [], # JSON body parameters to extract
85-
"pass_form_data_params": [], # Form data parameters to extract
86-
}
87-
)
88-
```
89-
90-
## Error Handling
91-
92-
The SDK provides specific error classes for better error handling:
93-
94-
```python
95-
from tadata_sdk import deploy, SpecInvalidError, AuthError, ApiError, NetworkError
96-
97-
try:
98-
result = deploy(
99-
openapi_spec_path="./openapi.json",
100-
api_key="your-tadata-api-key",
101-
)
102-
print(f"Deployed MCP server: {result.id}")
103-
except SpecInvalidError as e:
104-
print(f"Invalid OpenAPI spec: {e}")
105-
print(f"Details: {e.details}")
106-
except AuthError as e:
107-
print(f"Authentication failed: {e}")
108-
except ApiError as e:
109-
print(f"API error: {e}, Status: {e.status_code}")
110-
except NetworkError as e:
111-
print(f"Network error: {e}")
112-
except Exception as e:
113-
print(f"Unexpected error: {e}")
114-
```
115-
116-
## Advanced Usage
117-
118-
### Custom Logging
119-
120-
You can provide your own logger implementation:
121-
122-
```python
123-
import logging
124-
from tadata_sdk import deploy
125-
126-
# Configure a custom logger
127-
logging.basicConfig(level=logging.DEBUG)
128-
logger = logging.getLogger("tadata-example")
129-
130-
# Use the custom logger
131-
result = deploy(
132-
openapi_spec_path="./openapi.json",
133-
api_key="your-tadata-api-key",
134-
logger=logger,
135-
)
136-
```
137-
138-
### Development Environment
139-
140-
For testing purposes, you can use the development environment:
141-
142-
```python
143-
result = deploy(
144-
openapi_spec_path="./openapi.json",
145-
api_key="your-tadata-api-key",
146-
dev=True, # Use development environment
147-
)
148-
```
149-
150-
## License
151-
152-
MIT

examples/deploy_mcp.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
addopts = -vvv --cov=. --cov-report xml --cov-report term-missing --cov-fail-under=50 --cov-config=.coveragerc
2+
addopts = -vvv --cov=. --cov-report xml --cov-report term-missing --cov-fail-under=70 --cov-config=.coveragerc
33
asyncio_mode = auto
44
log_cli = true
55
log_cli_level = DEBUG

tadata_sdk/__init__.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,11 @@
77
__version__ = "0.0.0.dev0" # pragma: no cover
88

99
from .core.sdk import deploy
10+
from .http.schemas import AuthConfig
1011
from .openapi.source import OpenAPISpec
11-
from .errors.exceptions import (
12-
TadataSDKError,
13-
SpecInvalidError,
14-
AuthError,
15-
ApiError,
16-
NetworkError,
17-
)
1812

1913
__all__ = [
2014
"deploy",
2115
"OpenAPISpec",
22-
"TadataSDKError",
23-
"SpecInvalidError",
24-
"AuthError",
25-
"ApiError",
26-
"NetworkError",
16+
"AuthConfig",
2717
]

tadata_sdk/core/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .logger import create_default_logger
21
from .sdk import deploy
32

4-
__all__ = ["create_default_logger", "deploy"]
3+
__all__ = ["deploy"]

tadata_sdk/core/logger.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)