MCP Integration
Trinity's MCP server exposes 62 tools for agent orchestration via the Model Context Protocol, enabling programmatic control from Claude Code, other MCP clients, or agent-to-agent communication.
Overview
The Model Context Protocol (MCP) is an open standard for tool-based AI integrations. Trinity implements an MCP server using FastMCP with Streamable HTTP transport on port 8080. API keys authenticate access and can be scoped to specific agents.
Authentication
Go to the API Keys page (/api-keys).
Click Create Key. Optionally scope the key to a specific agent.
Copy the generated key (prefixed trinity_mcp_*).
Use the key as a Bearer token in the Authorization header.
Connecting from Claude Code
Add Trinity as an MCP server in your Claude Code configuration:
{
"mcpServers": {
"trinity": {
"type": "url",
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer <your-api-key>"
}
}
}
}Tool Categories
The MCP server organizes 62 tools across these modules:
| Module | Tools | Description |
|---|---|---|
| agents.ts | 17 | Agent lifecycle, credentials, SSH, local deploy, GitHub sync |
| chat.ts | 3 | Chat, history, logs |
| schedules.ts | 8 | Schedule CRUD and execution history |
| executions.ts | 3 | Execution queries, async polling, activity monitoring |
| skills.ts | 7 | Skill management and assignment |
| tags.ts | 5 | Agent tagging |
| systems.ts | 4 | System manifest deployment |
| subscriptions.ts | 6 | Subscription management |
| monitoring.ts | 3 | Fleet health |
| nevermined.ts | 4 | Payment configuration |
| notifications.ts | 1 | Agent notifications |
| events.ts | 4 | Event pub/sub |
| docs.ts | 1 | Agent documentation |
API Key Management
| Endpoint | Method | Description |
|---|---|---|
| /api/mcp/keys | POST | Create API key |
| /api/mcp/keys | GET | List API keys |
| /api/mcp/keys/{key_id} | DELETE | Revoke API key |
Nevermined x402 Payments
Monetize agents with per-request payments using the Nevermined x402 payment protocol. Users pay per chat message; agents earn credits.
Setup
Open the agent detail page and navigate to payment settings.
Enter the NVM API Key, Agent ID, and Plan ID from Nevermined.
Enable payments. The agent now has a paid chat endpoint: POST /api/paid/{agent_name}/chat.
Payment Flow
Client -> POST /api/paid/{agent}/chat (no token)
<- 402 Payment Required (includes payment info)
Client -> Purchases credits via Nevermined checkout page
Client -> POST /api/paid/{agent}/chat (payment-signature header)
<- 200 OK (agent response, 1 credit deducted)Payment API
| Endpoint | Method | Description |
|---|---|---|
| /api/paid/{agent_name}/chat | POST | Paid chat (returns 402/403/200) |
| /api/paid/{agent_name}/info | GET | Payment requirements (no auth) |
| /api/nevermined/agents/{name}/config | POST/GET/DELETE | Configure payment settings |
| /api/nevermined/agents/{name}/config/toggle | PUT | Enable or disable payments |