FIWARE
STDIOFIWARE上下文代理桥接服务器
FIWARE上下文代理桥接服务器
This is a first implementation of a FIWARE Model Context Protocol (MCP) Server that provides a bridge between the Context Broker and other services. The server implements basic operations for interacting with a FIWARE Context Broker.
git clone <repository-url> cd FIWARE_MCP_01
pip install -r requirements.txt
Claude Desktop should launch the server via STDIO. Do not use “mcp install” or “mcp run” with this server.
Example configuration (adjust paths for your environment):
{ "mcpServers": { "CB-assistant": { "command": "uv", "args": [ "run", "--with", "requests>=2.31.0", "--with", "fastmcp>=0.3.0", "python", "PATH\\TO\\FIWARE-MCP-Server\\server.py" ] } } }
Alternative if dependencies are installed with pip:
{ "mcpServers": { "CB-assistant": { "command": "python", "args": [ "PATH\\TO\\FIWARE-MCP-Server\\server.py" ] } } }
By default, running the script starts the server in STDIO mode. Use --http to start an HTTP server.
python server.py
python server.py --http
python server.py --http --host 127.0.0.1 --port 5001
When running with --http, the server binds to the provided host/port and uses stateless HTTP sessions for compatibility with streamable HTTP clients.
To use LLMs via external APIs (for example the OpenAI Responses API) you may need to expose your local MCP server to the Internet. Use ngrok to create a public HTTPS tunnel to the server when running in HTTP mode.
Note: Keep your auth token secure. The public URL stays active while ngrok is running and will cease to be reachable when you stop the tunnel.
CB_version
query_CB
publish_to_CB
# 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)
The server can be configured by modifying the following parameters in server.py:
The server includes comprehensive error handling for:
Feel free to submit issues and enhancement requests!
This project is licensed under the Apache License 2.0.