A Python demonstration of using E2B with GitHub and Notion MCP (Model Context Protocol) servers, powered by the OpenAI Agents SDK.
This demo shows how to:
- Create an E2B sandbox with MCP server support
- Configure GitHub and Notion MCP servers
- Use the OpenAI Agents SDK to connect to E2B's MCP Gateway
- Build an AI agent that can interact with GitHub and Notion APIs
- Automate tasks across GitHub and Notion using natural language
- Python 3.13+
- uv package manager
- E2B API key from e2b.dev/dashboard
- OpenAI API key from platform.openai.com/api-keys
- GitHub Personal Access Token from github.com/settings/tokens
- Required scopes:
repo,read:user,read:org
- Required scopes:
- Notion Integration Token from notion.so/profile/integrations
- Remember to share pages/databases with your integration
-
Install uv Follow the instructions here to install uv.
-
Install dependencies
uv sync- Set up environment variables
Create a
.envfile in the root of the project with the following keys:
E2B_API_KEY=your_e2b_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
NOTION_TOKEN=your_notion_integration_token_here
GITHUB_TOKEN=your_github_personal_access_token_here
NEBIUS_API_KEY=your_nebius_api_key_here
Run the demo:
uv run main.pyThe demo will:
- Create an E2B sandbox with MCP servers configured
- Connect to the E2B MCP Gateway using the OpenAI Agents SDK
- Create an AI agent with access to GitHub and Notion tools
- Execute a sample task that:
- Lists your GitHub repositories
- Creates a Notion page summarizing your top 3 repositories by stars
The implementation uses:
- E2B Sandbox: Provides a secure, isolated environment for the MCP servers
- E2B MCP Gateway: Exposes GitHub and Notion MCP servers via HTTP
- OpenAI Agents SDK: Connects to the MCP Gateway using
MCPServerStreamableHttp - AI Agent: Uses Nebius token factory's models to understand tasks and call the appropriate MCP tools