Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ workspace, run `./tcx doctor`, and perform the documented Codex CLI smoke.
mandate and dynamically dispatch exact fixed roles from accepted evidence;
Django does not replace that with a semantic router, preset team, stored DAG,
or generic-agent fallback.
- Treat user-installed MCP servers, skills, plugins, apps, and hooks as BYOR
native Codex capabilities. TradingCodex may inventory sanitized metadata but
must not install, recommend, classify, proxy, approve, disable, or delete
them, and must not claim license, trust, audit, cost, or execution guarantees
for their behavior.
- Generated workspaces remain Node-free. Node is only a maintainer dependency
under `frontend/`; do not add a production Node server or run npm from
`tcx attach` or `tcx update`.
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Unreleased

## 1.1.1 - 2026-07-16

- Remove the legacy user-capability gate, its CLI and broker-import paths,
and its active database tables. User-installed MCP servers, skills, plugins,
apps, and hooks now remain BYOR native Codex capabilities for root and fixed
agents. Add a secret-free read-only capability inventory to MCP and System,
preserve non-reserved user Codex configuration across update, and keep all
TradingCodex principals, grants, protected proofs, and order effects behind
the existing service boundary.

## 1.1.0 - 2026-07-16

- Make managed skill invocation resilient without weakening authority: Build,
Expand Down Expand Up @@ -168,8 +178,8 @@
user-terminal handoffs instead of attempting a blocked model shell.
- Replace agent-side connector `connect`/write-style scaffold MCP operations
with read-only, content-addressed scaffold rendering plus native patching.
External MCP lifecycle/consent and provider-source approval remain
interactive operator actions protected by one-use service capabilities.
Provider-source approval remains an interactive operator action protected by
a one-use service capability.
- Add the explicit-only `tcx-order-allow` bundle and `OrderTurnGrant`: only a
physical first line `$tcx-order-allow --mode paper|validation|live` can admit one
later submit or cancel in that root turn. Grants bind workspace, session,
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,6 @@ needs revision, or is blocked.
| **Django service** | Enforces artifact identity, policy, approval, broker, idempotency, execution, and audit rules through shared application services. | It does not replace Codex with a semantic router, preset team, or stored workflow DAG. |
| **Read-only viewer** | Lets you browse Library artifacts, Skills, System posture, and registered workspaces. | It does not launch Codex, write workspace files, or mutate orders, brokers, skills, or policy. |

```mermaid
flowchart LR
question[Your mandate] --> codex[Native Codex task]
codex --> team[Head Manager and fixed-role evidence]
team --> artifacts[Authenticated research artifacts]
artifacts --> viewer[Read-only Library and System viewer]
artifacts --> service[Policy, approval, broker, and audit gates]
```

## What You Keep

TradingCodex keeps the work inspectable after the chat ends:
Expand All @@ -128,6 +119,11 @@ that state in prompts or workspace files.
- Fixed roles have bounded tools and handoff responsibilities. A final order
path is available only from an exact root-native protocol, never from the
viewer, a subagent, public REST, generic CLI, or direct MCP call.
- User-installed MCP servers, skills, and plugins are BYOR native Codex
capabilities. TradingCodex neither recommends nor verifies them; their
licenses, data terms, costs, and side effects remain the user/provider's
responsibility, and TradingCodex guarantees cover only its own capabilities,
state, and actions.
- Raw credentials do not belong in prompts, workspace files, reports, API/MCP
output, or audit data.

Expand Down
24 changes: 2 additions & 22 deletions apps/mcp/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
from django.contrib import admin

from apps.mcp.models import (
McpExternalPermissionRequest,
McpExternalTool,
McpExternalToolCall,
McpExternalToolPermission,
McpRouter,
McpToolCall,
McpToolDefinition,
)
from apps.mcp.models import McpToolCall, McpToolDefinition


class ReadOnlyAdmin(admin.ModelAdmin):
Expand All @@ -25,16 +17,4 @@ def has_delete_permission(self, request, obj=None) -> bool:
return False


@admin.register(McpRouter)
class McpRouterAdmin(ReadOnlyAdmin):
pass


admin.site.register([
McpToolDefinition,
McpToolCall,
McpExternalTool,
McpExternalToolPermission,
McpExternalPermissionRequest,
McpExternalToolCall,
], ReadOnlyAdmin)
admin.site.register([McpToolDefinition, McpToolCall], ReadOnlyAdmin)
22 changes: 22 additions & 0 deletions apps/mcp/migrations/0002_remove_external_mcp_gate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.db import migrations


def remove_gate_broker_connections(apps, schema_editor):
BrokerConnection = apps.get_model("integrations", "BrokerConnection")
BrokerConnection.objects.filter(provider_id="external-mcp", transport="mcp").delete()


class Migration(migrations.Migration):
dependencies = [
("integrations", "0001_v1_initial"),
("mcp", "0001_v1_initial"),
]

operations = [
migrations.RunPython(remove_gate_broker_connections, migrations.RunPython.noop),
migrations.DeleteModel(name="McpExternalPermissionRequest"),
migrations.DeleteModel(name="McpExternalToolCall"),
migrations.DeleteModel(name="McpExternalToolPermission"),
migrations.DeleteModel(name="McpExternalTool"),
migrations.DeleteModel(name="McpRouter"),
]
137 changes: 0 additions & 137 deletions apps/mcp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,140 +43,3 @@ class Meta:

