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.4.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.4-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentic_ai_mcp-0.5.4.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.4.tar.gz
Algorithm Hash digest
SHA256 4383eb3e08e4e999a9a20ae5ccbcf8cde70817371cb734059fb6ae13428f5546
MD5 c3d1124a5ff9c8cb6b9d5dc66bd26b01
BLAKE2b-256 60cafea75e40d88119db848b6884e692f7e30f336b0719fc331bf6f0b664af07

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: agentic_ai_mcp-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 97076ab1af6fb896f26c33bdbe36dfc72d7c26a92bb547db62d39d515f2660a5
MD5 300d2fca936fb75a01d5cc3ce478fa17
BLAKE2b-256 0174160f7465f364a980f07721dd54b487132c12bc3fac35abb69fa755ce143a

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.4-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