Quickstart
Model Context Protocol (MCP) is an open-source standard that enables AI systems to interface with external tools and data sources. In Scalekit, every available tool is also provided as an MCP server..
With Scalekit, you can build MCP servers that manage authentication, create personalized access URLs for users, and define which tools are accessible. You can also bundle several toolkits together within a single server.
What you’ll build
Section titled “What you’ll build”In this quickstart, we will:
- Create a simple MCP server that fetches your latest email and sets up a reminder calendar event
- Connect to this MCP server with langchain-openai
Prerequisites
Section titled “Prerequisites”Before you start, make sure you have:
- Scalekit API credentials: Go to your Scalekit Dashboard -> Settings (Left Nav) -> Copy the client_id and client_secret
- OpenAI API Key: Get your api-key
- Gmail and Google Calendar Active Connectors
- Gmail: Navigate to your Scalekit Dashboard -> Connections under Agent Actions (left nav) -> Create Connection -> Gmail -> Create ->
Connection Name = MY_GMAIL-> Save - Google Calendar: Navigate to your Scalekit Dashboard -> Connections under Agent Actions (left nav) -> Create Connection -> Google Calendar -> Create ->
Connection Name = MY_CALENDAR-> Save
- Gmail: Navigate to your Scalekit Dashboard -> Connections under Agent Actions (left nav) -> Create Connection -> Gmail -> Create ->
Step 1: Set up your environment
Section titled “Step 1: Set up your environment”pip install scalekit-sdk-python langgraph>=0.6.5 langchain-mcp-adapters>=0.1.9 python-dotenv>=1.0.1 openai>=1.53.0 requests>=2.32.3Add these imports to your main.py
import osimport asynciofrom dotenv import load_dotenvimport scalekit.clientfrom scalekit.actions.models.mcp_config import McpConfigConnectionToolMappingfrom scalekit.actions.types import (GetMcpInstanceAuthStateResponse)from langgraph.prebuilt import create_react_agentfrom langchain_mcp_adapters.client import MultiServerMCPClientSet OpenAI API Key for your development environment
export OPENAI_API_KEY=xxxxxxInitialize Scalekit Client
scalekit = scalekit.client.ScalekitClient( client_id=os.getenv("SCALEKIT_CLIENT_ID"), client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"), env_url=os.getenv("SCALEKIT_ENV_URL"),)my_mcp = scalekit.actions.mcpStep 2: Create an MCP Server and authenticate the user
Section titled “Step 2: Create an MCP Server and authenticate the user”Create an MCP config
cfg_response = my_mcp.create_config( name="reminder-manager", description="Summarizes latest email and creates a reminder event", connection_tool_mappings=[ McpConfigConnectionToolMapping( connection_name="MY_GMAIL", tools=[ "gmail_fetch_mails", ], ), McpConfigConnectionToolMapping( connection_name="MY_CALENDAR", tools=[ "googlecalendar_create_event", ], ), ],)Create an MCP server instance for a specific user john-doe using this mcp-config
inst_response = my_mcp.ensure_instance( config_name=config_name, user_identifier="john-doe",)print("Instance url:", inst_response.instance.url)Generate Authenticate links for john-doe
auth_state_response = my_mcp.get_instance_auth_state( instance_id=instance_response.instance.id, include_auth_links=True,)for conn in getattr(auth_state_response, "connections", []): print("Connection Name:", conn.connection_name, " Provider: ", conn.provider, " Auth Link: ", conn.authentication_link, "Auth Status: ", conn.connected_account_status)Step 3: Connect to your MCP server
Section titled “Step 3: Connect to your MCP server”client = MultiServerMCPClient( { "reminder_demo": { "transport": "streamable_http", "url": mcp_url }, })tools = await client.get_tools()agent = create_react_agent("openai:gpt-4.1", tools)openai_response = await agent.ainvoke({"messages": "get 1 latest email and create a calendar reminder event in next 15 mins for a duration of 15 mins."})print(openai_response)You have successfully created your mcp server. Full code can be found at Github