# Building a CLI Client For Model Context Protocol Servers

DevFeed: [Building a CLI Client For Model Context Protocol Servers](<https://devfeed.tech/articles/building-a-cli-client-for-model-context-protocol-servers-5081.md>)

Original publisher: [Read original article](<https://neon.com/blog/building-a-cli-client-for-model-context-protocol-servers>)

Author: Pedro Figueiredo

Published: 2024-12-20T17:21:38Z

Content type: tutorial

Language: en

Sources: [Blog -- Neon Docs](<https://devfeed.tech/sources/blog-neon-docs.md>)

Topics: [Model Context Protocol (MCP)](<https://devfeed.tech/topics/model-context-protocol-mcp.md>), [MCP Server](<https://devfeed.tech/topics/mcp-server.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [API](<https://devfeed.tech/topics/api.md>), [Claude](<https://devfeed.tech/topics/claude.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [api](<https://devfeed.tech/tags/api.md>), [claude](<https://devfeed.tech/tags/claude.md>), [cli](<https://devfeed.tech/tags/cli.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [mcp-server](<https://devfeed.tech/tags/mcp-server.md>), [model-context-protocol](<https://devfeed.tech/tags/model-context-protocol.md>), [product](<https://devfeed.tech/tags/product.md>), [sdk](<https://devfeed.tech/tags/sdk.md>), [tool](<https://devfeed.tech/tags/tool.md>)

## AI overview

This article explains how to build a command-line MCP client that connects to MCP servers, discovers available tools, invokes tool handlers, and incorporates tool results into an LLM conversation. It uses the Anthropic Tools API and official SDK, and describes the client's message handling, chat loop, entry point, and execution flow.

## Source excerpt

The Model Context Protocol (MCP) keeps gaining traction in the AI space, and since the launch of the Neon MCP Server (~2 weeks ago), the community has built dozens of these servers across a wide spectrum of domains. However, the Claude Desktop app has established itself as the de...