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 (expose tools)

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

from agentic_ai_mcp import AgenticAIServer

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 server and register tools
server = AgenticAIServer(host="0.0.0.0", port=8888)
server.register_tool(add)
server.register_tool(greet)

print(f"Tools: {server.tools}")
print(f"URL: {server.mcp_url}")

# Start server in background
server.start()

# ... do other things ...

# Stop when done
server.stop()

Client (run agents)

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

from agentic_ai_mcp import AgenticAIClient

# Connect to MCP server
client = AgenticAIClient(mcp_url="http://<server-ip>:8888/mcp")

# Simple agent workflow
result = await client.run("Calculate 2+1, then greet 'Alice' that many times.")
print(result)

# Planning-based workflow for complex tasks
result = await client.run_with_planning("Calculate ((0+2) + (1+1) + 1), then greet 'Bob' that many times.")
print(result)

Multiple MCP Servers

Connect to tools spread across multiple servers:

from agentic_ai_mcp import AgenticAIClient

# Connect to multiple MCP servers
client = AgenticAIClient(
    mcp_urls=[
        "http://<server-1>:8888/mcp",  # math tools
        "http://<server-2>:9999/mcp",  # greeting tools
    ]
)

# The agent can use tools from all servers
result = await client.run("Calculate 2+3, then greet 'Alice' that many times.")
print(result)

Using OpenAI

from agentic_ai_mcp import AgenticAIClient

# Use OpenAI instead of Anthropic
client = AgenticAIClient(
    mcp_url="http://<server-ip>:8888/mcp",
    provider="openai",
    model="gpt-4o-mini"
)

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

Passing API Key Directly

from agentic_ai_mcp import AgenticAIClient

# Pass API key directly (instead of using .env)
client = AgenticAIClient(
    mcp_url="http://<server-ip>:8888/mcp",
    api_key="sk-ant-..."
)

API Reference

AgenticAIServer

Property/Method Description
server.tools List of registered tool names
server.mcp_url Server URL
server.is_running Check if server is running
server.register_tool(func) Register a function as an MCP tool
server.start() Start MCP server in background
server.stop() Stop MCP server

AgenticAIClient

Property/Method Description
client.mcp_url Primary MCP server URL (first in the list)
client.mcp_urls List of all MCP server URLs
client.tools List of loaded tool names from all servers
client.run(prompt) Simple agentic workflow
client.run_with_planning(prompt) Planning-based workflow for complex tasks

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.6.3.tar.gz (19.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.6.3-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentic_ai_mcp-0.6.3.tar.gz
  • Upload date:
  • Size: 19.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.6.3.tar.gz
Algorithm Hash digest
SHA256 0cf76b606f90d1e868e9584e1a5e08fd5297bc167a34dd337c1c320b767665ad
MD5 6bf28c3ee4c4080ae86f4e229adcb155
BLAKE2b-256 fd16253e418a91a2127f1500359b059dc4346fd47dac63acac6b2d7c464d0ed3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agentic_ai_mcp-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 20.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.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e9377c02c1a3498626d0d60e0780e6ef6abc790d25cbde36c04b8729301b2ffb
MD5 be8d6d03d91132459d49a113abbf4924
BLAKE2b-256 fc363be910900b01742c75a33a2b4f7d0371fb435bd3b3d3943848a4ae26101e

See more details on using hashes here.

Provenance

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