Register MCP Servers as Tools
Copy page
Learn how to add and configure MCP tools for your agents
MCP tools connect to external MCP servers, enabling integration with a wide ecosystem of tools and services. Registering them as tools is a two step process:
Step 1: Get an MCP server URL
You need access to an MCP server before you can use its tools. Learn about connecting to Native servers, using Composio, using Gram, or building Custom servers in the MCP Servers tutorial.
Step 2: Register the MCP server as a tool in your agent
Authentication
If your MCP server requires authentication, we support various authentication methods (via credentials):
- No Authentication - For public APIs or internal services
- API Key - For services requiring API keys
- Bearer Token - For JWT or similar token-based authentication
- Token Authentication - For custom token schemes
- OAuth Flows - For standard OAuth 2.0 authentication
- OAuth 2.1 Flows - For modern OAuth 2.1 "1-click" authentication
For OAuth flows and OAuth 2.1 flows, it's recommended to use the Visual Builder for easier configuration.
See Credentials for detailed examples and implementation guidance for each authentication type.
Custom Headers
You can configure custom headers for your MCP server requests. Use credentials for sensitive information (API keys, tokens) and headers for non-sensitive metadata (user agent, version info, etc.).
Selecting Tools
Selective Tool Activation
Enable only specific tools from a server using MCP Server tool names in the activeTools field.
Using with for Tool Selection
While activeTools in mcpTool limits which tools are available from the server, you can further refine tool access at the sub agent level using mcpTool.with. This allows different agents to use different subsets of tools from the same MCP server.
Environment-Aware MCP Servers
You can also configure MCP tools to switch based on your environment. This is useful when you want to use different MCP tool configurations for development vs production.
Creating environment-aware MCP tools is a two step process:
Step 1: Define environment configurations
Step 2: Use the MCP tool in your sub agent
This pattern is useful if you want to keep track of different credentials for different environments. When you push your project using the Inkeep CLI inkeep push command with the --env flag, the credentials will be loaded from the appropriate environment file. For example, if you run inkeep push --env development, the credentials will be loaded from the environments/development.env.ts file.
CLI Environment Variables
The CLI respects these environment variables when using the --env flag: