From empty folder to a working MCP tool in one afternoon

AnthropicKeyFreeAPI · Updated 2026-11-22 · 8 min read

Small toolbox with a few hand tools on a workbench
A proof of concept needs only a few well-chosen tools.

The Model Context Protocol has quickly become the standard way to give AI assistants access to tools and data. Registries list servers for everything from media analysis to wrappers around other coding agents, and teams preparing a proof of concept often start by looking for a contractor to build one from existing templates. Before you do, it helps to know how small a working server really is, so you can scope the job, judge quotes and perhaps build the first version yourself.

This guide builds a minimal MCP server in Python with the official SDK. It exposes two tools, one of which asks a free hosted model for a second opinion through the OpenAI-compatible endpoint on this site, and connects the server to an MCP client. The protocol was introduced by Anthropic and is now used across many tools; this site is not affiliated with Anthropic, and the protocol's official documentation remains the reference for details.

Frequently asked questions

What is an MCP server?

A program that describes a set of tools, resources or prompts in a standard format and answers requests from an MCP client. The client, usually an AI assistant or editor, shows those tools to its model and runs them when the model asks.

How does MCP differ from a plain REST API?

A REST API is designed for programmers who read its documentation. An MCP server describes itself to the client automatically, including tool names, descriptions and argument schemas, so a model can discover and use it without custom integration code.

What is the stdio transport?

The simplest way to run an MCP server: the client starts it as a subprocess and exchanges messages over standard input and output. It suits local tools. Remote servers use HTTP-based transports instead.

Does an MCP server need its own model?

No. Most servers simply run code, such as querying a database or calling an API. The model lives in the client. A server may call a model itself, as the second-opinion tool here does, but that is optional.

Which is better for a POC, building in-house or hiring a contractor?

If the tools are thin wrappers around existing APIs, building in-house is often quick. Hire help when you need authentication, multi-tenant hosting, security review or integration with complex internal systems.

What is free-ai?

An independent open-weight model of about 35B parameters, served without a key through an OpenAI-compatible API on this site. It is not Claude and not an Anthropic model.

Where can I find existing servers?

The official MCP registry and many community lists catalogue published servers. Review the code of any third-party server before running it, since it executes on your machine with your permissions.

Step by step

  1. Create the project — Make a folder and virtual environment, then install the mcp and openai packages.
  2. Define tools with FastMCP — Write typed functions with clear docstrings and decorate them with @mcp.tool(); call mcp.run() at the end of the script.
  3. Test with the inspector — Connect the MCP inspector to your server, list the tools and call each one by hand to confirm the outputs.
  4. Register it in a client — Add the server's command and script path to your MCP client's configuration and restart the client.
  5. Try it from the assistant — Ask the assistant to use each tool, watch the calls and refine names and descriptions until it picks them reliably.

What a minimal server needs

An MCP server has three responsibilities. It announces what it offers, it validates and runs incoming tool calls and it returns results in the protocol's format. The official SDKs take care of the protocol details, so your code is mostly ordinary functions with type hints and docstrings.

For a proof of concept, keep the scope tiny: two or three tools that demonstrate the idea, running locally over stdio. Hosting, authentication and scaling can come once the concept has proven its value.

It also helps to decide early what the proof of concept should prove. Is it that a model can use your internal data at all, that answers improve when it can, or that a particular workflow becomes faster? A clear question keeps the server small and makes the demo persuasive.

Tools, resources and prompts

Tools are actions the model can call. Resources are pieces of data the client can read. Prompts are reusable templates. A first server usually needs only tools.

Descriptions are part of the interface

The model decides when to call a tool based on its name and description. Clear, specific docstrings are as important as the code itself.

Setting up the project

Create a new folder and a virtual environment, then install the MCP Python SDK and the OpenAI client library. The SDK's FastMCP helper turns decorated functions into tools with schemas generated from type hints.

Keep dependencies minimal. Every package you add is code that runs inside the client's environment whenever the server starts.

Pin versions for the demo

Record the exact package versions in a requirements file. A proof of concept that breaks on the day of the demo because a dependency updated is an avoidable embarrassment.

mkdir mcp-poc && cd mcp-poc
python3 -m venv .venv
. .venv/bin/activate
pip install mcp openai
Socket being installed into a wall plate
The SDK handles the wiring; you write the functions.

Writing the server

The server below defines two tools. word_stats is pure Python and shows the basic shape. second_opinion sends a question to the free endpoint and returns the model's answer, which lets an assistant in your client consult a different model, a pattern people find useful for sanity checks.

Never print to standard output

Over stdio, standard output carries protocol messages. A stray print statement corrupts the stream. Log to standard error or a file instead.

Return structured data where it helps

Returning a dictionary rather than a formatted string lets the model pick out exactly the values it needs and reduces misreadings.

from mcp.server.fastmcp import FastMCP
from openai import OpenAI

mcp = FastMCP("poc-tools")
llm = OpenAI(base_url="https://api.anthropickeyfreeapi.com/v1", api_key="none")


