Used in the Python testing client to power natural language interaction with the MCP server through GPT-4, enabling conversational queries that are translated into MCP tool calls.
mcp-inmovilla
A Model Context Protocol (MCP) server that provides tools to interact with the Inmovilla API. This server enables LLMs to manage properties, clients, owners, and retrieve various enumerations from the Inmovilla real estate platform.
About MCP
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Learn more:
Installation
1. Clone and Install Dependencies
2. Build the Project
3. Configure Environment Variables
Create a .env file in the project root with the following variables:
Obtaining the Inmovilla API Token
To get your Inmovilla API token:
Log in to Inmovilla CRM
Navigate to Ajustes > Opciones > Token para API Rest
Generate your token
Copy the token to your
.envfile
Note: Tokens will automatically expire after 3 months of inactivity.
Obtaining the OpenAI API Key
Sign up or log in to OpenAI Platform
Navigate to API keys section
Create a new API key
Copy the key to your
.envfile
4. Start the Server
The MCP server will start on port 1337 at http://localhost:1337/mcp.
Project Structure
Python Testing Client
The python_tester folder contains a Python script that connects to the MCP server and allows you to interact with it using an OpenAI-powered chatbot.
Setup
Ensure the MCP server is running (see step 4 above)
Install Python dependencies:
cd python_tester pip install -r requirements.txtRun the chatbot:
python3 openai2mcp_test.py
How It Works
The Python client:
Connects to the MCP server via Streamable HTTP on
http://localhost:1337/mcpUses the OpenAI API (GPT-4) to process natural language queries
Automatically discovers and calls available MCP tools
Provides a console-based chat interface
Example Usage
Type quit or exit to end the chat session.
Available Tools
The MCP server provides the following tools for interacting with the Inmovilla API:
Properties
create_property- Create a new property or prospectget_property- Get property details by code or referenceget_property_extra_info- Get extra information (portal publication info, leads)get_property_leads- Get leads for properties within a date rangelist_properties- List all propertiesupdate_property- Update an existing property
Clients
create_client- Create a new clientget_client- Get client details by codesearch_clients- Search for clientsupdate_client- Update an existing clientdelete_client- Delete a client
Owners
create_owner- Create a new ownerget_owner- Get owner detailsupdate_owner- Update an existing ownerdelete_owner- Delete an owner
Enumerations
get_enum- Get enum values for various categories (calidades, tipos, paises, ciudades, zonas)
Development
Watch Mode
To automatically rebuild on file changes:
Adding New Tools
Tools are automatically loaded from the src/tools/ directory. Each tool extends the MCPTool class and defines:
name- Tool identifierdescription- What the tool doesschema- Input parameters using Zodexecute()- Tool implementation
API Documentation
For detailed information about the Inmovilla API endpoints and parameters, refer to Documentación API REST v1.html in the project root.
License
[Your License Here]