VOOZH about

URL: https://dev.to/aws-builders/local-mcp-development-with-python-and-kiro-5ffc

⇱ Local MCP Development with Python and Kiro - DEV Community


Leveraging Kiro CLI and the underlying LLM to build Model Context Protocol (MCP) AI applications with Python with a local development environment.

πŸ‘ Image

Aren’t There a Trillion Python MCP Demos?

Yes there are.

Python has traditionally been the main coding language for ML and AI tools. The goal of this article is to provide a minimal viable basic working MCP stdio server that can be run locally without any unneeded extra code or extensions.

Haven’t You Done this One Before?

What is old is new.

This article extends a previous article covering using Gemini CLI with MCP servers. The original article is here:

Local MCP Development with Python and Gemini CLI

The same structured approach is used to enable Python MCP servers on Kiro CLI.

This seems Pretty Basic- why even Bother?!

When configuring a new environment and new toolsβ€Šβ€”β€Šthe key to a successful deployment is to validate the basic building blocks for the approach. Python MCP servers allow CLI tools like Kiro to be dynamically extended with a clear approach to enable minimal MCP tools. Before attempting more complicated MCP tools - a set of basic MCP commands with the simplest MCP protocol (studio) is used to verify the functionality.

AWS Setup

The AWS CLI provides the basic tools for working with the AWS services:

AWS CLI

Check the AWS installation:

xbill9@cloudshell:~ (aisprint-491218)$/usr/local/bin/aws --version
aws-cli/2.34.57 Python/3.14.5 Linux/6.6.137+ exe/x86_64.ubuntu.24
xbill9@cloudshell:~ (aisprint-491218)$

Once the tools are installedβ€Šβ€”β€Šlogin to the AWS console:

aws login --remote

What is Kiro

Kiro is an agentic, AI-powered Integrated Development Environment (IDE) built by Amazon Web Services (AWS) designed to help developers move from initial concepts to production-ready software. Based on a fork of VS Code (Code OSS), Kiro feels familiar while acting like an autonomous co-developer. [1, 2, 3]

Installing Kiro

The main download site for Kiro is:

https://kiro.dev/

Kiro: Bring engineering rigor to agentic development

πŸ‘ Image

for the CLI downloadβ€Šβ€”β€Šclick CLI:

curl -fsSL https://cli.kiro.dev/install | bash

Python MCP Documentation

The official GitHub Repo provides samples and documentation for getting started:

GitHub - modelcontextprotocol/python-sdk: The official Python SDK for Model Context Protocol servers and clients

The most common MCP Python deployment path uses the FASTMCP library:

Welcome to FastMCP - FastMCP

Where do I start?

The strategy for starting MCP development is a incremental step by step approach.

First, the basic development environment is setup with the required system variables, and a working Kiro CLI configuration.

Then, a minimal Hello World Style Python MCP Server is built with stdio transport. This server is validated with Kiro CLI in the local environment.

This setup validates the connection from Kiro CLI to the local process via MCP. The MCP client (Kiro CLI) and the Python MCP server both run in the same local environment.

Next- the basic MCP server is extended with Kiro CLI to add several new tools in standard Python code.

Setup the Basic Environment

At this point you should have a working Python interpreter and a working Kiro CLI installation. The next step is to clone the GitHub samples repository with support scripts:

cd ~
git clone https://github.com/xbill9/kiro-codeassist

Then run init.sh from the cloned directory.

The script will attempt to determine your shell environment and set the correct variables:

cd kiro-codeassist
source init.sh

If your session times out or you need to re-authenticate- you can run the set_env.sh script to reset your environment variables:

cd agy-cli-codeassist
source set_env.sh

Variables like PROJECT_ID need to be setup for use in the various build scripts- so the set_env script can be used to reset the environment if you time-out.

Hello World with STDIO Transport

One of the key features that the standard MCP libraries provide is abstracting various transport methods.

The high level MCP tool implementation is the same no matter what low level transport channel/method that the MCP Client uses to connect to a MCP Server.

