TutorialsMcp servers

Build Custom MCP Servers

Copy page

Build your own custom MCP servers

When to Build Custom MCP Servers

Build custom MCP servers when:

  • Native servers don't exist for your specific APIs
  • You need custom business logic beyond what existing servers provide
  • You have proprietary systems that require custom integration

If pre-built servers meet your needs, consider Native MCP servers, Composio's platform, or Gram instead.

Getting Started

The Quick Start workspace includes a Next.js app in the apps/mcp/app/ directory that you can use to expose your MCP servers. Each MCP server you create will be exposed on a separate route on this app.

Creating from a template

You can add a custom MCP server template from our template library for common use cases using the CLI.

inkeep add --mcp [server-name]

This will automatically add a custom MCP server template to your Quick Start workspace. After customizing and deploying it, you can register it.

Using Vercel's Template

If you want to create a custom MCP server, you can use Vercel's Next.js MCP template as a starting point:

From the workspace root, add the Vercel template:

inkeep add --mcp vercel-template

Rename the template to your desired server name:

mv apps/mcp/app/vercel-template apps/mcp/app/[server-name]

Update the basePath inside apps/mcp/app/[server-name]/mcp/route.ts to /[server-name]:

{
  basePath: "/[server-name]",
  verboseLogs: true,
  maxDuration: 60,
  disableSse: true,
}

Customize the template with your desired tools.

You can access the server at http://localhost:3006/[server-name]/mcp. Register it with your agents using the mcpTool function.

import { mcpTool } from '@inkeep/agents-sdk';

export const mcpTool = mcpTool({
  id: '[server-name]',
  name: '[server-name]',
  description: '[server-name] API',
  serverUrl: 'http://localhost:3006/[server-name]/mcp',
});

Or you register the MCP server as a tool in the Visual Builder (see here).

Deploying to Vercel

Follow the instructions in Deploy to Vercel. If you have already deployed to Vercel, you can simply update the deployment by pushing to the same repository.

Note
Note

Enable Fluid compute and set maxDuration to 800 in apps/mcp/app/[server-name]/[transport]/route.ts if you're on a Pro or Enterprise plan and have long-running operations.

Next steps

Once you have your server, you can register it in one of: