veris-ai 1.4.0__tar.gz → 1.5.0__tar.gz
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.
Potentially problematic release.
This version of veris-ai might be problematic. Click here for more details.
- {veris_ai-1.4.0 → veris_ai-1.5.0}/PKG-INFO +10 -4
- {veris_ai-1.4.0 → veris_ai-1.5.0}/README.md +8 -2
- {veris_ai-1.4.0 → veris_ai-1.5.0}/examples/README.md +4 -3
- {veris_ai-1.4.0 → veris_ai-1.5.0}/examples/import_options.py +3 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/pyproject.toml +13 -2
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/tool_mock.py +1 -1
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/conftest.py +1 -1
- veris_ai-1.4.0/tests/fixtures/sse_server.py → veris_ai-1.5.0/tests/fixtures/http_server.py +7 -4
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/test_mcp_protocol_server_mocked.py +7 -7
- {veris_ai-1.4.0 → veris_ai-1.5.0}/uv.lock +27 -5
- {veris_ai-1.4.0 → veris_ai-1.5.0}/.cursor/rules/documentation-management.mdc +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/.github/workflows/release.yml +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/.github/workflows/test.yml +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/.gitignore +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/CHANGELOG.md +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/CLAUDE.md +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/LICENSE +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/examples/__init__.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/README.md +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/__init__.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/braintrust_tracing.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/jaeger_interface/README.md +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/jaeger_interface/__init__.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/jaeger_interface/client.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/jaeger_interface/models.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/logging.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/models.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/src/veris_ai/utils.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/README.md +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/__init__.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/fixtures/__init__.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/fixtures/simple_app.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/test_tool_mock.py +0 -0
- {veris_ai-1.4.0 → veris_ai-1.5.0}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: veris-ai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: A Python package for Veris AI tools
|
|
5
5
|
Project-URL: Homepage, https://github.com/veris-ai/veris-python-sdk
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/veris-ai/veris-python-sdk/issues
|
|
@@ -22,7 +22,7 @@ Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
|
22
22
|
Requires-Dist: ruff>=0.11.4; extra == 'dev'
|
|
23
23
|
Provides-Extra: fastapi
|
|
24
24
|
Requires-Dist: fastapi; extra == 'fastapi'
|
|
25
|
-
Requires-Dist: fastapi-mcp; extra == 'fastapi'
|
|
25
|
+
Requires-Dist: fastapi-mcp>=0.4.0; extra == 'fastapi'
|
|
26
26
|
Provides-Extra: instrument
|
|
27
27
|
Requires-Dist: braintrust; extra == 'instrument'
|
|
28
28
|
Requires-Dist: opentelemetry-api; extra == 'instrument'
|
|
@@ -139,7 +139,7 @@ async def get_data() -> dict:
|
|
|
139
139
|
|
|
140
140
|
**Semantic Tag**: `fastapi-mcp`
|
|
141
141
|
|
|
142
|
-
Expose FastAPI endpoints as MCP tools for AI agent consumption.
|
|
142
|
+
Expose FastAPI endpoints as MCP tools for AI agent consumption using HTTP transport.
|
|
143
143
|
|
|
144
144
|
```python
|
|
145
145
|
from fastapi import FastAPI
|
|
@@ -147,21 +147,27 @@ from veris_ai import veris
|
|
|
147
147
|
|
|
148
148
|
app = FastAPI()
|
|
149
149
|
|
|
150
|
-
# Enable MCP integration
|
|
150
|
+
# Enable MCP integration with HTTP transport
|
|
151
151
|
veris.set_fastapi_mcp(
|
|
152
152
|
fastapi=app,
|
|
153
153
|
name="My API Server",
|
|
154
154
|
include_operations=["get_users", "create_user"],
|
|
155
155
|
exclude_tags=["internal"]
|
|
156
156
|
)
|
|
157
|
+
|
|
158
|
+
# Mount the MCP server with HTTP transport (recommended)
|
|
159
|
+
veris.fastapi_mcp.mount_http()
|
|
157
160
|
```
|
|
158
161
|
|
|
159
162
|
**Key Features**:
|
|
163
|
+
- **HTTP Transport**: Uses Streamable HTTP protocol for better session management
|
|
160
164
|
- **Automatic schema conversion**: FastAPI OpenAPI → MCP tool definitions
|
|
161
165
|
- **Session management**: Bearer token → session ID mapping
|
|
162
166
|
- **Filtering**: Include/exclude operations and tags
|
|
163
167
|
- **Authentication**: OAuth2 integration
|
|
164
168
|
|
|
169
|
+
**Transport Protocol**: The SDK uses HTTP transport (via `mount_http()`) which implements the MCP Streamable HTTP specification, providing robust connection handling and fixing session routing issues with concurrent connections.
|
|
170
|
+
|
|
165
171
|
**Configuration Reference**: See function signature in [`src/veris_ai/tool_mock.py`](src/veris_ai/tool_mock.py) for all `set_fastapi_mcp()` parameters.
|
|
166
172
|
|
|
167
173
|
## Utility Functions
|
|
@@ -103,7 +103,7 @@ async def get_data() -> dict:
|
|
|
103
103
|
|
|
104
104
|
**Semantic Tag**: `fastapi-mcp`
|
|
105
105
|
|
|
106
|
-
Expose FastAPI endpoints as MCP tools for AI agent consumption.
|
|
106
|
+
Expose FastAPI endpoints as MCP tools for AI agent consumption using HTTP transport.
|
|
107
107
|
|
|
108
108
|
```python
|
|
109
109
|
from fastapi import FastAPI
|
|
@@ -111,21 +111,27 @@ from veris_ai import veris
|
|
|
111
111
|
|
|
112
112
|
app = FastAPI()
|
|
113
113
|
|
|
114
|
-
# Enable MCP integration
|
|
114
|
+
# Enable MCP integration with HTTP transport
|
|
115
115
|
veris.set_fastapi_mcp(
|
|
116
116
|
fastapi=app,
|
|
117
117
|
name="My API Server",
|
|
118
118
|
include_operations=["get_users", "create_user"],
|
|
119
119
|
exclude_tags=["internal"]
|
|
120
120
|
)
|
|
121
|
+
|
|
122
|
+
# Mount the MCP server with HTTP transport (recommended)
|
|
123
|
+
veris.fastapi_mcp.mount_http()
|
|
121
124
|
```
|
|
122
125
|
|
|
123
126
|
**Key Features**:
|
|
127
|
+
- **HTTP Transport**: Uses Streamable HTTP protocol for better session management
|
|
124
128
|
- **Automatic schema conversion**: FastAPI OpenAPI → MCP tool definitions
|
|
125
129
|
- **Session management**: Bearer token → session ID mapping
|
|
126
130
|
- **Filtering**: Include/exclude operations and tags
|
|
127
131
|
- **Authentication**: OAuth2 integration
|
|
128
132
|
|
|
133
|
+
**Transport Protocol**: The SDK uses HTTP transport (via `mount_http()`) which implements the MCP Streamable HTTP specification, providing robust connection handling and fixing session routing issues with concurrent connections.
|
|
134
|
+
|
|
129
135
|
**Configuration Reference**: See function signature in [`src/veris_ai/tool_mock.py`](src/veris_ai/tool_mock.py) for all `set_fastapi_mcp()` parameters.
|
|
130
136
|
|
|
131
137
|
## Utility Functions
|
|
@@ -55,15 +55,16 @@ if os.getenv("ENABLE_TRACING") == "true":
|
|
|
55
55
|
**Use Case**: Feature flags, environment-specific behavior
|
|
56
56
|
**Pattern**: Runtime import decisions based on configuration
|
|
57
57
|
|
|
58
|
-
### 5. FastAPI Integration
|
|
58
|
+
### 5. FastAPI Integration with HTTP Transport
|
|
59
59
|
```python
|
|
60
60
|
if os.getenv("USE_FASTAPI") == "true":
|
|
61
61
|
from fastapi import FastAPI
|
|
62
62
|
app = FastAPI()
|
|
63
63
|
veris.set_fastapi_mcp(fastapi=app, name="My API Server")
|
|
64
|
+
veris.fastapi_mcp.mount_http() # Mount with HTTP transport
|
|
64
65
|
```
|
|
65
|
-
**Use Case**: MCP server setup with
|
|
66
|
-
**Dependencies**: Requires `[fastapi]` extra
|
|
66
|
+
**Use Case**: MCP server setup with HTTP transport for robust session management
|
|
67
|
+
**Dependencies**: Requires `[fastapi]` extra (fastapi-mcp>=0.4.0)
|
|
67
68
|
|
|
68
69
|
## Integration Patterns
|
|
69
70
|
|
|
@@ -73,5 +73,8 @@ if os.getenv("USE_FASTAPI") == "true":
|
|
|
73
73
|
fastapi=app,
|
|
74
74
|
name="My API Server",
|
|
75
75
|
)
|
|
76
|
+
# Mount the MCP server with HTTP transport (recommended)
|
|
77
|
+
# Note: User must call this separately after set_fastapi_mcp
|
|
78
|
+
veris.fastapi_mcp.mount_http()
|
|
76
79
|
except ImportError:
|
|
77
80
|
print("FastAPI integration requires: pip install veris-ai[fastapi]")
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "veris-ai"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.5.0"
|
|
8
8
|
description = "A Python package for Veris AI tools"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -31,7 +31,7 @@ dev = [
|
|
|
31
31
|
]
|
|
32
32
|
fastapi = [
|
|
33
33
|
"fastapi",
|
|
34
|
-
"
|
|
34
|
+
"fastapi-mcp>=0.4.0",
|
|
35
35
|
]
|
|
36
36
|
instrument = [
|
|
37
37
|
"braintrust",
|
|
@@ -153,3 +153,14 @@ tag_format = "v{version}"
|
|
|
153
153
|
|
|
154
154
|
[tool.uv.sources]
|
|
155
155
|
veris-ai = { workspace = true }
|
|
156
|
+
|
|
157
|
+
[dependency-groups]
|
|
158
|
+
dev = [
|
|
159
|
+
"mypy>=1.17.0",
|
|
160
|
+
"openai-agents>=0.0.1",
|
|
161
|
+
"pytest>=8.4.1",
|
|
162
|
+
"pytest-asyncio>=1.1.0",
|
|
163
|
+
"pytest-cov>=6.2.1",
|
|
164
|
+
"ruff>=0.12.4",
|
|
165
|
+
"types-requests>=2.32.4.20250611",
|
|
166
|
+
]
|
|
@@ -60,7 +60,7 @@ class VerisSDK:
|
|
|
60
60
|
return self._mcp
|
|
61
61
|
|
|
62
62
|
def set_fastapi_mcp(self, **params_dict: Any) -> None: # noqa: ANN401
|
|
63
|
-
"""Set the FastAPI MCP server."""
|
|
63
|
+
"""Set the FastAPI MCP server with HTTP transport."""
|
|
64
64
|
from fastapi import Depends, Request # noqa: PLC0415
|
|
65
65
|
from fastapi.security import OAuth2PasswordBearer # noqa: PLC0415
|
|
66
66
|
from fastapi_mcp import ( # type: ignore[import-untyped] # noqa: PLC0415
|
|
@@ -9,7 +9,7 @@ import uvicorn
|
|
|
9
9
|
from fastapi_mcp import FastApiMCP # type: ignore[import-untyped]
|
|
10
10
|
from mcp import InitializeResult
|
|
11
11
|
from mcp.client.session import ClientSession
|
|
12
|
-
from mcp.client.
|
|
12
|
+
from mcp.client.streamable_http import streamablehttp_client
|
|
13
13
|
from mcp.types import EmptyResult
|
|
14
14
|
|
|
15
15
|
from veris_ai import veris
|
|
@@ -41,7 +41,7 @@ def run_server(server_port: int) -> None:
|
|
|
41
41
|
description="Test description",
|
|
42
42
|
)
|
|
43
43
|
assert veris.fastapi_mcp is not None
|
|
44
|
-
veris.fastapi_mcp.
|
|
44
|
+
veris.fastapi_mcp.mount_http() # Use HTTP transport
|
|
45
45
|
|
|
46
46
|
# Start the server
|
|
47
47
|
server = uvicorn.Server(
|
|
@@ -101,8 +101,11 @@ async def http_client(server: None, server_url: str) -> AsyncGenerator[httpx.Asy
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
@pytest.mark.anyio
|
|
104
|
-
async def
|
|
105
|
-
async with
|
|
104
|
+
async def test_http_basic_connection(server: None, server_url: str) -> None:
|
|
105
|
+
async with (
|
|
106
|
+
streamablehttp_client(server_url + "/mcp") as (read_stream, write_stream, _),
|
|
107
|
+
ClientSession(read_stream, write_stream) as session,
|
|
108
|
+
):
|
|
106
109
|
# Test initialization
|
|
107
110
|
result = await session.initialize()
|
|
108
111
|
assert isinstance(result, InitializeResult)
|
|
@@ -10,7 +10,7 @@ from unittest.mock import patch
|
|
|
10
10
|
import pytest
|
|
11
11
|
import uvicorn
|
|
12
12
|
from mcp import ClientSession, ListToolsResult
|
|
13
|
-
from mcp.client.
|
|
13
|
+
from mcp.client.streamable_http import streamablehttp_client
|
|
14
14
|
from mcp.types import CallToolResult
|
|
15
15
|
|
|
16
16
|
from veris_ai import veris
|
|
@@ -35,7 +35,7 @@ def run_server_with_mock(server_port: int) -> None: # noqa: C901
|
|
|
35
35
|
description="Test description",
|
|
36
36
|
)
|
|
37
37
|
assert veris.fastapi_mcp is not None
|
|
38
|
-
veris.fastapi_mcp.
|
|
38
|
+
veris.fastapi_mcp.mount_http() # Use HTTP transport
|
|
39
39
|
|
|
40
40
|
# Create a mock client that will be used by veris
|
|
41
41
|
class MockAsyncClient:
|
|
@@ -165,16 +165,16 @@ def server_mocked(server_port_mocked: int, simulation_env: None) -> Generator[No
|
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
@pytest.mark.asyncio
|
|
168
|
-
async def
|
|
169
|
-
"""Test
|
|
168
|
+
async def test_http_tool_call_mocked(server_mocked: None, server_url_mocked: str) -> None:
|
|
169
|
+
"""Test HTTP tool call with mocked HTTP endpoint."""
|
|
170
170
|
session_id = "test-session-id"
|
|
171
171
|
|
|
172
172
|
async with (
|
|
173
|
-
|
|
173
|
+
streamablehttp_client(
|
|
174
174
|
server_url_mocked + "/mcp",
|
|
175
175
|
headers={"Authorization": f"Bearer {session_id}"},
|
|
176
|
-
) as
|
|
177
|
-
ClientSession(
|
|
176
|
+
) as (read_stream, write_stream, _),
|
|
177
|
+
ClientSession(read_stream, write_stream) as session,
|
|
178
178
|
):
|
|
179
179
|
await session.initialize()
|
|
180
180
|
|
|
@@ -287,7 +287,7 @@ wheels = [
|
|
|
287
287
|
|
|
288
288
|
[[package]]
|
|
289
289
|
name = "fastapi-mcp"
|
|
290
|
-
version = "0.
|
|
290
|
+
version = "0.4.0"
|
|
291
291
|
source = { registry = "https://pypi.org/simple" }
|
|
292
292
|
dependencies = [
|
|
293
293
|
{ name = "fastapi" },
|
|
@@ -301,9 +301,9 @@ dependencies = [
|
|
|
301
301
|
{ name = "typer" },
|
|
302
302
|
{ name = "uvicorn" },
|
|
303
303
|
]
|
|
304
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
304
|
+
sdist = { url = "https://files.pythonhosted.org/packages/6d/1e/e3ba42f2e240dc67baabc431c68a82e380bcdae4e8b7d1310a756b2033fc/fastapi_mcp-0.4.0.tar.gz", hash = "sha256:d4ca9410996f4c7b8ea0d7b20fdf79878dc359ebf89cbf3b222e0b675a55097d", size = 184201, upload-time = "2025-07-28T12:11:05.652Z" }
|
|
305
305
|
wheels = [
|
|
306
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
306
|
+
{ url = "https://files.pythonhosted.org/packages/29/83/6bf02ff9e3ca1d24765050e3b51dceae9bb69909cc5385623cf6f3fd7c23/fastapi_mcp-0.4.0-py3-none-any.whl", hash = "sha256:d4a3fe7966af24d44e4b412720561c95eb12bed999a4443a88221834b3b15aec", size = 25085, upload-time = "2025-07-28T12:11:04.472Z" },
|
|
307
307
|
]
|
|
308
308
|
|
|
309
309
|
[[package]]
|
|
@@ -1472,7 +1472,7 @@ wheels = [
|
|
|
1472
1472
|
|
|
1473
1473
|
[[package]]
|
|
1474
1474
|
name = "veris-ai"
|
|
1475
|
-
version = "1.
|
|
1475
|
+
version = "1.4.0"
|
|
1476
1476
|
source = { editable = "." }
|
|
1477
1477
|
dependencies = [
|
|
1478
1478
|
{ name = "httpx" },
|
|
@@ -1506,12 +1506,23 @@ instrument = [
|
|
|
1506
1506
|
{ name = "wrapt" },
|
|
1507
1507
|
]
|
|
1508
1508
|
|
|
1509
|
+
[package.dev-dependencies]
|
|
1510
|
+
dev = [
|
|
1511
|
+
{ name = "mypy" },
|
|
1512
|
+
{ name = "openai-agents" },
|
|
1513
|
+
{ name = "pytest" },
|
|
1514
|
+
{ name = "pytest-asyncio" },
|
|
1515
|
+
{ name = "pytest-cov" },
|
|
1516
|
+
{ name = "ruff" },
|
|
1517
|
+
{ name = "types-requests" },
|
|
1518
|
+
]
|
|
1519
|
+
|
|
1509
1520
|
[package.metadata]
|
|
1510
1521
|
requires-dist = [
|
|
1511
1522
|
{ name = "black", marker = "extra == 'dev'", specifier = ">=23.7.0" },
|
|
1512
1523
|
{ name = "braintrust", marker = "extra == 'instrument'" },
|
|
1513
1524
|
{ name = "fastapi", marker = "extra == 'fastapi'" },
|
|
1514
|
-
{ name = "fastapi-mcp", marker = "extra == 'fastapi'" },
|
|
1525
|
+
{ name = "fastapi-mcp", marker = "extra == 'fastapi'", specifier = ">=0.4.0" },
|
|
1515
1526
|
{ name = "httpx", specifier = ">=0.24.0" },
|
|
1516
1527
|
{ name = "mypy", marker = "extra == 'dev'", specifier = ">=1.5.1" },
|
|
1517
1528
|
{ name = "openai-agents", marker = "extra == 'dev'", specifier = ">=0.0.1" },
|
|
@@ -1532,6 +1543,17 @@ requires-dist = [
|
|
|
1532
1543
|
]
|
|
1533
1544
|
provides-extras = ["dev", "fastapi", "instrument"]
|
|
1534
1545
|
|
|
1546
|
+
[package.metadata.requires-dev]
|
|
1547
|
+
dev = [
|
|
1548
|
+
{ name = "mypy", specifier = ">=1.17.0" },
|
|
1549
|
+
{ name = "openai-agents", specifier = ">=0.0.1" },
|
|
1550
|
+
{ name = "pytest", specifier = ">=8.4.1" },
|
|
1551
|
+
{ name = "pytest-asyncio", specifier = ">=1.1.0" },
|
|
1552
|
+
{ name = "pytest-cov", specifier = ">=6.2.1" },
|
|
1553
|
+
{ name = "ruff", specifier = ">=0.12.4" },
|
|
1554
|
+
{ name = "types-requests", specifier = ">=2.32.4.20250611" },
|
|
1555
|
+
]
|
|
1556
|
+
|
|
1535
1557
|
[[package]]
|
|
1536
1558
|
name = "virtualenv"
|
|
1537
1559
|
version = "20.32.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|