The simplest transport that the SDK supports is the stdio (stdio/stdout) transportβ€Šβ€”β€Šwhich connects a locally running process. Both the MCP client and MCP Server must be running in the same environment.

The connection over stdio will look similar to this:

if __name__ == " __main__":
 # Explicitly use stdio transport
 mcp.run(transport="stdio")

Checking the Code

The Makefile has built in targets to validate the code:

xbill@penguin:~/kiro-codeassist/mcp-stdio-python$make help
Usage: make [target]

Targets:
 build Build the application
 clean Clean up temporary/compiled files
 format Format the code
 help Show this help message
 install Install dependencies
 lint Lint the code
 pull Pull latest changes from git
 push Push changes to git
 release Install dependencies in release mode
 run Run the application
 status Show git status
 test Run tests
 type-check Type-check the code
xbill@penguin:~/kiro-codeassist/mcp-stdio-python$

The source can be linted and tested:

xbill@penguin:~/kiro-codeassist/mcp-stdio-python$make lint
Linting the code...
xbill@penguin:~/kiro-codeassist/mcp-stdio-python$make test
Running tests...
=============================================== test session starts ================================================
platform linux -- Python 3.13.13, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/xbill/kiro-codeassist/mcp-stdio-python
plugins: anyio-4.13.0
collected 7 items 

test_logging.py .... [57%]
test_greet.py ... [100%]

================================================ 7 passed in 0.35s =================================================
xbill@penguin:~/kiro-codeassist/mcp-stdio-python$make type-check
Type-checking the code...
Success: no issues found in 3 source files

Running the Python Code

First- switch the directory with the Python MCP sample code:

cd ~/kiro-codeassist/mcp-stdio-python

Run the release version on the local system:

cd ~/kiro-codeassist/mcp-stdio-python
make release

You can validate the final result by checking the messages:

xbill@penguin:~/kiro-codeassist/mcp-stdio-python$make release
Installing dependencies...
Requirement already satisfied: mcp==1.20.0 in /home/xbill/.pyenv/versions/3.13.13/lib/python3.13/site-packages (from -r requirements.txt (line 1)) (1.20.0)

Kiro CLI

The default Kiro CLI MCP settings points to the local studio Python MCP server:

xbill@penguin:~/kiro-codeassist/mcp-stdio-python/.kiro/settings$moremcp.json{"mcpServers":{"hello-stdio-python":{"command":"python","args":["/home/xbill/kiro-codeassist/mcp-stdio-python/main.py"],"disabled":false}}}

Validation with Kiro CLI

Finally- Kiro CLI is restarted and the MCP connection over stdio to the Python Code is validated, The full session will start:

 /mcp list Β· 1 configured
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 search: type to filter

 Configured Servers
 Name Status Details
 hello-stdio-python ● running 3 tools

And you can then connect to the MCP Server over stdio:

 greet A Ghost and Two Snakes!

↓ greet
 β•° param=A Ghost and Two Snakes!

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 greet requires approval
 Yes, single permission 
 ❯ Trust, always allow in this session
 No (Tab to edit) 

So what sorcery makes this happen?

 explain how this works

 Let me look at the server code to give you an accurate explanation.
● Read /home/xbill/kiro-codeassist/mcp-stdio-python/main.py

 Here's how it works end-to-end:

 The MCP Protocol

 MCP (Model Context Protocol) is a standard for exposing tools to AI clients. The server and client communicate
 over stdio (standard input/output) using JSON-RPC messages β€” the client writes requests to the process's stdin,
 and reads responses from stdout.

 The Server (main.py)

 - FastMCP from the mcp library handles all the protocol boilerplate (JSON-RPC framing, tool discovery, etc.)
 - Tools are defined with the @mcp.tool() decorator β€” just plain Python functions. FastMCP introspects the
 function's name, docstring, and type hints to auto-generate the tool schema.
 - The greet tool is trivially simple: it just returns whatever string you pass in as param.
 - Logging goes to stderr (not stdout) so it doesn't pollute the JSON-RPC stream on stdout.
 - mcp.run(transport="stdio") starts the event loop, blocking and processing messages as they arrive.

 What happened when you typed greet A Ghost and Two Snakes!

 1. Kiro (the MCP client) sent a tools/call JSON-RPC request to the server's stdin.
 2. main.py routed it to the greet function with param="A Ghost and Two Snakes!".
 3. The function returned the string, FastMCP wrapped it in a TextContent response, and wrote it to stdout.
 4. Kiro received and displayed the result. 

