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 3 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
87 changes: 87 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.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
},
"dependencies": {
"@ironclad/rivet-core": "workspace:^",
"@ironclad/rivet-node": "workspace:^"
"@ironclad/rivet-node": "workspace:^",
"@modelcontextprotocol/sdk": "^1.5.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add this to the individual packages, not the root package.json

Copy link
Author

Choose a reason for hiding this comment

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

removed

},
"dependenciesMeta": {
"@pnpm/[email protected]": {
Expand Down
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have a better node body? Maybe it's just the example, but a blank body doesn't seem very helpful?

Copy link
Author

Choose a reason for hiding this comment

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

updated

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,
};
};
116 changes: 116 additions & 0 deletions packages/app/src/mocks/node-polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// 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');
},
// Add other fs methods as needed
};

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

export const os = {
platform: () => 'browser',
homedir: () => '/',
// Add other os methods as needed
};

export const stream = {
Readable: class {
pipe() { return this; }
},
Writable: class {},
Transform: class {},
// Add other stream classes as needed
};

export const util = {
promisify: (fn: Function) => fn,
// Add other util methods as needed
};

export const events = {
EventEmitter: class {
on() {}
emit() {}
// Add other EventEmitter methods as needed
},
};

export const buffer = {
Buffer: {
from: () => new Uint8Array(),
// Add other Buffer methods as needed
},
};

export const crypto = {
randomBytes: () => new Uint8Array(),
createHash: () => ({
update: () => ({
digest: () => '',
}),
}),
// Add other crypto methods as needed
};

// Export other Node.js module mocks as needed
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 {},
// Add other net methods as needed
};

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

export const assert = {
ok: () => {},
// Add other assert methods as needed
};
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);
}
}
24 changes: 23 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 All @@ -34,6 +52,10 @@ export default defineConfig({
plugins: [visualizer()],
},
},
define: {
'process.env': {},
'global': {},
},
plugins: [
react(),
viteTsconfigPaths(),
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
Loading