The FIWARE Model Context Protocol (MCP) Server provides a bridge between the Context Broker and other services, implementing basic operations for Context Broker interaction. It offers tools for version checking, entity queries, and data publishing within the FIWARE ecosystem.
To install the MCP server, follow these steps:
git clone <repository-url>
cd FIWARE_MCP_01
pip install -r requirements.txt
The server can be integrated with Claude Desktop using the following commands:
# Basic installation
mcp install server.py
# Installation with custom name
mcp install server.py --name "FIWARE MCP Server"
# Installation with environment variables
mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://...
mcp install server.py -f .env
Start the MCP server using one of the following commands:
python server.py
# or
mcp run server.py
By default, the server runs on 127.0.0.1:5001
.
The server provides several tools for interacting with the Context Broker:
Checks the version of the Context Broker.
Performs queries against the Context Broker.
Publishes or updates entities in the Context Broker.
Here's an example of how to publish entity data to the Context Broker:
# Example entity data
entity_data = {
"id": "urn:ngsi-ld:TemperatureSensor:001",
"type": "TemperatureSensor",
"temperature": {
"type": "Property",
"value": 25.5
},
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
}
# Publish to Context Broker
result = publish_to_CB(entity_data=entity_data)
You can configure the server by modifying these parameters in server.py
:
The server includes comprehensive error handling for:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.