Extending the Python MCP Server with Kiro CLI

Now that the basic MCP functionality has been tested and verified with Kiro CLI- the Python server code can be extended with new MCP tools:

/context add main.py
with main.py add 2 new MCP tools - one that gets the AWS CLI version and one that gets the Kiro CLI version

Restart Kiro CLI and check for the new MCP tools:

 list mcp tools

 The MCP tools available from the hello-stdio-python server are:

 - greet β€” Get a greeting from the local stdio server. Takes a param (string) and returns it back.
 - get_aws_cli_version β€” Get the installed AWS CLI version.
 - get_kiro_cli_version β€” Get the installed Kiro CLI version.
 - get_system_info β€” Get host system information (OS, CPU count, memory).
 - get_system_time β€” Get the current system time on the host machine.

Get the system time:

●get_system_time{"content":[{...+9lines(ctrl+ototoggle)2026-06-14T19:13:14

And system Info:

get_system_info●get_system_info{"content":[{...+9lines(ctrl+ototoggle)-OS:Linux6.6.99-09128-g14e87a8a9b71-Architecture:x86_64-CPUs:12-Memory:4.32GB

And AWS/Kiro versions:

 get_aws_cli_version

● get_aws_cli_version

 AWS CLI version: 2.35.4

 Full details: aws-cli/2.35.4 Python/3.14.5 Linux/6.6.99-09128-g14e87a8a9b71 exe/x86_64.debian.13

β–Έ Credits: 0.06 β€’ Time: 6s
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 get_kiro_cli_version

● get_kiro_cli_version
 {
 "content": [
 {
 ...+9 lines (ctrl+o to toggle)

 Kiro CLI version: 2.7.0

β–Έ Credits: 0.06 β€’ Time: 4s

The information from the MCP tool execution comes back into the current Kiro CLI context. You can use the information returned from the tools along with the underlying Models:

 can I play Cyberpunk 2077 on this system?

 Based on the system info: no, not without significant workarounds.

 The main blockers:

 - RAM: 4.32 GB β€” Cyberpunk 2077 requires a minimum of 8 GB, recommended 12 GB. This alone disqualifies the system.
 - OS: Linux β€” The game supports Linux via Steam/Proton, but performance overhead makes the already-tight specs
 even worse.
 - CPU: 12 cores β€” That's actually fine.
 - GPU: Unknown β€” We don't have GPU info, which is the other critical component. Minimum is a GTX 970 / RX 480.

 Even if you had a capable GPU, the 4.32 GB of RAM is a hard blocker.

β–Έ Credits: 0.04 β€’ Time: 5s

But you can still play Doom!

> can I play Classic Doom on this machine?

 Yes, easily. Classic Doom (1993) requires:

 - 4 MB RAM β€” you have 4.32 GB
 - 386/486 CPU β€” you have a modern x86_64 with 12 cores

 Run it via a source port like Chocolate Doom (https://www.chocolate-doom.org/) or GZDoom (https://zdoom.org/):

 sudo apt install chocolate-doom

 You'll need the original doom.wad file (purchased from Steam/GOG), or use the free freedoom WAD:

 sudo apt install freedoom

β–Έ Credits: 0.04 β€’ Time: 4s

Summary

The strategy for using Python for MCP development with Kiro CLI was validated with an incremental step by step approach.

A minimal stdio transport MCP Server was started from Python source code and validated with Kiro CLI running as a MCP client in the same local environment.

Kiro CLI was then used to extend the sample Python code with several MCP tools and use these tools inside the context for the underlying LLM.

This approach can be extended to more complex deployments using other MCP transports and Cloud based options.