Skip to main content

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 .

Requirements

Anthropic API Key

This SDK requires an Anthropic API key to analyze natural language requests using Claude. You can set your API key as an environment variable:

export ANTHROPIC_API_KEY="your_anthropic_api_key_here"

You can obtain an API key by signing up at Anthropic's website.

Without a valid Anthropic API key, the SDK's core functionality for request analysis and capability determination will not work properly.

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:

  1. Analyzes user requests using Mika to determine the required capability
  2. Examines the registry of available servers and tools
  3. Intelligently selects the most appropriate tool based on the server configurations
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

state_of_mika-0.1.2.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

state_of_mika-0.1.2-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file state_of_mika-0.1.2.tar.gz.

File metadata

  • Download URL: state_of_mika-0.1.2.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for state_of_mika-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6d976e9e7d6d3c7555a3e805d127c4402ce3d5e7b72418819a6c8b5974a14358
MD5 5189ed3fae5cc9c70d420fb57f300b37
BLAKE2b-256 190fc7f921959a8ebc550496bc7f6f5c319a302a4695c11e3f0cc23f5d11c0be

See more details on using hashes here.

File details

Details for the file state_of_mika-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: state_of_mika-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for state_of_mika-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b531f3ad8897b276cff412ce685eed400b29b5b71dcfb98f8ea554e5d415f5b8
MD5 fce0e02267db28d94c06ccb3b27a3e41
BLAKE2b-256 f0bd0e8ce6288165e662e184faa7f91787f6401147d25fb596844ee602c27167

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page