Model Context Protocol (MCP) integration
Section titled āModel Context Protocol (MCP) integrationāConnect external Model Context Protocol (MCP) servers to your Antigravity SDK agents.
In Python applications built using the Antigravity SDK, MCP servers (stdio or
Streamable HTTP) are connected programmatically under a unified execution
pipeline alongside built-in tools and custom Python functions.
Programmatic MCP server setup
Section titled āProgrammatic MCP server setupāYou can define MCP servers programmatically in your applicationās
LocalAgentConfig using McpStdioServer or McpStreamableHttpServer.
For example, you can configure an agent to connect to an external SQLite MCP
server using stdio:
import asyncio
from google.antigravity import Agent, LocalAgentConfig
from google.antigravity.types import McpStdioServer
config = LocalAgentConfig(
mcp_servers=[
McpStdioServer(
name="sqlite-explorer",
command="node",
args=["/usr/local/bin/sqlite-mcp-server.js"],
env={"SQLITE_DB_PATH": "/var/data/app.db"},
)
]
)
async def main():
async with Agent(config) as agent:
response = await agent.chat("Query database metrics.")
print(await response.text())
if __name__ == "__main__":
asyncio.run(main())
For more details on MCP protocol capabilities across the Antigravity suite, check out the central Model Context Protocol guide.
Sample code
Section titled āSample codeāFor full working code examples, check out the GitHub repository: