Build a remote MCP server for CRM: tools, auth and review-ready metadata
Design a remote MCP server for CRM: contact, deal and activity tools, OAuth auth, annotations for writes and deletes, and a TypeScript example.
Build a remote MCP server for CRM
Short answer: a CRM server needs OAuth, one purpose-built tool per operation, read tools marked read-only, updates and deletes marked destructive, and a short tool list rather than one tool per API endpoint.
Basis: the MCP specification, the official TypeScript SDK docs (v2, package @modelcontextprotocol/server, read 2026-12-04) and our scanner rule pages. Tool sets are our recommendation, not a requirement. Anything marked (unverified) is not confirmed in those sources.
Recommended tool set
Say which record type each tool touches and which fields are required.
search_contacts
- Title: Search contacts
- Description: see the example below.
- Input:
querystring, required;limitinteger 1 to 20 - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
get_contact
- Title: Get a contact
- Description: "Use this to read one contact by id, including recent activities."
- Input:
contact_idstring, required - Annotations:
readOnlyHinttrue,destructiveHintfalse,openWorldHintfalse
create_contact
- Title: Create a contact
- Description: "Use this to add a new contact. Returns the new contact id. It does not change existing contacts."
- Input:
namestring, required;email,companyoptional - Annotations:
readOnlyHintfalse,destructiveHintfalse,openWorldHintfalse
update_contact
- Title: Update a contact
- Description: "Use this to change fields on one existing contact by id. Fields you pass replace the stored values. Does not create contacts or delete them."
- Input:
contact_idstring, required;fieldsobject ofname,email,company,phone - Annotations:
readOnlyHintfalse,destructiveHinttrue,openWorldHintfalse
delete_contact
- Title: Delete a contact
- Description: "Use this to permanently delete one contact by id. This cannot be undone."
- Input:
contact_idstring, required - Annotations:
readOnlyHintfalse,destructiveHinttrue,openWorldHintfalse
Annotations are hints, not security (see annotations explained). Here openWorldHint is true only where a tool reaches arbitrary outside parties, and false for a fixed domain. Claude's criteria want destructiveHint true on tools that modify or delete data, so update_contact is marked destructive because it overwrites. Only the additive create_contact is destructiveHint false.
Auth
Recommendation: OAuth 2.1 with PKCE. CRM data belongs to one account and contains personal data. Your server is the resource server: answer an unauthenticated call with 401 and a WWW-Authenticate header carrying resource_metadata (auth.challenge-401), publish RFC 9728 protected resource metadata (auth.prm-missing) whose resource equals the URL users enter (auth.resource-mismatch), and make your authorization server advertise PKCE S256 (auth.pkce-s256). For client registration advertise Client ID Metadata Documents (CIMD) and keep a registration_endpoint for Dynamic Client Registration (DCR) as the fallback (auth.client-registration-claude, auth.client-registration-chatgpt). Never put a token in the URL (auth.credential-in-url). The full flow is in MCP OAuth for Claude and ChatGPT. The SDK covers only the resource-server half: requireBearerAuth verifies tokens, and its docs say to use a dedicated identity provider for the authorization server.
Transport
Serve Streamable HTTP on one HTTPS path such as https://mcp.example.com/mcp (auth.https). In the v2 SDK, createMcpHandler(factory) builds a fresh McpServer for every request, so the endpoint is stateless and needs no sticky sessions (sessions and serverless). The handler checks no Host, Origin or token itself, so put those checks in front of it. Still on SSE? See the migration guide. Keep the handshake fast (latency.handshake).
Minimal TypeScript example
This targets SDK v2; coming from v1, use the SDK's migration guide. In v2 inputSchema is a z.object(...). Replace lookup with your own code.
import { createMcpHandler, McpServer, requireBearerAuth } from '@modelcontextprotocol/server';
import * as z from 'zod/v4';
const handler = createMcpHandler(() => {
const server = new McpServer({ name: 'acme-crm', version: '1.0.0' });
server.registerTool(
'search_contacts',
{
title: "Search contacts",
description:
"Use this to find contacts in the signed-in user's CRM by name, email or company. Returns up to 20 contacts with id, name, email and company.",
inputSchema: z.object({
}),
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }
},
async (args) => {
}
);
return server;
});
const gate = requireBearerAuth({
verifier: { verifyAccessToken }, // your function: token in, AuthInfo out, with expiresAt set
requiredScopes: ['mcp'],
expectedResource: new URL('https://mcp.example.com/mcp')
});
export default {
async fetch(request: Request): Promise<Response> {
const auth = await gate(request);
if (auth instanceof Response) return auth; // 401 or 403 challenge
return handler.fetch(request, { authInfo: auth });
}
};
Scope every query to the caller's account through the verified token, never a parameter.
Errors, size and speed
Return isError: true with text that says what was wrong and how to fix it; messages such as "Internal Server Error" fail review (errors.unhelpful-message). Reviewers run every tool with valid input and reject failures (errors.fixture-failed). Keep a call under 3 seconds where you can: the scanner warns above 3 and fails above 15 (latency.tool-call). For slower work see tool timeouts, cap result size (response size limits) and never echo keys or tokens in output (errors.secrets-in-output). Run the same calls in CI so a regression never reaches review.
Getting models to pick your tools
The leaderboard method shows the model every tool in the category as a function named <server>__<tool>, with your description and input schema, and records the first tool it calls. Your name, description and schema are the whole pitch. In the December 4 2026 run, 0.0% (0 of 108) of CRM trials ended with no tool called. The method says the crm and ecommerce prompts mostly ask about the user's own account, which open servers can seldom answer, and attributes the crm leader's near-total share to many CRUD-shaped tools. A signed-in server was not part of that pool, so do not read the share as a forecast for yours. Tool names that read as plain verbs plus a record type (search_contacts, update_contact) and a first sentence naming the record type give the model the cleanest signal. Keep the list short so one tool does not steal another's prompts. Limits apply: the harness is offline, uses one model family, and measures selection, not correct answers. Rewrite method and prompt sets are in writing tool descriptions models pick; write about your own task and sibling tools, never about other servers (desc.injection-directive).
Pitfalls our rules catch
- One tool per API endpoint creates very long lists (count.vscode-limit) and sometimes a catch-all (catchall.generic-executor).
- One tool taking GET and DELETE modes fails catchall.method-param.
- API keys or passwords as parameters fail schema.secret-param; key-only auth trips auth.api-key-only.
- Missing annotations on CRUD tools are the common finding (annotations.missing).
Submission checklist
- Run the scan at https://mcpshipyard.com/scan and clear every blocker.
- Every tool has
title, a description, aninputSchemaand explicitreadOnlyHint,destructiveHintandopenWorldHint(annotations explained). - Reproduce the failures in works in Inspector, fails in Claude before you submit.
- Claude: walk the Claude connector directory submission checklist.
- ChatGPT: walk the ChatGPT app submission checklist.
- Optional listings: Grok Build (formerly Cursor) and the official registry.
- Set up monitoring before launch.
- Deletes and overwrites are
destructiveHinttrue; creates false. - Responses return only the personal data a request needs (recommendation).
Check your server against these rules at https://mcpshipyard.com/scan.
Check your server against these rules
Scan runs the checks from this guide against a live URL and lists each failing rule with its fix.