Skip to main content

Overview

Extend MagOneAI with custom tools for your internal systems, proprietary APIs, and unique business logic. Any service with an API can become an MCP tool that your agents can use. Custom tools enable agents to interact with:
  • Internal APIs — your company’s microservices and internal tools
  • Proprietary systems — ERP, CRM, inventory management, etc.
  • Third-party services — APIs not natively integrated with MagOneAI
  • Legacy systems — wrap older SOAP or REST APIs with MCP interface
  • Custom business logic — implement domain-specific operations as tools
The key advantage: you build it once using the open MCP standard, and it works with MagOneAI and any other MCP-compatible AI platform.

How to add custom MCP tools

Follow this workflow to add custom tools to your MagOneAI projects.
1

Build or deploy an MCP server

Create an MCP server that wraps your API. You can:
  • Build from scratch using MCP SDKs (Python or TypeScript)
  • Use an existing MCP server from the community
  • Deploy pre-built MCP servers for common services
The MCP server runs as a separate process and exposes tools via the MCP protocol.
2

Define tool schemas

Each tool needs:
  • Name: Unique identifier (e.g., get_customer_details)
  • Description: What the tool does (used by agents to decide when to use it)
  • Parameters: JSON Schema defining inputs
  • Return type: Schema for response structure
The agent uses these definitions to understand how to call your tools.
3

Register the MCP server in MagOneAI

An organization owner connects the server through the External MCP servers flow:
  • The server’s HTTPS URL (public endpoints only — private IPs and localhost are rejected)
  • The credential-to-header mapping and credential values the server expects (stored in Vault)
Once connected, the server’s tools are discovered automatically and become available to agents across the organization.
4

Configure authentication

Provide credentials the MCP server needs to access your API:
  • API keys
  • OAuth tokens
  • Basic auth credentials
  • Custom headers
Credentials are stored in HashiCorp Vault and injected at runtime.
5

Test the tool connection

Use the built-in tool tester to verify:
  • MCP server is reachable
  • Tool definitions are valid
  • Test calls execute successfully
  • Authentication works correctly
6

Attach the tool to agents

Enable the custom tool in agent configurations. Agents can now discover and use your custom tools.

MCP server development basics

MCP servers are lightweight processes that expose tools to AI agents. They implement the Model Context Protocol specification.

Architecture

The MCP server acts as an adapter between the standardized MCP protocol and your specific API or system.

Available SDKs

Build MCP servers using official SDKs:

Python SDK

Best for: Data processing, ML models, database integrations

TypeScript SDK

Best for: Web APIs, real-time services, Node.js ecosystems

Basic MCP server structure (Python)

Here’s a minimal MCP server that wraps a REST API:

Basic MCP server structure (TypeScript)

The same server in TypeScript:

Tool definition best practices

Tool names should be descriptive and follow a consistent naming convention.Good: search_customers, create_support_ticket, get_inventory_statusBad: search, create, get_dataAgents use tool names to understand what the tool does. Clear names improve agent decision-making.
Descriptions help agents decide when to use a tool. Include:
  • What the tool does
  • What data it returns
  • When it should be used
Good: “Search for customers in the CRM by name, email, or company. Returns customer ID, contact details, and account status. Use this to find customer information before creating support tickets.”Bad: “Search customers”
Define precise parameter schemas:
  • Required vs optional parameters
  • Data types (string, integer, boolean, array, object)
  • Constraints (min/max values, string patterns, enums)
  • Default values
MagOneAI validates parameters before execution, preventing invalid tool calls.
Always return structured JSON responses, not plain text. This allows agents to:
  • Extract specific fields
  • Pass data to subsequent tools
  • Format information appropriately
Good:
Bad:
Return structured error responses that agents can interpret:
This allows agents to handle errors intelligently (e.g., “I couldn’t find that customer” instead of crashing).

Example: Custom CRM integration

Let’s build a complete MCP server for a fictional CRM system.

Tools to implement

Our CRM integration will expose these tools:
  1. search_contacts — find contacts by name, email, or company
  2. get_deal_status — retrieve status of a sales opportunity
  3. update_opportunity — modify deal amount, stage, or close date
  4. log_activity — record a call, email, or meeting with a contact

Complete Python implementation

Deploying the MCP server

Package and deploy your MCP server:
Now connect this server in MagOneAI through the External MCP servers flow, using its public HTTPS URL (a plain http:// or private address won’t be accepted).

Authentication for custom integrations

Your MCP server needs credentials to access your APIs. MagOneAI provides secure credential management.

API key authentication

Keep two credential concerns separate:
  • Your MCP server’s own upstream secrets (for example, the CRM API key it uses to call the CRM). These belong to your server’s deployment — its environment variables, secret manager, and so on. MagOneAI does not host your server, so it does not manage or inject these.
  • The credential MagOneAI presents to your MCP server. When you connect the server, you map each credential value to the HTTP header the server expects. MagOneAI stores those values in HashiCorp Vault and injects them as request headers on every call to your server — never in logs or exports.
Your MCP server reads its own upstream secrets from its environment as usual:

OAuth2 for custom services

For OAuth2-protected APIs, MagOneAI can manage the OAuth flow:
1

Configure OAuth app

Register an OAuth application with your service provider. Note the client ID and client secret.
2

Add OAuth config to MagOneAI

In Admin Portal, add OAuth configuration:
  • Client ID
  • Client secret
  • Authorization URL
  • Token URL
  • Required scopes
3

Users authorize access

When users first use your tool, they complete the OAuth flow. MagOneAI stores their access and refresh tokens in Vault.
4

Tokens injected at runtime

When an agent calls your tool, MagOneAI injects the user’s access token as a request header on the call to your MCP server.

Custom authentication schemes

For custom authentication (HMAC signatures, JWT, etc.), implement authentication in your MCP server and store necessary secrets in Vault.

Testing custom tools

Before deploying to production, thoroughly test your custom tools.

Local testing

Test your MCP server locally using the MCP Inspector:
The inspector provides a UI to:
  • View tool definitions
  • Execute tools with test parameters
  • Inspect request/response payloads
  • Debug connection issues

Integration testing in MagOneAI

Once registered in MagOneAI, use the built-in tool tester:
  1. Go to Project Settings → Integrations → Custom Tools → Your Tool
  2. Click Test Tool
  3. Select a tool to test
  4. Enter test parameters
  5. Execute and verify the response

Testing in workflows

Create a test workflow that uses your custom tools:
  • Build a simple workflow with an Agent node
  • Attach your custom tools to the agent
  • Provide test prompts that should trigger tool usage
  • Verify the agent calls tools correctly and handles responses
Start with the MCP Python or TypeScript SDK. A basic MCP server that wraps a REST API can be built in under an hour. Begin with one or two tools, test thoroughly, then expand.

Common patterns and examples

Pattern: Database wrapper

Expose database access as MCP tools for agents that need data beyond standard SQL:

Pattern: Multi-step workflow

Implement tools that orchestrate multiple API calls:

Pattern: Webhook receiver

Accept webhooks and expose them as resources or events to agents:
Agents can query this resource to stay informed about incoming events.

Next steps

MCP protocol

Deep dive into how MCP works

Tools overview

Learn about MagOneAI’s tool architecture

Security best practices

Secure your custom integrations

Workflow builder

Use custom tools in workflows