Local connections allow you to connect to Model Context Protocol (MCP) servers running on your local machine or within your local network. This is ideal for development, testing, and scenarios where you need faster performance or want to work offline.
The Model Context Protocol defines a standard way for AI applications to connect to external data sources and tools. MCP servers act as bridges between AI systems and various resources like databases, APIs, file systems, and more.For detailed information about the MCP specification, visit the official MCP documentation.
// Basic MCP server setupimport { Server } from '@modelcontextprotocol/sdk/server/index.js';import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';const server = new Server( { name: 'local-mcp-server', version: '1.0.0', }, { capabilities: { resources: {}, tools: {}, }, });// Start server with stdio transportconst transport = new StdioServerTransport();await server.connect(transport);