What are Connectors?
A connector is a local MCP server exposed by the Agent Stack that acts as a proxy to a remote hosted MCP server and handles authentication. It allows users to set up a connection to a third-party service (like GitHub, Box etc.) and then exposes a local MCP server that can be consumed by agents. This architecture eliminates the need for user authentication in your agent code. The connector handles authentication with the third-party service on behalf of the authenticated user, and the MCP interface is properly scoped to that user’s permissions and data. Users can work with connectors in two ways via the Agent Stack UI:- Connect an existing connector: Go through an OAuth flow to obtain an authentication token for a pre-registered connector.
- Register a custom connector: Provide OAuth client ID, client secret, and URL to register their own service as a connector, then connect it.
MCP Service Extension
The MCP Service Extension provides a standardized way for your agents to access MCP servers (connectors) without managing connection details, authentication, or URLs manually. The extension automatically matches your agent’s MCP requirements with available connectors and provides you with a ready-to-use MCP client session, eliminating the need for manual configuration. One of the key features of Agent Stack’s MCP integration is automatic connector matching. When you specify a suggested connector name in your agent, the platform automatically:- Searches for connected connectors with matching names (case-insensitive)
- Creates an MCP client connection to the matched connector
- Provides you with a ready-to-use MCP client session
Quickstart
1
Add MCP service extension to your agent
Import the necessary components and add the MCP service extension to your agent function.
2
Specify your connector preference
Use the
suggested parameter to indicate which connector you want to use (e.g., "github").3
Create an MCP client
Use
mcp_service.create_client() to get a connected MCP client session.4
Use MCP tools
Use the MCP client session to call tools, list resources, or interact with prompts.
Example: GitHub MCP Agent
Here’s a complete example of an agent that uses the GitHub MCP connector:Custom MCP Client with OAuth
If you prefer not to use the MCP Service Extension (which automatically matches connectors), you can still create a standard MCP client and use the OAuth extension for user authentication. Unlike the connector-based approach, this method does not require users to set up a connection ahead of the conversation. The OAuth extension handles the authentication flow through the Agent Stack UI, allowing users to authorize your agent to access third-party services during the conversation itself. This makes it ideal for scenarios where you want users to authenticate on-demand without pre-configuration.Example: Direct MCP Client with OAuth
Here’s how to build an agent that creates a custom MCP client and uses OAuth for authentication:Key Differences
MCP Service Extension approach:- Automatically matches connectors by name
- No need to specify MCP server URLs
- Handles connection setup automatically
- Requires users to set up connectors before the conversation
- Best for using registered connectors
- Manual MCP client creation with explicit URLs
- Full control over connection parameters
- Uses OAuth extension for in-conversation user authentication
- No pre-setup required from users
- Best for direct MCP server connections or on-demand authentication