Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mcp #478

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Mcp #478

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
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@
"ideas",
"maintenance"
]
},
{
"login": "suhail-ak-s",
"name": "Suhail AK",
"avatar_url": "https://avatars.githubusercontent.com/u/157091287?v=4",
"profile": "https://github.com/suhail-ak-s",
"contributions": [
"code"
]
},
{
"login": "anna-mariakv",
"name": "Anna Maria",
"avatar_url": "https://avatars.githubusercontent.com/u/157091287?v=4",
"profile": "https://github.com/anna-mariakv",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
85 changes: 85 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@floating-ui/react": "^0.26.1",
"@ironclad/rivet-core": "workspace:^",
"@ironclad/trivet": "workspace:^",
"@modelcontextprotocol/sdk": "^1.5.0",
"@recoiljs/refine": "^0.1.1",
"@swc/core": "^1.3.94",
"@tanstack/react-query": "^5.4.3",
Expand Down
Binary file added packages/app/src/assets/node_images/mcp_node.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/app/src/hooks/useBuiltInNodeImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import toMarkdownTableNodeImage from '../assets/node_images/to_markdown_table_no
import cronNodeImage from '../assets/node_images/cron_node.png';
import loopUntilNodeImage from '../assets/node_images/loop_until_node.png';
import toTreeNode from '../assets/node_images/to_tree_node.png';
import mcpNodeImage from '../assets/node_images/mcp_node.png';

export const useBuiltInNodeImages = (): Record<BuiltInNodeType, string> => {
return {
Expand Down Expand Up @@ -161,5 +162,6 @@ export const useBuiltInNodeImages = (): Record<BuiltInNodeType, string> => {
cron: cronNodeImage,
loopUntil: loopUntilNodeImage,
toTree: toTreeNode,
mcp: mcpNodeImage,
};
};
105 changes: 105 additions & 0 deletions packages/app/src/mocks/node-polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Mock implementation for node:child_process
export const spawn = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we don't need this file any more?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it came back

throw new Error('child_process.spawn is not supported in browser environment');
};

const process = {
env: {},
platform: 'browser',
cwd: () => '/',
versions: {
node: '0.0.0',
},
};

export default process;

export const fs = {
readFileSync: () => {
throw new Error('fs.readFileSync is not supported in browser environment');
},
writeFileSync: () => {
throw new Error('fs.writeFileSync is not supported in browser environment');
},
};

export const path = {
join: (...paths: string[]) => paths.join('/'),
resolve: (...paths: string[]) => paths.join('/'),
dirname: (path: string) => path.split('/').slice(0, -1).join('/'),
};

export const os = {
platform: () => 'browser',
homedir: () => '/',
};

export const stream = {
Readable: class {
pipe() { return this; }
},
Writable: class {},
Transform: class {},
};

export const util = {
promisify: (fn: Function) => fn,
};

export const events = {
EventEmitter: class {
on() {}
emit() {}
},
};

export const buffer = {
Buffer: {
from: () => new Uint8Array(),
},
};

export const crypto = {
randomBytes: () => new Uint8Array(),
createHash: () => ({
update: () => ({
digest: () => '',
}),
}),
};

export const querystring = {
stringify: (obj: any) => new URLSearchParams(obj).toString(),
parse: (str: string) => Object.fromEntries(new URLSearchParams(str)),
};

export const url = {
parse: (urlStr: string) => new URL(urlStr),
resolve: (from: string, to: string) => new URL(to, from).toString(),
};

export const http = {
request: () => {
throw new Error('http.request is not supported in browser environment');
},
};

export const https = {
request: () => {
throw new Error('https.request is not supported in browser environment');
},
};

export const net = {
Socket: class {},
};

export const tls = {
connect: () => {
throw new Error('tls.connect is not supported in browser environment');
},
};

export const assert = {
ok: () => {},
};
12 changes: 12 additions & 0 deletions packages/app/src/model/native/TauriNativeApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readDir, BaseDirectory, readTextFile, readBinaryFile, writeFile, type FileEntry } from '@tauri-apps/api/fs';
import { resolveResource } from '@tauri-apps/api/path';
import { type BaseDir, type NativeApi, type ReadDirOptions } from '@ironclad/rivet-core';

import { minimatch } from 'minimatch';
Expand Down Expand Up @@ -87,4 +88,15 @@ export class TauriNativeApi implements NativeApi {
async exec(command: string, args: string[], options?: { cwd?: string | undefined } | undefined): Promise<void> {
throw new Error('Method not implemented.');
}

async resolveBaseDir(baseDir?: BaseDir, path?: string): Promise<string> {
if (!baseDir || !path) {
return path ?? '';
}
const baseDirectory = baseDirToBaseDirectory(baseDir);
if (!baseDirectory) {
throw new Error(`Unsupported base directory: ${baseDir}`);
}
return await resolveResource(path);
}
}
20 changes: 19 additions & 1 deletion packages/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,28 @@ export default defineConfig({
},
resolve: {
preserveSymlinks: true,

alias: {
'@ironclad/rivet-core': resolve('../core/src/index.ts'),
'@ironclad/trivet': resolve('../trivet/src/index.ts'),
'node:child_process': resolve('./src/mocks/node-polyfills.ts'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these added back in?

'node:process': resolve('./src/mocks/node-polyfills.ts'),
'child_process': resolve('./src/mocks/node-polyfills.ts'),
'process': resolve('./src/mocks/node-polyfills.ts'),
'fs': resolve('./src/mocks/node-polyfills.ts'),
'path': resolve('./src/mocks/node-polyfills.ts'),
'os': resolve('./src/mocks/node-polyfills.ts'),
'stream': resolve('./src/mocks/node-polyfills.ts'),
'util': resolve('./src/mocks/node-polyfills.ts'),
'events': resolve('./src/mocks/node-polyfills.ts'),
'buffer': resolve('./src/mocks/node-polyfills.ts'),
'crypto': resolve('./src/mocks/node-polyfills.ts'),
'querystring': resolve('./src/mocks/node-polyfills.ts'),
'url': resolve('./src/mocks/node-polyfills.ts'),
'http': resolve('./src/mocks/node-polyfills.ts'),
'https': resolve('./src/mocks/node-polyfills.ts'),
'net': resolve('./src/mocks/node-polyfills.ts'),
'tls': resolve('./src/mocks/node-polyfills.ts'),
'assert': resolve('./src/mocks/node-polyfills.ts'),
},
},
build: {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
"@google-cloud/vertexai": "^0.1.3",
"@google/generative-ai": "^0.21.0",
"@huggingface/inference": "^2.6.4",
"@modelcontextprotocol/sdk": "^1.5.0",
"@tauri-apps/api": "^1.5.3",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core cannot depend on tauri

"assemblyai": "^4.6.0",
"autoevals": "^0.0.26",
"cron-parser": "^4.9.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/model/Nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ export * from './nodes/ToTreeNode.js';
import { loopUntilNode } from './nodes/LoopUntilNode.js';
export * from './nodes/LoopUntilNode.js';

import { mcpNode } from './nodes/MCPNode.js';
export * from './nodes/MCPNode.js';

export const registerBuiltInNodes = (registry: NodeRegistration) => {
return registry
.register(toYamlNode)
Expand Down Expand Up @@ -318,7 +321,8 @@ export const registerBuiltInNodes = (registry: NodeRegistration) => {
.register(toMarkdownTableNode)
.register(cronNode)
.register(toTreeNode)
.register(loopUntilNode);
.register(loopUntilNode)
.register(mcpNode);
};

let globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
Expand Down
Loading