
MCP server tutorial: connect an app to an AI agent
A short MCP server tutorial for connecting a supported app to an AI agent through a hosted connection, then checking that the agent can discover its tools.
This tutorial connects a supported app to an MCP-capable agent without building an OAuth application or running a server yourself. It uses ClawLink's hosted connection flow. For an internal API or custom tool, use the same sequence as a model for planning a self-hosted server, but own the server and authorization steps yourself.
Setup
- Install and sign in to the ClawLink CLI:
npx -y @useclawlink/cli login- Install the connection for your agent. For example, the CLI can install its MCP configuration for a supported coding agent:
npx -y @useclawlink/cli install <agent>- Start a browser connection for an app such as Gmail:
npx -y @useclawlink/cli connect gmail- Complete the provider consent screen. Review the account and permissions before approving.
- Return to the agent and ask it to list the app's available actions or do a read-only task such as finding a recent email.
The browser approval connects the app. The agent configuration tells the agent where to reach the MCP tools. Those are separate steps, and skipping either one produces a different failure.
Verify the connection
Start with a read. For Gmail, ask for a recent subject line. For Google Drive, ask the agent to find a file by name. A successful read proves that the agent can discover the server, select a tool, and use the connected account.
Do not make a send, delete, or publish action your first test. A read gives you the same connection signal without changing an external system.
If the agent cannot use the app
Check these in order:
- The app connection says connected in ClawLink.
- The agent configuration points to the MCP server installed by the CLI.
- The agent has started a fresh session or reloaded its tool catalog.
- The requested tool exists and the account can do the same action in the app UI.
- The provider consent covered the permission needed for the action.
The MCP tool call failed guide separates tool discovery, arguments, permissions, provider failures, and re-authentication.
When to use a different approach
This hosted tutorial is not for an API that only exists inside your company network or for a tool whose behavior is part of your own product. In those cases, build or operate a self-hosted MCP server and use the authorization and architecture guides below.