@mcp.tool()
def word_stats(text: str) -> dict:
    """Count words, sentences and characters in a piece of text."""
    sentences = [s for s in text.replace("!", ".").replace("?", ".").split(".") if s.strip()]
    return {"words": len(text.split()), "sentences": len(sentences), "characters": len(text)}


@mcp.tool()
def second_opinion(question: str) -> str:
    """Ask an independent open model (free-ai) for a brief second opinion on a question."""
    r = llm.chat.completions.create(
        model="free-ai",
        messages=[
            {"role": "system", "content": "Give a concise, critical second opinion in under 150 words."},
            {"role": "user", "content": question},
        ],
        max_tokens=400,
    )
    return r.choices[0].message.content


if __name__ == "__main__":
    mcp.run()

Connecting it to a client

Most MCP clients are configured with a small JSON file listing servers, each with a command to start it. Point the command at the Python interpreter in your virtual environment and the script path. The exact file location depends on the client; check its documentation.

After restarting the client, the two tools should appear in its tool list. Ask the assistant to count the words in a paragraph, or to get a second opinion on a design choice, and watch it call your server.

Test with the inspector first

The MCP project provides an inspector tool that connects to a server and lets you call its tools by hand. It separates server bugs from client configuration problems.

{
  "mcpServers": {
    "poc-tools": {
      "command": "/home/you/mcp-poc/.venv/bin/python",
      "args": ["/home/you/mcp-poc/server.py"]
    }
  }
}
Lamp and devices plugged into a power strip
Clients start each configured server and expose its tools.

Designing tools a model can use well

A tool that works when you call it by hand can still confuse a model. Names should be verbs that say what happens. Descriptions should say when to use the tool and when not to. Arguments should be few, typed and named for their meaning.

Keep outputs compact. A tool that returns an entire database table forces the model to wade through it and eats context. Return the few rows or fields that answer the question, and offer a separate tool for more detail.

Name tools for the model, not for you

Internal abbreviations mean nothing to a model. A tool called get_open_invoices is chosen correctly far more often than one called inv_q2, even if the second is what your team calls it.

  • One clear purpose per tool
  • Docstrings that mention typical use cases
  • Typed arguments with sensible defaults
  • Errors returned as readable messages, not stack traces
  • Outputs small enough to fit comfortably in context

Security for a proof of concept

Even a demo server runs with your permissions. A tool that executes shell commands or writes files can be steered by a cleverly worded document the model reads, so limit tools to the narrow actions you need. Prefer read-only access for the first version.

If a tool calls an external API with a key, load the key from an environment variable rather than the source code, and never return it in a tool result. The second-opinion tool here needs no key at all, which keeps the demo simple, but remember that its prompts reach a third-party server that keeps a technical log per request.

Treat tool inputs as untrusted

Validate arguments as you would for a public web endpoint. The model may pass whatever text it was shown, including text written by someone hoping to misuse your tool.

Vault door ajar beside a chair and logbook
Even a demo server runs with your permissions.

When a free model is enough, and when not

The second-opinion pattern works well with a free model because the stakes are low: the assistant gets an extra perspective, not a final answer. For tools that summarise documents, extract fields or classify text, a 35B open model is often sufficient too.

For tools whose output is acted on directly, such as generating code that will be committed, a stronger commercial model is usually the better choice. Frontier models are clearly ahead on complex reasoning. Remember also that the free endpoint is text only, so a media analysis server needs a multimodal model behind it.

A second opinion from a different model is useful precisely because the two models have different training and blind spots. When both agree, you can proceed with more confidence; when they disagree, that is a signal to look more closely yourself.

Respect the shared limits

The endpoint allows one request per second per IP with bursts of three, two in parallel and 10,000 per day. An assistant calling a tool in a tight loop can hit 429; handle it by returning a short message asking the model to wait.

Scoping work for a contractor

If you decide to hire help, a working minimal server makes the brief much clearer. You can say exactly which tools exist, what they should return and what is missing. Typical additions for a production version include remote transport over HTTP, authentication, per-user permissions, logging, tests and deployment.

Ask candidates how they handle tool security, how they test servers against real clients and how they version the tool interface. A good answer to those questions matters more than familiarity with a particular template.

Own the tool definitions

Whoever writes the code, keep the decisions about tool names, descriptions and arguments in-house. They define how your product appears to every assistant that connects.

Two people reviewing a floor plan on a site table
A working prototype makes the contractor brief concrete.

Growing beyond the first version

Once the concept is proven, the same server can grow. Add resources for read-only data, move to an HTTP transport for remote use and publish it to a registry if it is meant for others. The patterns for loading instructions on demand, covered in portable skills and tool loops, pair naturally with MCP.

If several agents will share the server, think about concurrency and rate limits early; orchestrating multiple agents covers that side, and Messages vs chat completions explains the request formats your clients may use.

Version the tool interface

Once other people connect to your server, renaming a tool or changing an argument breaks their setups. Add new tools instead of changing old ones, and retire old ones with notice.

Try the free API

Send a prompt to the keyless free-ai endpoint from the home page and see how it handles your own task, no signup needed.

Read also