def __str__(self) -> str:
return f"{self.tool_name} {self.status}"


class McpRouter(models.Model):
name = models.CharField(max_length=160, unique=True)
label = models.CharField(max_length=160, blank=True)
transport = models.CharField(max_length=32, default="stdio")
command = models.TextField(blank=True)
url = models.URLField(blank=True)
args = models.JSONField(default=list, blank=True)
env = models.JSONField(default=dict, blank=True)
credential_ref = models.CharField(max_length=255, blank=True)
trust_level = models.CharField(max_length=32, default="unreviewed")
enabled = models.BooleanField(default=False)
last_status = models.CharField(max_length=32, default="not_checked")
last_error = models.TextField(blank=True)
last_checked_at = models.DateTimeField(null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
ordering = ["name"]
verbose_name = "MCP router"
verbose_name_plural = "MCP routers"

def __str__(self) -> str:
return self.label or self.name


class McpExternalTool(models.Model):
router = models.ForeignKey(McpRouter, on_delete=models.CASCADE, related_name="external_tools")
primitive = models.CharField(max_length=32, default="tool")
external_name = models.CharField(max_length=200)
description = models.TextField(blank=True)
input_schema = models.JSONField(default=dict, blank=True)
output_schema = models.JSONField(default=dict, blank=True)
schema_hash = models.CharField(max_length=64, blank=True)
category = models.CharField(max_length=64, default="unknown")
risk_level = models.CharField(max_length=32, default="unknown")
sensitivity = models.CharField(max_length=32, default="unknown")
canonical_capability = models.CharField(max_length=160, blank=True)
proxy_mode = models.CharField(max_length=32, default="blocked")
allowed_roles = models.JSONField(default=list, blank=True)
conditions = models.JSONField(default=dict, blank=True)
enabled = models.BooleanField(default=False)
review_status = models.CharField(max_length=32, default="review_required")
drift_detected = models.BooleanField(default=False)
last_seen_at = models.DateTimeField(null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
ordering = ["router__name", "primitive", "external_name"]
constraints = [
models.UniqueConstraint(fields=["router", "primitive", "external_name"], name="unique_external_mcp_primitive")
]
verbose_name = "external MCP tool"
verbose_name_plural = "external MCP tools"

def __str__(self) -> str:
return f"{self.router.name}:{self.external_name}"


class McpExternalToolPermission(models.Model):
external_tool = models.ForeignKey(McpExternalTool, on_delete=models.CASCADE, related_name="permissions")
principal_or_role = models.CharField(max_length=128)
capability = models.CharField(max_length=160, blank=True)
decision = models.CharField(max_length=16, default="allow")
conditions = models.JSONField(default=dict, blank=True)
enabled = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
ordering = ["external_tool__external_name", "principal_or_role"]
constraints = [
models.UniqueConstraint(
fields=["external_tool", "principal_or_role", "capability"],
name="unique_external_mcp_permission",
)
]
verbose_name = "external MCP permission"
verbose_name_plural = "external MCP permissions"

def __str__(self) -> str:
return f"{self.external_tool.external_name} {self.principal_or_role} {self.decision}"


class McpExternalPermissionRequest(models.Model):
external_tool = models.ForeignKey(McpExternalTool, on_delete=models.SET_NULL, null=True, blank=True, related_name="permission_requests")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
router_name = models.CharField(max_length=160)
external_name = models.CharField(max_length=200)
principal_id = models.CharField(max_length=128, default="unknown")
role = models.CharField(max_length=128, blank=True)
workflow_run_id = models.CharField(max_length=160, blank=True)
request_hash = models.CharField(max_length=64)
arguments_summary = models.JSONField(default=dict, blank=True)
approval_scope = models.CharField(max_length=32, default="single_call")
status = models.CharField(max_length=32, default="pending")
reasons = models.JSONField(default=list, blank=True)
expires_at = models.DateTimeField(null=True, blank=True)
decided_by = models.CharField(max_length=128, blank=True)
decided_at = models.DateTimeField(null=True, blank=True)
decision_reason = models.TextField(blank=True)

class Meta:
ordering = ["-created_at", "-id"]
verbose_name = "external MCP permission request"
verbose_name_plural = "external MCP permission requests"

def __str__(self) -> str:
return f"{self.router_name}:{self.external_name} {self.status}"


class McpExternalToolCall(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
external_tool = models.ForeignKey(McpExternalTool, on_delete=models.SET_NULL, null=True, blank=True, related_name="calls")
router_name = models.CharField(max_length=160)
external_name = models.CharField(max_length=200)
principal_id = models.CharField(max_length=128, default="unknown")
proxy_mode = models.CharField(max_length=32, default="blocked")
decision = models.CharField(max_length=32, default="denied")
reasons = models.JSONField(default=list, blank=True)
request = models.JSONField(default=dict, blank=True)
response = models.JSONField(default=dict, blank=True)
request_hash = models.CharField(max_length=64, blank=True)
result_hash = models.CharField(max_length=64, blank=True)
workspace_context = models.JSONField(default=dict, blank=True)

class Meta:
ordering = ["-created_at", "-id"]
verbose_name = "external MCP tool call"
verbose_name_plural = "external MCP tool calls"

def __str__(self) -> str:
return f"{self.router_name}:{self.external_name} {self.decision}"
Loading