What’s MCP?
The Model Context Protocol (MCP) is an open standard that lets AI applications connect to external tools and data sources. Instead of hardcoding tool implementations, MCP lets you:- Connect to tool servers: use pre-built MCP servers for filesystems, databases, and APIs
- Standardize tool interfaces: all MCP tools follow the same protocol, so they’re interchangeable
- Share tools across projects: one MCP server can serve multiple AI applications
How MCP works with AgentMark
- You declare MCP servers by name in
agentmark.jsonso they’re available in the Dashboard prompt editor. - You reference MCP tools in your prompt frontmatter using
mcp://{server}/{tool}syntax. - The neutral render surfaces those names; it doesn’t connect anything.
- At your call site, you connect the server (with your SDK’s MCP client, or inside an executor) and pass its tools into the model call.
agentmark.json and the tool names from frontmatter. Opening the connection is your runtime’s responsibility, the same way tool resolution happens at your call site rather than on the client.
What you’ll learn
- Declare MCP servers by name in
agentmark.json - Reference MCP tools in prompts using
mcp://URIs - Combine MCP tools with other tool names
- Connect the servers at your own call site
1) Declare MCP servers in agentmark.json
List your MCP servers under mcpServers in agentmark.json. This makes them selectable in the Dashboard prompt editor and documents which servers your prompts expect. AgentMark supports two server types:
agentmark.json
- URL servers accept only
urland optionalheaders. - stdio servers accept only
command,args,cwd,env.
Servers declared in
agentmark.json are available in the Dashboard prompt editor. They’re not connected by the AgentMark client at runtime; your call site connects them when it makes the model call.stdio servers (local process)
A stdio server runs as a child process on your machine, communicating over stdin/stdout. Use it for local development, accessing local files, or running custom tools.
URL servers (remote HTTP)
A URL server runs remotely and accepts requests over HTTP with Server-Sent Events (SSE). Use it for shared team tools, cloud-hosted services, and production deployments.2) Reference MCP tools in prompts
Declare MCP tools in your prompt frontmatter undertext_config.tools. You can mix MCP tool names with other tool names:
mcp-example.prompt.mdx
mcp://docs/web-searchnames the MCP serverdocsand its toolweb-search.summarizenames a regular tool you resolve at your call site.
Wildcard: include all tools from a server
Include every tool exported by a server using*:
- AgentMark includes all tools the
docsserver exports, under their original names. - If a tool name collides with an existing tool, resolve the conflict at your call site (the later-added tool typically wins).
3) Connect the server at your call site
The neutral render gives you the requested tool names intext_config.tools. You connect the MCP server with your own SDK’s MCP client and pass the server’s tools into the model call. The exact connect helper belongs to your SDK, not to AgentMark.
With the Vercel AI SDK, MCP support lives in the @ai-sdk/mcp package. You open the connection, fetch the tools, run the call, and close the connection:
Use
createMCPClient as the entry point. @ai-sdk/mcp pins an exact @ai-sdk/provider-utils version, which can differ from the one your installed ai resolves, so mcp.tools() doesn’t always line up with generateText’s ToolSet under TypeScript’s strict mode. Casting with as ToolSet bridges the version gap; the runtime tool shape is compatible. Pin compatible versions and consult the Vercel AI SDK MCP docs for the current API.@ai-sdk/mcp/mcp-stdio subpath, not the package root:
text handler and close it when the call returns. See Connect your SDK for the executor and serving pattern, and Tools and agents for the resolve-by-name pattern that handles non-MCP tools the same way.
Notes and best practices
- Keep server configs minimal. URL servers need only
url; stdio servers need onlycommand. - Declare servers by name in
agentmark.jsonso they appear in the Dashboard editor, but remember the AgentMark client doesn’t connect them. - Connect each server once at your call site and reuse the connection across calls where you can; close stdio/SSE connections when you’re done.
- Use a wildcard reference (
mcp://server/*) to expose a server’s full tool surface, but watch for name collisions when you merge tool sets at your call site.
Have questions?
Reach out any time:
- Email the team at hello@agentmark.co for support
- Schedule an Enterprise Demo to learn about AgentMark’s business solutions