{"id":50871485,"url":"https://github.com/e2b-dev/mcp-gateway-demo","last_synced_at":"2026-06-15T05:35:06.096Z","repository":{"id":362379829,"uuid":"1074302335","full_name":"e2b-dev/mcp-gateway-demo","owner":"e2b-dev","description":"E2B MCP Gateway Demo","archived":false,"fork":false,"pushed_at":"2025-11-20T15:27:29.000Z","size":71,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T05:35:04.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e2b-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-11T14:33:41.000Z","updated_at":"2026-01-17T08:10:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/e2b-dev/mcp-gateway-demo","commit_stats":null,"previous_names":["e2b-dev/mcp-gateway-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/e2b-dev/mcp-gateway-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fmcp-gateway-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fmcp-gateway-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fmcp-gateway-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fmcp-gateway-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e2b-dev","download_url":"https://codeload.github.com/e2b-dev/mcp-gateway-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fmcp-gateway-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34349925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-15T05:35:05.139Z","updated_at":"2026-06-15T05:35:06.087Z","avatar_url":"https://github.com/e2b-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Gateway Demo\n\nA demonstration of using Model Context Protocol (MCP) servers with E2B sandboxes and Mastra agents. This project showcases how to run MCP servers in secure E2B sandboxes and integrate them with AI agents.\n\n## What This Does\n\nThis demo creates an AI agent that can access MCP servers (like Context7 for documentation) running inside an E2B sandbox. The agent can then use the tools provided by these MCP servers to answer questions.\n\n## Prerequisites\n\nBefore getting started, you'll need:\n\n- [Bun](https://bun.sh/) installed (or Node.js)\n- An [E2B API key](https://e2b.dev/docs/getting-started/api-key)\n- An OpenAI API key\n\n## Getting Started\n\n### 1. Clone and Install\n\n```bash\n# Install dependencies\nbun install\n```\n\n### 2. Set Up Environment Variables\n\nCreate a `.env` file in the project root:\n\n```bash\n# E2B API key for sandbox creation\nE2B_API_KEY=your_e2b_api_key\n\n# OpenAI API key for the agent\nOPENAI_API_KEY=your_openai_api_key\n```\n\n### 3. Run the Demo\n\n```bash\nbun run index.ts\n```\n\nThe demo will:\n1. Create an E2B sandbox with the Context7 MCP server\n2. Initialize a Mastra agent with access to the MCP tools\n3. Ask the agent \"How to create an E2B Sandbox?\"\n4. Display the agent's response\n\n## How It Works\n\n### Architecture\n\n```\n┌─────────────┐\n│ Mastra Agent│\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│ MCP Client  │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│ E2B Sandbox │\n│  ┌────────┐ │\n│  │Context7│ │\n│  │  MCP   │ │\n│  └────────┘ │\n└─────────────┘\n```\n\n1. **E2B Sandbox**: Provides a secure, isolated environment for MCP servers\n2. **MCP Client**: Connects to the MCP servers through the E2B gateway\n3. **Mastra Agent**: Uses the MCP tools to answer questions\n\n### Key Files\n\n- `index.ts` - Main entry point, creates the agent and runs a query\n- `mcp.ts` - Sets up the E2B sandbox with MCP servers and creates the MCP client\n\n## Customizing\n\n### Adding More MCP Servers\n\nEdit the `servers` configuration in `index.ts`:\n\n```typescript\nconst servers: McpServer = {\n  context7: {},\n  // Add more MCP servers here\n  // Example:\n  // filesystem: {\n  //   args: [\"/path/to/directory\"]\n  // }\n};\n```\n\n### Changing the Agent\n\nModify the agent configuration in `index.ts`:\n\n```typescript\nconst agent = new Agent({\n  name: \"DocsAgent\",\n  instructions: \"Your custom instructions here\",\n  model: \"openai/gpt-4o\", // or another model\n  tools: await E2BMCPClient.getTools(),\n});\n```\n\n### Running Different Queries\n\nUpdate the query in `index.ts`:\n\n```typescript\nconst result = await agent.generate(\"Your question here\");\n```\n\n## Learn More\n\n- [E2B Documentation](https://e2b.dev/docs)\n- [Mastra Documentation](https://mastra.ai/docs)\n- [MCP Protocol](https://modelcontextprotocol.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2b-dev%2Fmcp-gateway-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe2b-dev%2Fmcp-gateway-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2b-dev%2Fmcp-gateway-demo/lists"}