A streamlined connector for Language Models to interact with MCP servers
Project description
State of Mika SDK
The State of Mika SDK is a powerful connector that bridges large language models (LLMs) with capability servers using the Message-based Communication Protocol (MCP).
Installation
You can install the State of Mika SDK directly from PyPI:
pip install state_of_mika
Or from the source code:
git clone https://github.com/yourusername/StateOfMika-SDK.git
cd StateOfMika-SDK
pip install -e .
Features
- Connect LLMs to MCP capability servers
- Automatic server discovery and installation
- Support for various capabilities (weather, time, search, etc.)
- Environment variable configuration for secure API key management
- NEW: Dynamic tool discovery with Mika integration
- NEW: Intelligent error analysis and suggestion system
Usage
Basic Usage
import asyncio
from state_of_mika import Connector
async def main():
# Initialize the connector
connector = Connector()
await connector.setup()
# Execute a capability
result = await connector.execute_capability(
capability="weather",
tool_name="get_weather",
parameters={"location": "Paris"}
)
print(f"Weather result: {result}")
# Clean up
await connector.aclose()
if __name__ == "__main__":
asyncio.run(main())
Using Mika for Tool Selection
import asyncio
from state_of_mika import SoMAgent
async def main():
# Initialize the agent with Mika integration
agent = SoMAgent(auto_install=True)
await agent.setup()
# Process a natural language request
result = await agent.process_request("What's the weather like in Paris today?")
if result["status"] == "success":
print(f"Weather data: {result['result']}")
else:
print(f"Error: {result['error']}")
print(f"Suggestion: {result['suggestion']}")
# Clean up
await agent.aclose()
if __name__ == "__main__":
asyncio.run(main())
Weather capability
To use the weather capability, you need to set the AccuWeather API key:
export ACCUWEATHER_API_KEY="your_api_key_here"
You can get an API key from AccuWeather Developer Portal.
Mika Integration
To use the Mika integration for automatic tool selection and error analysis, set your Mika API key:
export MIKA_API_KEY="your_api_key_here"
You can get an API key from Mika Console.
Dynamic Tool Discovery
The State of Mika SDK now includes a dynamic tool discovery system that:
- Analyzes user requests using Mika to determine the required capability
- Examines the registry of available servers and tools
- Intelligently selects the most appropriate tool based on the server configurations
- Returns detailed error analysis and suggestions when issues occur
This approach enables:
- Adding new tools without code changes
- Automatic adaptation to available tools and capabilities
- Helpful suggestions when requested capabilities aren't available
For detailed technical documentation on how this system works, see Dynamic Tool Discovery.
Command Line Interface
The SDK also provides a command-line interface:
# Install a server
som-cli install mcp_weather
# List available servers
som-cli list
Development
For development, install the package with development dependencies:
pip install -e ".[dev]"
Run tests:
pytest
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file state_of_mika-0.1.1.tar.gz.
File metadata
- Download URL: state_of_mika-0.1.1.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c4ddc9a1371f27e383eae8eb47d2adc200725dc953ebb922d9b479528e119ec
|
|
| MD5 |
ea323d7dfe2d9a6274d4f427f706b17b
|
|
| BLAKE2b-256 |
d3acd6ab74edd06e2f8e206ac5bee5d43c3aaa1fe58231aec8d19d97a00ad9a5
|
File details
Details for the file state_of_mika-0.1.1-py3-none-any.whl.
File metadata
- Download URL: state_of_mika-0.1.1-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9336f87818fdb6b26a5e50f004b8aa413e1efbb96a07fa04527003983ab7d2f5
|
|
| MD5 |
2c4be1df1dbc05a47b5867321a201c45
|
|
| BLAKE2b-256 |
b7a3a943c3c6a9f8ee1a44f04419b29348b4bb7d8575cfc27f86e13bcc6cd4dc
|