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
7 changes: 0 additions & 7 deletions packages/agent0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
"@aws-sdk/client-bedrock-runtime": "^3.709.0",
"@mcp-ui/client": "^5.12.1",
"@modelcontextprotocol/sdk": "^1.19.1",
"@okta/okta-auth-js": "^7.14.0",
"atko-cross-app-access-sdk": "1.0.0-beta.2",
"axios": "^1.12.2",
"cookie-parser": "^1.4.7",
"dotenv": "^17.2.3",
"express": "4.18.2",
"express-session": "1.17.3",
"install": "^0.13.0",
"jose": "^6.1.0",
"jsonwebtoken": "^9.0.2",
"marked": "^16.4.0",
"npm": "^11.6.2",
"open": "^10.2.0",
"openid-client": "^5.7.1",
"zod": "^3.22.4"
},
Expand Down
51 changes: 1 addition & 50 deletions packages/agent0/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,40 +486,7 @@ function addMessageToDOM(text, type = 'assistant', data = null, saveToHistory =

const contentDiv = document.createElement('div');
contentDiv.className = 'message-content';

// Check if data contains MCP UI resources
if (data && data.resources) {
// Render MCP UI resources
let html = '<div class="mcp-ui-container">';
html += '<div class="mcp-ui-label">📦 MCP Resources:</div>';
data.resources.forEach((resource, index) => {
html += `<ui-resource-renderer id="renderer-${Date.now()}-${index}"></ui-resource-renderer>`;
});
html += '</div>';
contentDiv.innerHTML = html;

// After adding to DOM, set the resource properties
messageDiv.appendChild(contentDiv);
chatContainer.appendChild(messageDiv);

// Set resource data on each renderer
setTimeout(() => {
data.resources.forEach((resource, index) => {
const renderer = document.getElementById(`renderer-${Date.now()}-${index}`);
if (renderer) {
renderer.resource = resource;
renderer.addEventListener('onUIAction', (event) => {
console.log('UI Action:', event.detail);
handleUIAction(event.detail);
});
}
});
}, 0);

chatContainer.scrollTop = chatContainer.scrollHeight;
return;
}


if (data && data.todos) {
// Format todos nicely
let html = `<strong>Found ${escapeHtml(data.count)} todo(s):</strong><br><br>`;
Expand Down Expand Up @@ -600,22 +567,6 @@ function addMessageToDOM(text, type = 'assistant', data = null, saveToHistory =
chatContainer.scrollTop = chatContainer.scrollHeight;
}

// Handle UI actions from MCP UI components
function handleUIAction(action) {
console.log('Received UI action:', action);

// Display the action as a user message and process it
if (action.type === 'submit' || action.type === 'button_click') {
const actionMessage = action.value || action.label || 'Action triggered';
addMessage(`🎯 Action: ${actionMessage}`, 'user');

// Process the action as if it were a user message
if (action.value) {
processMessage(action.value);
}
}
}

// Process message with LLM
async function processMessage(message) {
try {
Expand Down
4 changes: 0 additions & 4 deletions packages/agent0/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ <h4>Raw ID Token (JWT)</h4>
</div>
</div>

<script type="module">
// Import MCP UI Web Component from served node_modules
import '/node_modules/@mcp-ui/client/ui-resource-renderer.wc.js';
</script>
<script src="app.js"></script>
</body>
</html>
25 changes: 0 additions & 25 deletions packages/agent0/public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -361,31 +361,6 @@ body {
opacity: 0.7;
}

/* MCP UI Resource Renderer Styles */
ui-resource-renderer {
display: block;
width: 100%;
min-height: 300px;
border: 1px solid #e0e0e0;
border-radius: 8px;
margin: 10px 0;
background: white;
}

.mcp-ui-container {
background: #f9f9f9;
padding: 10px;
border-radius: 8px;
margin: 10px 0;
}

.mcp-ui-label {
font-size: 12px;
color: #666;
margin-bottom: 5px;
font-weight: 600;
}

.input-container {
padding: 20px;
background: white;
Expand Down
3 changes: 0 additions & 3 deletions packages/agent0/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ export class AppServer {

// Serve static files (web UI)
const publicPath = path.join(__dirname, '..', 'public');
const nodeModulesPath = path.join(__dirname, '..', '..', 'node_modules');

this.app.use(express.static(publicPath));
this.app.use('/node_modules', express.static(nodeModulesPath));
}

// ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion packages/agent0/src/auth/okta-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class OktaAuthHelper {
});
} catch (error: any) {
console.error('Logout error:', error);
req.session.destroy((err) => {
req.session.destroy((_err) => {
res.redirect('/');
});
}
Expand Down
6 changes: 2 additions & 4 deletions packages/todo0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
"migrate:dev": "prisma migrate dev"
},
"devDependencies": {
"@types/express-session": "^1.17.10",
"@types/node": "^20.19.19",
"typescript": "^5.9.3"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.19.1",
"@okta/jwt-verifier": "^4.0.2",
"@okta/okta-auth-js": "^7.14.0",
"@prisma/client": "^6.16.3",
"axios": "^1.12.2",
"body-parser": "^2.2.0",
"dotenv": "^17.2.3",
"ejs": "^3.1.10",
"express": "^5.1.0",
"express-jwt": "^8.5.1",
"jwks-rsa": "^3.2.0",
"express-session": "^1.18.2",
"openid-client": "^5.7.1",
"prisma": "^6.16.3",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/todo0/src/app-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, '../views'));

// Logging middleware - must come first
app.use((req, res, next) => {
app.use((req, _res, next) => {
console.log(`[REQUEST] ${req.method} ${req.url}`);
console.log(`[REQUEST] Path: ${req.path}`);
// Only log headers (contains Authorization, Cookie) in debug mode
Expand Down
2 changes: 1 addition & 1 deletion packages/todo0/src/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function getClientConfig(config: AuthConfig): Promise<Client> {
}

export function createAuthRouter(config: AuthConfig): Router {
const { oktaIssuer, oktaClientId, oktaClientSecret, oktaRedirectUri } = config;
const { oktaIssuer, oktaClientId, oktaRedirectUri } = config;

console.log('🔐 Okta Auth Configuration:');
console.log(` Issuer: ${oktaIssuer}`);
Expand Down
Loading