API - CODEX AGENTS: MCP transport and real e2e smoke

This commit is contained in:
DCCONSTRUCTIONS
2026-05-14 20:01:14 +03:00
parent 418914fefd
commit c9519b52d2
12 changed files with 1306 additions and 227 deletions
+6 -2
View File
@@ -23,7 +23,7 @@ Exit criteria:
## Phase 1. Agent Gateway skeleton
Status: in progress. Initial service, migrations, persistence endpoints, token hashing, bearer-token session auth, product tool endpoints, local Postgres compose, and Gateway smoke checks are implemented.
Status: done in `e95cb3a`, `112522c`, `14c5f49`, `9f40207`, and the MCP transport slice. Initial service, migrations, persistence endpoints, token hashing, bearer-token session auth, product tool endpoints, local Postgres compose, and Gateway smoke checks are implemented.
Create standalone service with:
@@ -36,7 +36,7 @@ Create standalone service with:
- opaque token hashing;
- idempotency-key storage.
No Tasker writes yet.
Tasker writes are available through the narrow internal adapter; Gateway still must not call raw Plane routes.
## Phase 2. Launcher entitlement projection
@@ -89,6 +89,8 @@ Acceptance:
- adapter rejects delete/archive;
- adapter validates labels/states/assignees.
Status: initial product slice done in Tasker commit `2ae353c`. Implemented project resolution/context, issue search/create/update/move/comment/label/assign, agent bot actor metadata, and internal token auth. `add_existing_project_member` remains planned behind the explicit `project:member:add_existing` scope.
## Phase 5. MCP server
Agent Gateway changes:
@@ -109,6 +111,8 @@ Acceptance:
- local Codex can move card state;
- local Codex cannot delete/archive.
Status: initial product slice implemented. `/mcp` supports JSON-RPC `initialize`, `ping`, `tools/list`, and `tools/call`. REST product endpoints and MCP tools share the same runtime, scope checks, grant checks, and Tasker adapter calls. `npm run smoke:mcp:e2e` verifies real local Tasker writes.
## Phase 6. Agent identity
Tasker/Gateway integration:
+22
View File
@@ -8,6 +8,14 @@ The current Tasker / Plane fork does not expose a dedicated MCP server. It expos
Codex should not call generic Tasker REST directly.
Current implementation status:
- Agent Gateway exposes `/mcp` as JSON-RPC over HTTP.
- Implemented MCP methods: `initialize`, `ping`, `tools/list`, `tools/call`.
- `tools/list` returns only tools allowed by the authenticated agent session scopes.
- `tools/call` uses the same product runtime as REST tool endpoints.
- Server-sent event streaming is intentionally not required for the first product slice.
## Authentication
MCP clients authenticate to Agent Gateway with an opaque agent token.
@@ -18,6 +26,20 @@ Recommended transport options:
- local stdio connector later if useful;
- REST fallback for non-MCP clients.
Current route:
```text
POST /mcp
```
Required request headers for authenticated tool calls:
```text
Authorization: Bearer <agent-token>
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2025-06-18
```
Token rules:
- token is opaque;
+24
View File
@@ -140,6 +140,30 @@ Add internal endpoints under a namespace such as:
/api/internal/nodedc/agent/...
```
Current implemented adapter routes:
```text
POST /api/internal/nodedc/agent/projects/resolve
GET /api/internal/nodedc/agent/projects/:project_id/context
GET /api/internal/nodedc/agent/issues?project_id=...
POST /api/internal/nodedc/agent/issues
PATCH /api/internal/nodedc/agent/issues/:issue_id
POST /api/internal/nodedc/agent/issues/:issue_id/move
POST /api/internal/nodedc/agent/issues/:issue_id/comments
PUT /api/internal/nodedc/agent/issues/:issue_id/labels
PUT /api/internal/nodedc/agent/issues/:issue_id/assignees
```
The implemented adapter uses NODE.DC internal bearer auth and receives normalized agent metadata in headers:
```text
X-NODEDC-Agent-Id
X-NODEDC-Agent-Owner-User-Id
X-NODEDC-Agent-Token-Id
```
The current adapter creates or reuses a dedicated bot actor with email `agent+<agent_id>@agents.nodedc.local` and `bot_type=nodedc_codex_agent`.
These endpoints must use `NODEDC_INTERNAL_ACCESS_TOKEN` / `PLANE_NODEDC_ACCESS_TOKEN` style auth and must be callable only from Agent Gateway.
Suggested adapter endpoints: