vercel/ai · error · MCPClientError

Server does not support completions

Error message

Server does not support completions

What it means

Thrown by assertCapability (called from request) when the application attempts a completion/complete request but the server's initialize response did not advertise the 'completions' capability. The client checks declared server capabilities before sending capability-gated requests.

Source

Thrown at packages/mcp/src/tool/mcp-client.ts:716

  }

  private send(
    message: JSONRPCMessage,
    options?: MCPTransportSendOptions,
  ): Promise<void> {
    return options == null
      ? this.transport.send(message)
      : this.transport.send(message, options);
  }

  private assertCapability(method: string): void {
    switch (method) {
      case 'initialize':
      case 'server/discover':
        break;
      case 'completion/complete':
        if (!this.serverCapabilities.completions) {
          throw new MCPClientError({
            message: `Server does not support completions`,
          });
        }
        break;
      case 'tools/list':
      case 'tools/call':
        if (!this.serverCapabilities.tools) {
          throw new MCPClientError({
            message: `Server does not support tools`,
          });
        }
        break;
      case 'resources/list':
      case 'resources/read':
      case 'resources/templates/list':
        if (!this.serverCapabilities.resources) {
          throw new MCPClientError({
            message: `Server does not support resources`,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Check client.getServerCapabilities().completions before calling completion() and degrade gracefully if absent.
  2. Use an MCP server that implements the completions capability if autocompletion is required.
  3. Update the MCP server to a version that advertises completions.
  4. Wrap completion calls in try/catch on MCPClientError and fall back to static prompt/argument suggestions.

Example fix

// before
const res = await client.completion({ ref: { type: 'ref/prompt', name: 'greet' }, argument: { name: 'q', value: 'a' } });
// after
const caps = client.getServerCapabilities();
if (caps.completions) {
  const res = await client.completion({ ref: { type: 'ref/prompt', name: 'greet' }, argument: { name: 'q', value: 'a' } });
} else {
  const res = fallbackSuggestions();
}
Defensive patterns

Strategy: type-guard

Validate before calling

const caps = client.getServerCapabilities();
if (!caps?.completions) {
  // skip completion calls or use static suggestions
}

Type guard

function supportsCompletions(client: { getServerCapabilities(): { completions?: boolean } | undefined }): boolean {
  return client.getServerCapabilities()?.completions === true;
}

Try / catch

try {
  const res = await client.completion({ ref, argument });
} catch (e) {
  if (MCPClientError.isInstance(e) && e.message === 'Server does not support completions') {
    // fall back to no-op suggestions
  } else throw e;
}

Prevention

When it happens

Trigger: Calling client.completion() (or sending method 'completion/complete') against a server whose result.capabilities.completions is absent or falsy.

Common situations: MCP servers commonly omit completions support; developers assume argument autocompletion is universally available; connecting to a minimal or older server that never implemented completions.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/ca9823a4cd513cb9. Report an issue: GitHub.