IA-5394: IASO mcp - #3302
IA-5394: IASO mcp#3302beygorghor wants to merge 14 commits into
Conversation
Bewi
left a comment
There was a problem hiding this comment.
I mostly reviewed the FE and with what I know of the project, don't hesitate to correct me or reject comments if it was intended.
I wonder if we should use MUI to keep in sync with other apps.
Until this day, stil no arrow functions found :D
A lot of functions should be FunctionalComponent.
Not sure about this syntax () => void copy() and saw it in a few places, why do we need to specify the void ?
There was a problem hiding this comment.
Isn't this shared somewhere ?
In case it changes one day we are sur to not forget a place and that all apps are using the same one.
| import { CodeBlock, PageShell, primaryButtonClass } from "../ui"; | ||
|
|
||
| type TabId = | ||
| | "cursor" |
There was a problem hiding this comment.
Maybe move those ids in an enum or object, so we don't have hardcoded string in multiple places
| const next = resumeOauth || catalogHome(); | ||
|
|
||
| useEffect(() => { | ||
| void getMe() |
There was a problem hiding this comment.
Never saw this, what's the void for ?
| return prop.type || "any"; | ||
| } | ||
|
|
||
| function ToolCard({ tool }: { tool: Tool }) { |
| ); | ||
| } | ||
|
|
||
| export function Tools() { |
|
|
||
| def infer_field_type(name: str, values: list[str]) -> str: | ||
| lowered = name.lower() | ||
| if lowered in {"sex", "gender"}: |
There was a problem hiding this comment.
I'd moved this in a dict so the logic here never changes, we only have to maintain the dict.
The entire if statement :D
| survey.append(["type", "name", "label", "required"]) | ||
| survey.append(["start", "start", "Start", ""]) | ||
| survey.append(["end", "end", "End", ""]) | ||
| needs_sex = False |
| ) | ||
|
|
||
|
|
||
| def _error_message(exc: IasoHTTPError) -> str: |
There was a problem hiding this comment.
I've seen this in other places, let's make it reusable
| @@ -0,0 +1,355 @@ | |||
| id,org_unit_id | |||
There was a problem hiding this comment.
What are those org_unit ids ?
Where do them come from ?
There was a problem hiding this comment.
Isn't this one define already ?
| USE_S3 = env.bool("USE_S3", default=False) | ||
| # MCP is a core app (iaso.mcp), not a plugin. On in local/dev/tests. | ||
| # Production must set MCP_ENABLED=true explicitly. | ||
| MCP_ENABLED = env.bool("MCP_ENABLED", default=DEBUG or IN_TESTS) |
There was a problem hiding this comment.
I development I think you want to honor also the MCP_ENABLED and not magically start the mcp.
There was a problem hiding this comment.
note that it happen that I use DEBUG=true in prod to collect sql queries, don't want to have the MCP server starting or failing to start.
|
What problem is this PR solving?
Give Cursor / Claude a first-class IASO MCP on this Django process (JSON-RPC + OAuth), so agents can read/write IASO as the logged-in user.
Related JIRA tickets
IA-5394
Changes
iaso.mcp: JSON-RPC at/mcp, OAuth 2.1 + PKCE + DCR at/oauth/and/.well-known/.request.user(same DRF permissions). Writes needconfirm=true./mcp/(browser) vs tools JSON (MCP clients). Prod image nownpm run buildsiaso/mcp/frontend.MCP_ENABLED(on in DEBUG/tests and local compose; production must setMCP_ENABLED=true).How to test
MCP_ENABLED=true(already indocker-compose.yml).docker compose up.http://localhost:8081/mcp/— log in, catalog UI.http://localhost8081/mcp/(or ngrok) → Connect / OAuth.iaso_whoami, then a read (list_org_units). A write only after confirming url / user / account / project / source.docker compose run --rm iaso manage test iaso.mcpPrint screen / video
Notes
/mcpis Bearer-only (no session cookies)./mcp/me/is session GET.MEDIA_ROOT/mcp/+ packaged samples.xlsx_base64, tokens, passwords,json_body).Doc
iaso/mcp/README.md