Skip to main content

A lightweight agentic AI framework with MCP tool serving

Project description

Agentic AI MCP

Lightweight agentic AI with MCP tools. Supports multiple LLM providers (Anthropic, OpenAI) and distributed setups where tools run on one machine and agents on another.

Install

pip install agentic-ai-mcp

Setup

Set your API key in .env file (only needed on the client/agent machine):

# For Anthropic (default)
ANTHROPIC_API_KEY=sk-ant-...

# For OpenAI
OPENAI_API_KEY=sk-...

Quick Start

See the example notebooks:

Usage

Server Mode (expose tools)

Run this on the machine where you want to host tools:

from agentic_ai_mcp import AgenticAI

def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

def greet(name: str, times: int = 1) -> str:
    """Greet someone."""
    return ("Hello, " + name + "! ") * times

# Create agentic instance and register tools
ai = AgenticAI()
ai.register_tool(add)
ai.register_tool(greet)

# Start server
ai.run_mcp_server()

# Stop when done
ai.stop_mcp_server()

Client Mode (run agents)

Run this on another machine to connect to the server and execute agents:

from agentic_ai_mcp import AgenticAI

# Connect to remote MCP server 
ai = AgenticAI(mcp_url="http://<server-ip>:8888/mcp") ## default provider: Anthropic, use provider = 'openai' to use OpenAI 

# Simple agent workflow
result = await ai.run("Calculate 2+1, then use the result as the number of times to greet 'Alice'.")
print(result)

# Planning-based workflow for complex tasks
result = await ai.run_with_planning("Calculate ((0+2) + (1+1) + 1), then use the result as the number of times to greet 'Bob'.")
print(result)

Using OpenAI

from agentic_ai_mcp import AgenticAI

# Use OpenAI instead of Anthropic
ai = AgenticAI(
    mcp_url="http://<server-ip>:8888/mcp",
    provider="openai",
    model="gpt-4o-mini" ## or 'gpt-4o'/'gpt-4-turbo' etc.
)

result = await ai.run("Calculate -1+2")

Methods

Method Description
ai.register_tool(func) Register a function as an MCP tool
ai.run_mcp_server() Start MCP server in background
ai.stop_mcp_server() Stop the MCP server
ai.run(prompt) Simple agent workflow
ai.run_with_planning(prompt) Complex agent workflow

License

MIT

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

agentic_ai_mcp-0.5.5.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

agentic_ai_mcp-0.5.5-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file agentic_ai_mcp-0.5.5.tar.gz.

File metadata

  • Download URL: agentic_ai_mcp-0.5.5.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentic_ai_mcp-0.5.5.tar.gz
Algorithm Hash digest
SHA256 b4a4c45aef3133f777bdd66ac578b358cecf47febe83b237e2521ac05938763d
MD5 0258c0c3f5fd3d932853977039cbc39a
BLAKE2b-256 9fc02d7c7c7c82d056bc8826750d5447371696708a3498857a8ba88e29c3555e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.5.tar.gz:

Publisher: cd.yml on hasanjawad001/agentic-ai-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentic_ai_mcp-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: agentic_ai_mcp-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentic_ai_mcp-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e2f8f0da55d87ae682ccefcca06aa330408580ba43463a969e4acbc58e9eef0
MD5 43c51c42b7a268ae7310971850b3e299
BLAKE2b-256 01f94a9f265316af385c4cea75a7b3cace9a2b3037ebc7a3b8e0611640cfebdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.5-py3-none-any.whl:

Publisher: cd.yml on hasanjawad001/agentic-ai-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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