Skip to content

Lightly-modified MCP client from modelcontextprotocol.io example that can integrate with all MCP servers

Notifications You must be signed in to change notification settings

scottlaw1/mcp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple MCP Client

A simple MCP client that can integrate with MCP servers.

Description

I followed the instructions here. Unlike my Build an MCP weather server experience, I had to make a few changes to get the client to work.

Getting Started

I followed the instructions at the Model Context Protocol site all the way through. The key problem with that approach didn't reveal themselves until I first tried to run the client against my working server. The model they hard-code in the Query Processing Logic section is deprecated according to the model pricing information in Claude Docs so my initial query didn't run. Switching to "claude-3-7-sonnet-latest" resolved that issue.

I also spent $5 (plus 15 cents tax) on credits for calling the API.

The Claude API call is also duplicated in the code, instead of factored out as a separate function. I factored it out for clarity, and added the model and max_tokens values to the .env file to make things a bit more configurable.

Dependencies

If for some reason you're just trying to run this without visiting the Model Context Protocol site, you'll need:

  • Python 3.10 or higher already installed
  • Python MCP SDK 1.2.0 or higher

Installing

Again, the Model Context Protocol site is the best source of information. But if you're not going there:

  • Install uv
  • Install the Python MCP SDK via uv

Executing programs

client.py contains all the necessary code for the MCP client.

To run the client against any MCP Python or Node server:

uv run client.py path/to/server.py # python server
uv run client.py path/to/build/index.js # node server

from whatever folder you git cloned this repo into.

Help

The instructions are the best source for troubleshooting guidance.

Authors

Contributors names and contact info

Scott Lawrence

Version History

  • 0.1
    • Initial Release

Acknowledgments

Build an MCP client (Python version).

About

Lightly-modified MCP client from modelcontextprotocol.io example that can integrate with all MCP servers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages