home / mcp / mcp agent mcp server

MCP Agent MCP Server

A practical demonstration of AI Agent implementation with custom MCP server.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "dev-muhammad-mcpagent": {
      "command": "python",
      "args": [
        "start.py",
        "--mcp"
      ],
      "env": {
        "HOST": "localhost",
        "PORT": "8002",
        "MCP_HOST": "localhost",
        "MCP_PORT": "9002",
        "OPENAI_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

You use an MCP-based server to connect an AI agent to tools and APIs, enabling natural-language control over your expense data. This setup lets you manage transactions, generate insights, and interact with multiple clients through a single, extensible MCP interface.

How to use

Interact with the AI expense tracker through natural conversation. The AI agent automatically discovers available MCP tools and uses them to add, read, update, or delete expenses, summarize spending, and surface insights. You can query your spending by category, date, or keyword, and receive actionable financial guidance directly in conversation.

How to install

Prerequisites: Python and Node.js are required to run the server components and frontend. Make sure Python and npm are available on your system.

# 1) Install Python dependencies for the server
pip install -r server/requirements.txt
pip install agno openai python-dotenv

# 2) Install frontend dependencies (if you want to run the UI)
npm install --prefix client/agent-ui

Additional configuration and setup

Create and configure environment variables for OpenAI access and server settings. You will provide your API key and define host/port values for the API and MCP servers.

# Copy example env and edit
cp .env.example .env
# Edit .env to set your OPENAI_API_KEY and server settings
```

```bash
# Initialize and start the servers (in separate terminals)
cd server
python start.py

# Start MCP server only
python start.py --mcp

# Start API server only
python start.py --api

# In another terminal, start the agent
cd agent
python agent.py

Using environment and server configuration

The server suite relies on environment variables to configure OpenAI access and network endpoints. Ensure the following keys are set in your environment or in a .env file used by the startup scripts.

OPENAI_API_KEY=your_key_here
HOST=localhost
PORT=8002
MCP_HOST=localhost
MCP_PORT=9002

Available tools

create_transaction

Create a new expense entry with details such as amount, category, date, and notes.

read_transaction

Retrieve a specific expense by ID or list all expenses.

update_transaction

Modify an existing expense entry by ID with new values.

delete_transaction

Remove an expense entry by ID.

search_transactions

Search transactions by keyword or filter by date, category, or type.

get_summary

Generate a financial summary across a date range, showing totals and trends.

get_summary_categories

Provide a breakdown of totals by expense category.

health_check

Health check endpoint to verify the server is running and responsive.