trackmcp
Back to directory
sharmatriloknath

mcp_starter

View on GitHub

How to setup mcp server and mcp client.

0 stars JavaScriptDeveloper Kits Updated Apr 5, 2025

Documentation

MCP Starter Project

What is MCP?

The Model Context Protocol (MCP) is a standard for building AI applications that can interact with external tools and APIs. It consists of two main components:

1. MCP Server: A Python service that defines and exposes tools/functions that can be called by AI models

2. MCP Client: A TypeScript/JavaScript client that connects to the MCP server and manages interactions between AI models and tools

Project Structure

code
mcp_starter/
├── mcp-server/           # Python MCP server implementation
│   ├── main.py          # Server with documentation search tool
│   └── pyproject.toml   # Python dependencies
└── mcp-clients/         # TypeScript MCP client implementation
    ├── index.ts         # Express server with HuggingFace integration
    └── package.json     # Node.js dependencies

Getting Started

Prerequisites

Setting Up the Server

1. Create a Python virtual environment and activate it:

bash
cd mcp-server
python -m venv .venv
# On Windows
.venv\Scripts\activate

2. Install dependencies:

bash
pip install -e .

3. Create a `.env` file in the `mcp-server` directory:

plaintext
SERPER_API_KEY=your_serper_api_key_here

Setting Up the Client

1. Install Node.js dependencies:

bash
cd mcp-clients
npm install

2. Create a `.env` file in the `mcp-clients` directory:

plaintext
HUGGINGFACE_API_KEY=your_huggingface_api_key_here

3. Build the TypeScript code:

bash
npm run build

Running the Application

1. Start the MCP server:

bash
cd mcp-server
python main.py

2. In a new terminal, start the client server:

bash
cd mcp-clients
node build/index.js ../mcp-server/main.py

Using the API

The client exposes two endpoints:

  • Health Check: `GET http://localhost:3000/health`
  • Chat: `POST http://localhost:3000/chat`

Example chat request:

json
{
  "query": "Search the langchain docs for RAG",
  "sessionId": "user123"
}

Features

  • Documentation Search Tool: Search documentation for popular AI libraries:
    • LangChain
    • LlamaIndex
    • OpenAI
  • Conversation Management: Maintains chat history per session
  • Tool Integration: Seamlessly integrates AI model responses with tool calls
  • Error Handling: Robust error handling for API calls and tool execution

How It Works

1. The MCP server defines tools that can be called by AI models

2. The client connects to the MCP server and retrieves available tools

3. When a user sends a query:

    Environment Variables

    Server

    • `SERPER_API_KEY`: API key for Google Search functionality

    Client

    • `HUGGINGFACE_API_KEY`: API key for accessing Hugging Face models

    License

    MIT License

    Frequently asked questions

    What is mcp_starter?

    mcp_starter is How to setup mcp server and mcp client.

    How do I install mcp_starter?

    Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

    Is mcp_starter open source?

    Yes — it is hosted on GitHub at https://github.com/sharmatriloknath/mcp_starter.

    Related MCP tools

    Run your own MCP server? See who uses it and what to fix.

    Measure it with TrackMCP