The Model Context Protocol (MCP) is reshaping how AI tools communicate with external services. For e-commerce brands using SearchFIT.ai, building custom mcp servers unlocks a level of content automation that was impossible just a year ago. Instead of manually shuttling data between your product database, analytics platform, and content management system, a custom MCP server lets AI tools like Claude interact with all of these systems in a single, natural-language workflow.
In this guide, I will walk you through building custom MCP servers from scratch, connecting them to SearchFIT, and deploying them for production content workflows. By the end, you will have the knowledge to build MCP servers that make your content operation faster, more accurate, and fully automated.
1. What Is MCP and Why Does It Matter for Content Automation?
The Model Context Protocol is an open standard created by Anthropic that defines how AI models interact with external tools. Before MCP, every AI integration was a custom, one-off API connection. MCP standardizes the interface so that any MCP-compatible AI tool can use any MCP server without custom integration code.
For content automation, this means:
- AI tools can access real data. Instead of generating content from training data alone, an AI model connected to MCP servers can pull live product data, current pricing, inventory status, and performance metrics.
- Multi-step workflows become natural. An AI assistant can research keywords, check your content library for gaps, generate an article, score it for quality, and publish it, all through MCP server connections.
- SearchFIT.ai becomes programmable. Instead of using SearchFIT only through its web dashboard, MCP lets AI tools interact with SearchFIT's full feature set programmatically.
MCP turns AI tools from conversational interfaces into workflow automation engines. For e-commerce content teams, this is transformative.
2. MCP Architecture: Servers, Tools, and Resources
Before building an MCP server, you need to understand the three core concepts:
MCP Servers are lightweight services that expose capabilities to AI tools. Each server runs as a separate process and communicates through a standard protocol (typically stdio or HTTP with server-sent events).
Tools are actions that an AI model can invoke through an MCP server. A tool has a name, a description, input parameters, and returns a result. For example, a "generate-content" tool in a SearchFIT.ai MCP server accepts a topic and keyword list, then returns a generated article.
Resources are read-only data that an AI model can access through an MCP server. For example, a "content-library" resource exposes your existing SearchFIT content for the AI to reference when generating new articles.
The architecture is intentionally simple. Servers are easy to build, tools are easy to define, and AI models like Claude know how to discover and use them automatically. This simplicity is what makes the MCP ecosystem so powerful for content automation.
3. Setting Up Your Development Environment
Here is what you need to build an MCP server:
Prerequisites:
- Node.js 20 or later (TypeScript recommended)
- The MCP SDK:
@modelcontextprotocol/sdk - A SearchFIT.ai account with API access
- Claude Code or another MCP-compatible client for testing
Initialize your project:
mkdir searchfit-mcp-server
cd searchfit-mcp-server
npm init -y
npm install @modelcontextprotocol/sdk zod
npm install -D typescript @types/node tsxCreate your TypeScript configuration:
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true
},
"include": ["src/**/*"]
}Create the server entry point at src/index.ts:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new McpServer({
name: 'searchfit-custom',
version: '1.0.0'
});
// Tools will be added here
const transport = new StdioServerTransport();
await server.connect(transport);This gives you a minimal MCP server that Claude Code can connect to. Now let's add tools that interact with SearchFIT.ai.
4. Building a Content Generation Tool
The most immediately useful MCP tool for SearchFIT.ai users is one that triggers content generation through SearchFIT's API. Here is how to build it:
import { z } from 'zod';
server.tool(
'generate-article',
{
topic: z.string().describe('The topic or title for the article'),
keywords: z.array(z.string()).describe('Target keywords for SEO'),
contentType: z.enum(['blog-post', 'product-description', 'collection-page'])
.describe('The type of content to generate'),
wordCount: z.number().optional().describe('Target word count')
},
async ({ topic, keywords, contentType, wordCount }) => {
const response = await fetch(`${SEARCHFIT_API_URL}/content/generate`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${SEARCHFIT_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
topic,
keywords,
contentType,
wordCount: wordCount || 1500,
workspaceId: SEARCHFIT_WORKSPACE_ID
})
});
const result = await response.json();
return {
content: [{
type: 'text',
text: JSON.stringify({
id: result.id,
title: result.title,
qualityScore: result.qualityScore,
wordCount: result.wordCount,
status: result.status,
preview: result.content.substring(0, 500) + '...'
}, null, 2)
}]
};
}
);When Claude Code uses this tool, it sends the topic and keywords to SearchFIT.ai, which generates content using your brand voice profile and returns the result with a quality score. The AI model can then evaluate the result and decide whether to publish, revise, or generate a different angle.
5. Building a Content Library Tool
For AI-generated content to include proper internal links and avoid topic duplication, the AI model needs to know what content already exists. Build a tool that exposes your SearchFIT.ai content library:
server.tool(
'search-content-library',
{
query: z.string().describe('Search query to find related content'),
status: z.enum(['draft', 'published', 'scheduled']).optional()
.describe('Filter by content status'),
limit: z.number().optional().describe('Maximum number of results')
},
async ({ query, status, limit }) => {
const params = new URLSearchParams({
q: query,
...(status && { status }),
limit: String(limit || 10)
});
const response = await fetch(
`${SEARCHFIT_API_URL}/content/search?${params}`,
{
headers: { 'Authorization': `Bearer ${SEARCHFIT_API_KEY}` }
}
);
const results = await response.json();
return {
content: [{
type: 'text',
text: JSON.stringify(results.map((item: any) => ({
id: item.id,
title: item.title,
url: item.publishedUrl,
qualityScore: item.qualityScore,
publishedDate: item.publishedAt,
keywords: item.targetKeywords
})), null, 2)
}]
};
}
);With this tool, Claude Code can search your existing content before generating new articles. It might discover that you already have a post on a similar topic and suggest a different angle, or it might identify existing articles that the new content should link to.
6. Building a Publishing Tool
The final piece of the content workflow is publishing. Build a tool that pushes SearchFIT.ai content to your live store:
server.tool(
'publish-content',
{
contentId: z.string().describe('The SearchFIT content ID to publish'),
platform: z.enum(['shopify', 'wordpress']).describe('Target platform'),
scheduledDate: z.string().optional()
.describe('ISO date for scheduled publishing')
},
async ({ contentId, platform, scheduledDate }) => {
const response = await fetch(
`${SEARCHFIT_API_URL}/content/${contentId}/publish`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${SEARCHFIT_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
platform,
scheduledDate: scheduledDate || null
})
}
);
const result = await response.json();
return {
content: [{
type: 'text',
text: JSON.stringify({
status: result.status,
publishedUrl: result.publishedUrl,
publishedAt: result.publishedAt,
platform: result.platform
}, null, 2)
}]
};
}
);Now Claude Code can take a piece of content from generation to publication entirely through MCP tools. The SearchFIT.ai platform handles brand voice enforcement, quality scoring, internal linking, and SEO metadata, the MCP server just provides the interface.
7. Building a Product Data MCP Server
Content without product context is generic content. Build a separate MCP server that exposes your product catalog so AI tools can reference real products:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';
const server = new McpServer({
name: 'shopify-products',
version: '1.0.0'
});
server.tool(
'get-products-by-collection',
{
collection: z.string().describe('The collection handle or name'),
limit: z.number().optional()
},
async ({ collection, limit }) => {
const response = await fetch(
`https://${SHOPIFY_STORE}.myshopify.com/admin/api/2024-10/collections/${collection}/products.json`,
{
headers: { 'X-Shopify-Access-Token': SHOPIFY_TOKEN }
}
);
const data = await response.json();
const products = data.products.slice(0, limit || 20);
return {
content: [{
type: 'text',
text: JSON.stringify(products.map((p: any) => ({
title: p.title,
handle: p.handle,
price: p.variants[0]?.price,
description: p.body_html?.substring(0, 200),
url: `https://${SHOPIFY_STORE}.myshopify.com/products/${p.handle}`
})), null, 2)
}]
};
}
);When this server runs alongside the SearchFIT.ai MCP server, Claude Code can pull product data and pass it to SearchFIT's content generation. A blog post about "best organic dog food for senior dogs" can reference your actual products with correct names, prices, and URLs.
8. Connecting Multiple MCP Servers to Claude Code
The power of MCP comes from composing multiple servers. Here is a Claude Code configuration that connects your custom servers alongside SearchFIT.ai:
{
"mcpServers": {
"searchfit": {
"command": "npx",
"args": ["tsx", "/path/to/searchfit-mcp-server/src/index.ts"],
"env": {
"SEARCHFIT_API_KEY": "your-key",
"SEARCHFIT_API_URL": "https://api.searchfit.ai",
"SEARCHFIT_WORKSPACE_ID": "your-workspace"
}
},
"shopify-products": {
"command": "npx",
"args": ["tsx", "/path/to/shopify-mcp-server/src/index.ts"],
"env": {
"SHOPIFY_STORE": "your-store",
"SHOPIFY_TOKEN": "your-token"
}
},
"search-console": {
"command": "npx",
"args": ["tsx", "/path/to/gsc-mcp-server/src/index.ts"],
"env": {
"GSC_CREDENTIALS": "/path/to/credentials.json"
}
}
}
}With all three servers connected, Claude Code can execute sophisticated content workflows:
"Check Search Console for queries where we rank positions 5-15 for keywords containing 'organic dog food'. Pull our top-selling products from the organic dog food collection on Shopify. Then generate a blog post through SearchFIT targeting the best keyword opportunity, referencing our actual products. Schedule it for next Wednesday."
Every step uses a different MCP server, but the workflow is seamless.
9. Error Handling and Resilience
Production MCP servers need robust error handling. Here are the patterns that matter:
Timeout management:
async function fetchWithTimeout(url: string, options: RequestInit, timeoutMs: number = 10000) {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), timeoutMs);
try {
const response = await fetch(url, { ...options, signal: controller.signal });
return response;
} finally {
clearTimeout(timeout);
}
}Graceful error responses: When an MCP tool fails, return an informative error message rather than crashing. Claude Code can then inform the user and suggest alternatives.
server.tool('generate-article', schema, async (params) => {
try {
// ... generation logic
} catch (error) {
return {
content: [{
type: 'text',
text: `Content generation failed: ${error.message}. The SearchFIT API may be temporarily unavailable. Try again in a few minutes.`
}],
isError: true
};
}
});Rate limiting awareness: SearchFIT.ai's API has rate limits. Your MCP server should respect them:
let lastRequestTime = 0;
const MIN_INTERVAL = 1000; // 1 second between requests
async function rateLimitedFetch(url: string, options: RequestInit) {
const now = Date.now();
const wait = Math.max(0, MIN_INTERVAL - (now - lastRequestTime));
if (wait > 0) await new Promise(resolve => setTimeout(resolve, wait));
lastRequestTime = Date.now();
return fetch(url, options);
}10. Testing Your Custom MCP Server
Thorough testing prevents production surprises. Use these strategies:
Unit testing with mock responses:
import { describe, it, expect } from 'vitest';
describe('generate-article tool', () => {
it('returns content with quality score', async () => {
// Mock SearchFIT API
global.fetch = vi.fn().mockResolvedValue({
json: () => Promise.resolve({
id: 'content-123',
title: 'Test Article',
qualityScore: 85,
wordCount: 1500,
status: 'draft',
content: 'Generated content here...'
})
});
const result = await generateArticle({
topic: 'organic dog food',
keywords: ['organic dog food', 'natural pet food'],
contentType: 'blog-post'
});
expect(JSON.parse(result.content[0].text).qualityScore).toBe(85);
});
});Integration testing with Claude Code: Connect your MCP server to Claude Code in a test workspace and run through complete workflows. Verify that content appears in SearchFIT.ai with correct attributes.
Load testing: If your content team will trigger many MCP operations in parallel, test how your server handles concurrent requests. SearchFIT's API processes requests asynchronously, so your MCP server should handle waiting gracefully.
11. How SearchFIT Bridges the Gap
Custom MCP servers are the connection layer, but SearchFIT.ai is the intelligence layer. Here is what SearchFIT provides that raw API calls cannot:
- Brand voice consistency. Your MCP server sends a topic and keywords to SearchFIT. SearchFIT applies your brand's writing profile, tone preferences, and vocabulary patterns. Every article sounds like your brand, even when generated through an MCP workflow.
- Content quality scoring. SearchFIT doesn't just generate content, it evaluates it. Quality scores cover SEO optimization, readability, brand voice adherence, and E-E-A-T signals. Your MCP tools can use these scores to decide whether content is ready to publish or needs revision.
- Automated internal linking. When your MCP server triggers content generation, SearchFIT automatically identifies related content in your library and inserts contextual internal links. This builds topical authority without any additional MCP tools.
- Cross-platform publishing intelligence. Your publishing MCP tool sends a simple "publish to Shopify" command. SearchFIT handles the complexity, formatting content for Shopify's blog engine, setting meta tags, adding schema markup, and configuring Open Graph data.
- Content deduplication. Before generating new content, SearchFIT checks your existing library for topic overlap. If a similar article already exists, SearchFIT can suggest updating the existing piece instead of creating a duplicate.
The MCP server provides the interface; SearchFIT.ai provides the content intelligence.
12. Deploying MCP Servers for Team Use
Once your MCP server is tested, deploy it for your team:
Local deployment: Each team member runs the MCP server locally. Distribute the server code and configuration through your team's version control. This is the simplest approach for small teams.
Centralized deployment: Run MCP servers on a shared server or cloud instance. Team members configure their Claude Code clients to connect to the centralized server via HTTP/SSE transport instead of stdio. This ensures everyone uses the same version and configuration.
Docker deployment:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
CMD ["node", "dist/index.js"]Environment management: Use different SearchFIT.ai workspace IDs for development, staging, and production. Your MCP server reads the workspace ID from environment variables, so switching environments is a configuration change, not a code change.
13. Frequently Asked Questions
Do I need to build an MCP server to use SearchFIT with Claude Code?
No. SearchFIT.ai provides a pre-built MCP server that covers core functionality. Building custom servers is for teams that need specialized capabilities like proprietary data access or custom workflow steps.
Can I build an MCP server in Python instead of TypeScript?
Yes. The MCP SDK is available for Python and TypeScript. Both languages are fully supported. Choose whichever your team is more comfortable with.
How do MCP servers handle authentication with SearchFIT?
MCP servers store SearchFIT.ai API keys as environment variables. Keys are never exposed to the AI model, the MCP server handles authentication transparently.
Can an MCP server trigger SearchFIT's content scoring without generating new content?
Yes. You can build tools that score existing content, re-score after edits, or batch-score your entire library. SearchFIT's scoring API is independent of the generation API.
What happens if my MCP server goes down during a workflow?
Claude Code handles tool unavailability gracefully. It will report that the tool is unavailable and ask if you want to try a different approach. No data is lost in SearchFIT.ai.
Can I share my MCP server with other SearchFIT users?
Yes. MCP servers are standard Node.js or Python packages that can be published to npm or PyPI. The SearchFIT community shares useful MCP servers through the developer forum.
How do I monitor MCP server usage and performance?
Add logging to your MCP server for request counts, response times, and error rates. SearchFIT.ai also logs all API requests made through MCP connections in the workspace audit trail.
Can MCP servers interact with each other?
MCP servers don't communicate directly, but the AI model can use outputs from one server as inputs to another. This composability is a core feature of the MCP architecture.
14. Conclusion
Building custom MCP servers to connect AI tools with SearchFIT.ai is one of the highest-leverage investments an e-commerce content team can make. Once built, these servers enable natural-language workflows that span keyword research, product data, content generation, quality scoring, and publishing, all orchestrated by an AI assistant that understands your intent.
The MCP architecture is intentionally simple to build and deploy. A single developer can create a production-ready MCP server in a day. Combined with SearchFIT's content intelligence, brand voice, quality scoring, internal linking, and cross-platform publishing, custom MCP servers give your team capabilities that would have required a full engineering team to build just a year ago.
Start building your first MCP server today. Visit SearchFIT.ai to get API access and connect your custom MCP servers to a content platform that is ready for them.