Commit Graph

15 Commits

Author SHA1 Message Date
Luca Beurer-Kellner c1112b91fc use windows select (#56)
* use windows select

* factor out platform-specific stdin waiting
2025-05-21 09:43:00 +02:00
Luca Beurer-Kellner e18c6b5bdb Add an option to add extra metadata that is pushed and passed to Guardrails during an MCP session (#47)
* use select() before readline

* support for setting static metadata for MCP sessions

* nest extra mcp metadata in metadata object

* unify session metadata

* extra metadata tests

* use empty object as parameters, if None

* list_tools as tool call

* offset indices in tests

* test: adjust addresses

* mcp: make error reporting configurable

* line logging

* log version

* verbose logging + loud exception failure

* add server and client name to policy get

* append trace even if not pushing

* port tools/list message support to SSE

* use python -m build

* adjust guardrail failure address

* support for blocking tools/list in SSE

* use error-based failure response format by default

* tools/list test

* don't list_tools in stdio connect

* flaky test: handle second possible result in anthropic streaming case

---------

Co-authored-by: knielsen404 <kristian@invariantlabs.ai>
2025-05-19 13:44:37 +02:00
Hemang 4dbb400620 Move invariant api key check to __main__.py so that the same check can work for both mcp and server commands. 2025-05-16 14:33:00 +05:30
Hemang 876eb44c78 Make MCP stdio gateway fully async. With sync and async mixed behaviour for running background tasks we were running into issues. 2025-05-16 14:33:00 +05:30
Hemang edd9fd9a5c When tool_call is blocked in MCP Post method, add the error message to a pending error messages list. Create two queues in the MCP SSE Get endpoint which correspond to the MCP server events and these pending error messages. These two queues are merged to return events back to the client. 2025-05-09 11:05:33 +05:30
Hemang 794aae0326 Add MCP guardrailing for SSE. 2025-05-08 20:40:28 +05:30
Luca Beurer-Kellner 86ec75ba2d use select() before readline (#45) 2025-05-06 16:07:50 +02:00
Hemang 52f5359d36 Add MCP client and server names in trace metadata for Explorer. 2025-04-24 15:48:36 +02:00
Hemang 7287065940 Improve on request reads from byte by byte to line by line. 2025-04-24 15:48:36 +02:00
knielsen404 55874d552e feat: append_and_push_trace uses configurable API URL 2025-04-23 13:08:57 +01:00
Hemang Sarkar 2b9785de11 Update README.md 2025-04-17 10:05:28 +02:00
Hemang 45d384b7a3 Update README for mcp. 2025-04-17 09:54:26 +02:00
Hemang e8deb8feda Rename dataset-name flag for MCP to project-name and change CLI command to run mcp 2025-04-17 07:15:28 +02:00
Hemang 2c34205c4c Fix asyncio and threading. Dedupe annotations before pushing. Add README. 2025-04-17 07:15:28 +02:00
Hemang 66c6dcb8f9 Add mcp.py 2025-04-17 07:15:28 +02:00