skills/building-agent-mcp-server/SKILL.md
Guides developers through creating a Scalekit MCP server with authenticated tool access. Use when building an MCP server, exposing Scalekit tools over MCP, or connecting AI agents via LangChain/LangGraph MCP adapters.
npx skillsauth add scalekit-inc/skills building-agent-mcp-serverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scalekit lets you build MCP servers that manage authentication, create personalized access URLs for users, and define which tools are accessible. You can also bundle several toolkits (e.g., Gmail + Google Calendar) within a single server.
Model Context Protocol (MCP) is an open-source standard that enables AI systems to interface with external tools and data sources. Where the integrating-agent-auth skill uses the SDK directly, this workflow exposes Scalekit tools over the MCP protocol so any compliant client — LangChain, Claude Desktop, MCP Inspector — can consume them.
Note: Agent Auth MCP servers only support Streamable HTTP transport.
langchain-mcp-adapters and invokes the toolsSCALEKIT_CLIENT_ID, SCALEKIT_CLIENT_SECRET, SCALEKIT_ENV_URLOPENAI_API_KEYGmail is the only connector that does not require dashboard setup. All other connectors (including Google Calendar) must be created in the Scalekit Dashboard before use:
Go to Scalekit Dashboard → Agent Auth → Connections → + Create Connection → Select connector → Set
Connection Name→ Save
Important: The Connection Name you set in the dashboard is exactly what you use as the
connection_nameparameter in your code. They must match exactly.
For this example, create the Google Calendar connector:
Connection Name = MY_CALENDAR → SaveInstall dependencies:
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.3
Add these imports to main.py:
import os
import asyncio
from dotenv import load_dotenv
import scalekit.client
from scalekit.actions.models.mcp_config import McpConfigConnectionToolMapping
from scalekit.actions.types import GetMcpInstanceAuthStateResponse
from langgraph.prebuilt import create_react_agent
from langchain_mcp_adapters.client import MultiServerMCPClient
Set the OpenAI key in your environment:
export OPENAI_API_KEY=xxxxxx
Initialize the Scalekit client:
load_dotenv()
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.mcp
Define the MCP config with connection_tool_mappings — each entry maps a connector to the tools it exposes:
cfg_response = my_mcp.create_config(
name="reminder-manager",
description="Summarizes latest email and creates a reminder event",
connection_tool_mappings=[
# Gmail works directly — no dashboard setup required
McpConfigConnectionToolMapping(
connection_name="gmail",
tools=[
"gmail_fetch_mails",
],
),
# Google Calendar must be created in dashboard first
McpConfigConnectionToolMapping(
connection_name="MY_CALENDAR",
tools=[
"googlecalendar_create_event",
],
),
],
)
config_name = cfg_response.config.name
Create a server instance for a specific user (john-doe). Each user gets their own instance URL:
inst_response = my_mcp.ensure_instance(
config_name=config_name,
user_identifier="john-doe",
)
mcp_url = inst_response.instance.url
print("Instance URL:", mcp_url)
Retrieve auth state and print any OAuth links the user needs to visit:
auth_state_response = my_mcp.get_instance_auth_state(
instance_id=inst_response.instance.id,
include_auth_links=True,
)
for conn in getattr(auth_state_response, "connections", []):
print(
"Connection:", conn.connection_name,
" Provider:", conn.provider,
" Auth Link:", conn.authentication_link,
" Status:", conn.connected_account_status,
)
Note: Open every printed auth link in a browser and complete OAuth before proceeding to Step 4.
Use MultiServerMCPClient with streamable_http transport, load the tools, and run the agent:
async def main():
client = MultiServerMCPClient(
{
"reminder_demo": {
"transport": "streamable_http",
"url": mcp_url,
},
}
)
tools = await client.get_tools()
agent = create_react_agent("openai:gpt-4.1", tools)
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(response)
asyncio.run(main())
Note — MCP client compatibility: You can test this MCP server with popular clients like MCP Inspector, Claude Desktop, and other spec-compliant implementations. Note that ChatGPT's beta connector feature may not work properly as it's still in beta and doesn't fully adhere to the MCP specification yet.
Full working example: github.com/scalekit-inc/python-connect-demos/tree/main/mcp
tools
Create or review Scalekit custom providers/connectors for proxy-only usage, including MCP providers. Use this skill when the task is to gather API docs, infer whether a connector is OAuth, Basic, Bearer, or API Key, determine if it is an MCP provider, determine required tracked fields like domain or version, generate provider JSON, check for existing custom providers, show update diffs, run approved create or update curls, and print resolved delete curls.
tools
Use when a developer is new to Scalekit and needs guidance on where to start, doesn't know which auth plugin or skill to choose, wants to connect an AI agent or agentic workflow to third-party services (Gmail, Slack, Notion, Google Calendar), needs OAuth or tool-calling auth for agents, wants to add authentication to a project but hasn't chosen an approach yet, or needs to install the Scalekit plugin for their AI coding tool (Claude Code, Codex, Copilot CLI, Cursor, or other agents).
tools
Use when a user asks to generate, review, validate, or fix any code snippet that uses Scalekit APIs or SDKs. This skill is the single source of truth for Scalekit code correctness — it can generate illustration-quality snippets from scratch (for docs, websites, or integration guides) and review existing code to catch wrong method names, missing parameters, security anti-patterns, and broken auth flows. Covers all four SDKs (Node, Python, Go, Java), raw REST API calls, and both Scalekit product suites — SaaSKit (SSO, login, sessions, RBAC, SCIM) and AgentKit (connections, tool calling, MCP auth). Use when the user says review my Scalekit code, generate a Scalekit example, validate this auth flow, check my SDK usage, fix my Scalekit integration, write a code sample for docs, or anything involving Scalekit code quality.
development
Walks through a structured production readiness checklist for Scalekit SSO implementations. Use when the user says they are going live, launching to production, doing a pre-launch review, hardening their SSO setup, or wants to verify their Scalekit implementation is production-ready.